@@ -59,30 +59,6 @@ class CallGraph : public CallGraphBase<CallGraph<N, F>> {
5959 FunctionGetter GetFunctionFromName,
6060 InstructionGetter GetInstructionFromId);
6161
62- // / A range of all functions that are vertices in the call-graph. The number
63- // / of vertex functions can be retrieved by getNumVertexFunctions().
64- [[nodiscard]] auto getAllVertexFunctions () const noexcept {
65- return llvm::make_first_range (CallersOf);
66- }
67-
68- // / A range of all call-sites that are vertices in the call-graph. The number
69- // / of vertex-callsites can be retrived by getNumVertexCallSites().
70- [[nodiscard]] auto getAllVertexCallSites () const noexcept {
71- return llvm::make_first_range (CalleesAt);
72- }
73-
74- [[nodiscard]] size_t getNumVertexFunctions () const noexcept {
75- return CallersOf.size ();
76- }
77- [[nodiscard]] size_t getNumVertexCallSites () const noexcept {
78- return CalleesAt.size ();
79- }
80-
81- // / The number of functions within this call-graph
82- [[nodiscard]] size_t size () const noexcept { return getNumVertexFunctions (); }
83-
84- [[nodiscard]] bool empty () const noexcept { return CallersOf.empty (); }
85-
8662 template <typename FunctionIdGetter, typename InstIdGetter>
8763 void printAsJson (llvm::raw_ostream &OS, FunctionIdGetter GetFunctionId,
8864 InstIdGetter GetInstructionId) const {
@@ -114,7 +90,7 @@ class CallGraph : public CallGraphBase<CallGraph<N, F>> {
11490 Fun2Id.reserve (CallersOf.size ());
11591
11692 size_t CurrId = 0 ;
117- for (const auto &Fun : getAllVertexFunctions ()) {
93+ for (const auto &Fun : this -> getAllVertexFunctions ()) {
11894 OS << CurrId << " [label=\" " ;
11995 OS.write_escaped (std::invoke (GetFunctionLabel, Fun)) << " \" ];\n " ;
12096 Fun2Id[Fun] = CurrId++;
@@ -147,6 +123,25 @@ class CallGraph : public CallGraphBase<CallGraph<N, F>> {
147123 return {};
148124 }
149125
126+ // / A range of all functions that are vertices in the call-graph. The number
127+ // / of vertex functions can be retrieved by getNumVertexFunctions().
128+ [[nodiscard]] auto getAllVertexFunctionsImpl () const noexcept {
129+ return llvm::make_first_range (CallersOf);
130+ }
131+
132+ // / A range of all call-sites that are vertices in the call-graph. The number
133+ // / of vertex-callsites can be retrived by getNumVertexCallSites().
134+ [[nodiscard]] auto getAllVertexCallSitesImpl () const noexcept {
135+ return llvm::make_first_range (CalleesAt);
136+ }
137+
138+ [[nodiscard]] size_t getNumVertexFunctionsImpl () const noexcept {
139+ return CallersOf.size ();
140+ }
141+ [[nodiscard]] size_t getNumVertexCallSitesImpl () const noexcept {
142+ return CalleesAt.size ();
143+ }
144+
150145 // ---
151146
152147 StableVector<InstructionVertexTy> InstVertexOwner;
@@ -274,7 +269,7 @@ CallGraph<N, F>::deserialize(const CallGraphData &PrecomputedCG,
274269 " Invalid Call-Instruction Id: " << JId);
275270 }
276271
277- CGBuilder.addCallEdge (CS, Fun);
272+ CGBuilder.addCallEdge (CS, Fun, CEdges );
278273 }
279274 }
280275 return CGBuilder.consumeCallGraph ();
0 commit comments