@@ -130,6 +130,9 @@ GeneralStatistics GeneralStatisticsAnalysis::runOnModule(llvm::Module &M) {
130130 ++Stats.GlobalPointers ;
131131 }
132132 ++Stats.Globals ;
133+ if (Global.isConstant ()) {
134+ ++Stats.GlobalConsts ;
135+ }
133136 }
134137 // register stuff in PAMM
135138 // For performance reasons (and out of sheer convenience) we simply initialize
@@ -167,6 +170,7 @@ GeneralStatistics GeneralStatisticsAnalysis::runOnModule(llvm::Module &M) {
167170 PHASAR_LOG_LEVEL (INFO, " Functions : " << Stats.Functions );
168171 PHASAR_LOG_LEVEL (INFO, " Globals : " << Stats.Globals );
169172 PHASAR_LOG_LEVEL (INFO, " Global Pointer : " << Stats.GlobalPointers );
173+ PHASAR_LOG_LEVEL (INFO, " Global Consts : " << Stats.GlobalConsts );
170174 PHASAR_LOG_LEVEL (INFO, " Memory Intrinsics : " << Stats.MemIntrinsics );
171175 PHASAR_LOG_LEVEL (INFO,
172176 " Store Instructions : " << Stats.StoreInstructions );
@@ -197,6 +201,8 @@ size_t GeneralStatistics::getFunctions() const { return Functions; }
197201
198202size_t GeneralStatistics::getGlobals () const { return Globals; }
199203
204+ size_t GeneralStatistics::getGlobalConsts () const { return GlobalConsts; }
205+
200206size_t GeneralStatistics::getMemoryIntrinsics () const { return MemIntrinsics; }
201207
202208size_t GeneralStatistics::getStoreInstructions () const {
@@ -233,6 +239,8 @@ nlohmann::json GeneralStatistics::getAsJson() const {
233239 J[" GetElementPtrs" ] = GetElementPtrs;
234240 J[" BasicBlocks" ] = BasicBlocks;
235241 J[" PhiNodes" ] = PhiNodes;
242+ J[" GlobalConsts" ] = GlobalConsts;
243+ J[" GlobalPointers" ] = GlobalPointers;
236244 return J;
237245}
238246
@@ -244,6 +252,8 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
244252 << " LLVM IR instructions:\t " << Statistics.Instructions << " \n "
245253 << " Functions:\t " << Statistics.Functions << " \n "
246254 << " Global Variables:\t " << Statistics.Globals << " \n "
255+ << " Global Variable Consts:\t " << Statistics.GlobalConsts << " \n "
256+ << " Global Pointers:\t " << Statistics.GlobalPointers << " \n "
247257 << " Alloca Instructions:\t " << Statistics.AllocaInstructions .size ()
248258 << " \n "
249259 << " Call Sites:\t " << Statistics.CallSites << " \n "
0 commit comments