Lines Matching refs:Node
107 class Node;
127 /// edges referencing them are updated to point to the graph \c Node objects
130 /// node of the graph and providing a reference back to the graph in order to
134 /// edges. The edges are stored in the source node and point at the target
135 /// node. This allows the edge structure itself to be a very compact data
144 explicit Edge(Node &N, Kind K);
160 /// have built a graph node for the function yet or not.
163 /// Get the call graph node referenced by this edge if one exists.
165 /// This requires that the edge is not null. If we have built a graph node
166 /// for the function this edge points to, this will return that node,
168 Node *getNode() const;
170 /// Get the call graph node for this edge, building it if necessary.
173 /// a graph node for the function this edge points to, this will first ask
174 /// the graph to build that node, inserting it into all the relevant
176 Node &getNode(LazyCallGraph &G);
179 friend class LazyCallGraph::Node;
181 PointerIntPair<PointerUnion<Function *, Node *>, 1, Kind> Value;
189 /// A node in the call graph.
191 /// This represents a single node. It's primary roles are to cache the list of
194 class Node {
202 // stored directly within the node. These are both '-1' when nodes are part
212 Node(LazyCallGraph &G, Function &F);
217 /// Internal helper to insert an edge to a node.
218 void insertEdgeInternal(Node &ChildN, Edge::Kind EK);
226 /// Print the name of this node's function.
227 friend raw_ostream &operator<<(raw_ostream &OS, const Node &N) {
231 /// Dump the name of this node's function to stderr.
249 const Edge &operator[](Node &N) const { return (*this)[N.getFunction()]; }
263 bool operator==(const Node &N) const { return this == &N; }
264 bool operator!=(const Node &N) const { return !operator==(N); }
277 friend class LazyCallGraph::Node;
310 friend class LazyCallGraph::Node;
351 friend class LazyCallGraph::Node;
354 SmallVector<Node *, 1> Nodes;
375 for (LazyCallGraph::Node &N : C) {
404 typedef pointee_iterator<SmallVectorImpl<Node *>::const_iterator> iterator;
441 friend class LazyCallGraph::Node;
568 SmallVector<SCC *, 1> switchInternalEdgeToCall(Node &SourceN,
569 Node &TargetN);
582 void switchInternalEdgeToRef(Node &SourceN, Node &TargetN);
588 void switchOutgoingEdgeToCall(Node &SourceN, Node &TargetN);
594 void switchOutgoingEdgeToRef(Node &SourceN, Node &TargetN);
596 /// Insert a ref edge from one node in this RefSCC to another in this
608 void insertInternalRefEdge(Node &SourceN, Node &TargetN);
616 void insertOutgoingEdge(Node &SourceN, Node &TargetN, Edge::Kind EK);
643 SmallVector<RefSCC *, 1> insertIncomingRefEdge(Node &SourceN,
644 Node &TargetN);
656 void removeOutgoingEdge(Node &SourceN, Node &TargetN);
699 SmallVector<RefSCC *, 1> removeInternalRefEdge(Node &SourceN,
700 Node &TargetN);
715 friend class LazyCallGraph::Node;
723 // Build the begin iterator for a node.
728 // Build the end iterator for a node. This is selected purely by overload.
776 Node *lookup(const Function &F) const { return NodeMap.lookup(&F); }
782 SCC *lookupSCC(Node &N) const { return SCCMap.lookup(&N); }
788 RefSCC *lookupRefSCC(Node &N) const {
795 /// Get a graph node for a given function, scanning it to populate the graph
797 Node &get(Function &F) {
798 Node *&N = NodeMap[&F];
809 /// call graph. They can be used to update the core node-graph during
810 /// a node-based inorder traversal that precedes any SCC-based traversal.
816 void insertEdge(Node &Caller, Function &Callee, Edge::Kind EK);
824 void removeEdge(Node &Caller, Function &Callee);
834 typedef SmallVectorImpl<Node *>::reverse_iterator node_stack_iterator;
838 SpecificBumpPtrAllocator<Node> BPA;
840 /// Maps function->node for fast lookup.
841 DenseMap<const Function *, Node *> NodeMap;
856 DenseMap<Node *, SCC *> SCCMap;
867 SmallVector<std::pair<Node *, edge_iterator>, 4> DFSStack;
873 SmallVector<Node *, 4> PendingRefSCCStack;
880 Node &insertInto(Function &F, Node *&MappedN);
908 /// Retrieve the next node in the post-order RefSCC walk of the call graph.
914 inline LazyCallGraph::Edge::Edge(Node &N, Kind K) : Value(&N, K) {}
931 return P.get<Node *>()->getFunction();
934 inline LazyCallGraph::Node *LazyCallGraph::Edge::getNode() const {
937 if (auto *N = P.dyn_cast<Node *>())
943 inline LazyCallGraph::Node &LazyCallGraph::Edge::getNode(LazyCallGraph &G) {
946 if (auto *N = P.dyn_cast<Node *>())
949 Node &N = G.get(*P.get<Function *>());
955 template <> struct GraphTraits<LazyCallGraph::Node *> {
956 typedef LazyCallGraph::Node NodeType;
964 typedef LazyCallGraph::Node NodeType;