@@ -33,107 +33,156 @@ class Module;
3333
3434namespace psr {
3535
36- class GeneralStatistics {
37- private:
38- friend class GeneralStatisticsAnalysis ;
36+ struct GeneralStatistics {
37+
3938 size_t Functions = 0 ;
39+ size_t ExternalFunctions = 0 ;
40+ size_t FunctionDefinitions = 0 ;
41+ size_t AddressTakenFunctions = 0 ;
4042 size_t Globals = 0 ;
43+ size_t GlobalConsts = 0 ;
44+ size_t ExternalGlobals = 0 ;
45+ size_t GlobalsDefinitions = 0 ;
4146 size_t BasicBlocks = 0 ;
4247 size_t AllocationSites = 0 ;
4348 size_t CallSites = 0 ;
49+ size_t DebugIntrinsics = 0 ;
4450 size_t Instructions = 0 ;
4551 size_t StoreInstructions = 0 ;
4652 size_t LoadInstructions = 0 ;
4753 size_t MemIntrinsics = 0 ;
48- size_t GlobalPointers = 0 ;
4954 size_t Branches = 0 ;
55+ size_t Switches = 0 ;
5056 size_t GetElementPtrs = 0 ;
57+ size_t LandingPads = 0 ;
5158 size_t PhiNodes = 0 ;
52- size_t GlobalConsts = 0 ;
59+ size_t NumInlineAsm = 0 ;
60+ size_t IndCalls = 0 ;
61+ size_t TotalNumOperands = 0 ;
62+ size_t TotalNumUses = 0 ;
63+ size_t TotalNumPredecessorBBs = 0 ;
64+ size_t TotalNumSuccessorBBs = 0 ;
65+ size_t MaxNumOperands = 0 ;
66+ size_t MaxNumUses = 0 ;
67+ size_t MaxNumPredecessorBBs = 0 ;
68+ size_t MaxNumSuccessorBBs = 0 ;
69+ size_t NumInstWithMultipleUses = 0 ;
70+ size_t NumInstsUsedOutsideBB = 0 ;
71+ size_t NonVoidInsts = 0 ;
5372 std::set<const llvm::Type *> AllocatedTypes;
5473 std::set<const llvm::Instruction *> AllocaInstructions;
5574 std::set<const llvm::Instruction *> RetResInstructions;
56- std::string ModuleName = " " ;
75+ std::string ModuleName{} ;
5776
58- public:
5977 /* *
6078 * @brief Returns the number of Allocation sites.
6179 */
62- [[nodiscard]] size_t getAllocationsites () const ;
80+ [[nodiscard]] [[deprecated(
81+ " Getters are no longer needed. Use AllocationSites instead" )]] size_t
82+ getAllocationsites () const ;
6383
6484 /* *
6585 * @brief Returns the number of Function calls.
6686 */
67- [[nodiscard]] size_t getFunctioncalls () const ;
87+ [[nodiscard]] [[deprecated(
88+ " Getters are no longer needed. Use CallSites instead" )]] size_t
89+ getFunctioncalls () const ;
6890
6991 /* *
7092 * @brief Returns the number of Instructions.
7193 */
72- [[nodiscard]] size_t getInstructions () const ;
94+ [[nodiscard]] [[deprecated(
95+ " Getters are no longer needed. Use Instructions instead" )]] size_t
96+ getInstructions () const ;
7397
7498 /* *
7599 * @brief Returns the number of global pointers.
76100 */
77- [[nodiscard]] size_t getGlobalPointers () const ;
101+ [[nodiscard]] [[deprecated(
102+ " All globals are pointers. Use Globals instead" )]] size_t
103+ getGlobalPointers () const ;
78104
79105 /* *
80106 * @brief Returns the number of basic blocks.
81107 */
82- [[nodiscard]] size_t getBasicBlocks () const ;
108+ [[nodiscard]] [[deprecated(
109+ " Getters are no longer needed. Use BasicBlocks instead" )]] size_t
110+ getBasicBlocks () const ;
83111
84112 /* *
85113 * @brief Returns the number of functions.
86114 */
87- [[nodiscard]] size_t getFunctions () const ;
115+ [[nodiscard]] [[deprecated(
116+ " Getters are no longer needed. Use Functions instead" )]] size_t
117+ getFunctions () const ;
88118
89119 /* *
90120 * @brief Returns the number of globals.
91121 */
92- [[nodiscard]] size_t getGlobals () const ;
122+ [[nodiscard]] [[deprecated(
123+ " Getters are no longer needed. Use Globals instead" )]] size_t
124+ getGlobals () const ;
93125
94126 /* *
95127 * @brief Returns the number of constant globals.
96128 */
97- [[nodiscard]] size_t getGlobalConsts () const ;
129+ [[nodiscard]] [[deprecated(
130+ " Getters are no longer needed. Use GlobalConsts instead" )]] size_t
131+ getGlobalConsts () const ;
98132
99133 /* *
100134 * @brief Returns the number of memory intrinsics.
101135 */
102- [[nodiscard]] size_t getMemoryIntrinsics () const ;
136+ [[nodiscard]] [[deprecated(
137+ " Getters are no longer needed. Use MemIntrinsics instead" )]] size_t
138+ getMemoryIntrinsics () const ;
103139
104140 /* *
105141 * @brief Returns the number of store instructions.
106142 */
107- [[nodiscard]] size_t getStoreInstructions () const ;
143+ [[nodiscard]] [[deprecated(
144+ " Getters are no longer needed. Use StoreInstructions instead" )]] size_t
145+ getStoreInstructions () const ;
108146
109147 /* *
110148 * @brief Returns the number of load instructions.
111149 */
112- [[nodiscard]] size_t getLoadInstructions ();
150+ [[nodiscard]] [[deprecated(
151+ " Getters are no longer needed. Use LoadInstructions instead; this "
152+ " function seems to be broken anyway" )]] size_t
153+ getLoadInstructions ();
113154
114155 /* *
115156 * @brief Returns all possible Types.
116157 */
117- [[nodiscard]] const std::set<const llvm::Type *> &getAllocatedTypes () const ;
158+ [[nodiscard]] [[deprecated(
159+ " Getters are no longer needed. Use AllocatedTypes instead" )]] const std::
160+ set<const llvm::Type *> &
161+ getAllocatedTypes () const ;
118162
119163 /* *
120164 * @brief Returns all stack and heap allocating instructions.
121165 */
122- [[nodiscard]] const std::set<const llvm::Instruction *> &
166+ [[nodiscard]] [[deprecated(
167+ " Getters are no longer needed. Use AllocaInstructions "
168+ " instead" )]] const std::set<const llvm::Instruction *> &
123169 getAllocaInstructions () const ;
124170
125171 /* *
126172 * @brief Returns all Return and Resume Instructions.
127173 */
128- [[nodiscard]] const std::set<const llvm::Instruction *> &
174+ [[nodiscard]] [[deprecated(
175+ " Getters are no longer needed. Use RetResInstructions "
176+ " instead" )]] const std::set<const llvm::Instruction *> &
129177 getRetResInstructions () const ;
178+
130179 [[nodiscard]] nlohmann::json getAsJson () const ;
131180 void printAsJson (llvm::raw_ostream &OS = llvm::outs()) const ;
132-
133- friend llvm::raw_ostream &operator <<(llvm::raw_ostream &OS,
134- const GeneralStatistics &Statistics);
135181};
136182
183+ llvm::raw_ostream &operator <<(llvm::raw_ostream &OS,
184+ const GeneralStatistics &Statistics);
185+
137186/* *
138187 * This class uses the Module Pass Mechanism of LLVM to compute
139188 * some statistics about a Module. This includes the number of
0 commit comments