Lines Matching refs:GepNode
70 struct GepNode;
71 using NodeSet = std::set<GepNode *>;
72 using NodeToValueMap = std::map<GepNode *, Value *>;
73 using NodeVect = std::vector<GepNode *>;
74 using NodeChildrenMap = std::map<GepNode *, NodeVect>;
76 using NodeToUsesMap = std::map<GepNode *, UseSet>;
83 void insert(const GepNode *N) { Map.insert(std::make_pair(N, ++LastNum)); } in insert()
86 bool operator()(const GepNode *N1, const GepNode *N2) const { in operator ()()
93 std::map<const GepNode *, unsigned> Map;
119 using ValueToNodeMap = std::map<Value *, GepNode *>;
121 using NodeToValuesMap = std::map<GepNode *, ValueVect>;
129 BasicBlock *recalculatePlacement(GepNode *Node, NodeChildrenMap &NCM,
131 BasicBlock *recalculatePlacementRec(GepNode *Node, NodeChildrenMap &NCM,
134 bool isInvariantIn(GepNode *Node, Loop *L);
136 BasicBlock *adjustForInvariance(GepNode *Node, NodeChildrenMap &NCM,
138 void separateChainForNode(GepNode *Node, Use *U, NodeToValueMap &Loc);
139 void separateConstantChains(GepNode *Node, NodeChildrenMap &NCM,
145 void getAllUsersForNode(GepNode *Node, ValueVect &Values,
154 SpecificBumpPtrAllocator<GepNode> *Mem;
176 struct GepNode { struct
199 GepNode *Parent;
207 GepNode() : Parent(nullptr) {} in GepNode() function
208 GepNode(const GepNode *N) : Flags(N->Flags), Idx(N->Idx), PTy(N->PTy) { in GepNode() function
215 friend raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN);
218 raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN) { in operator <<()
221 if (GN.Flags & GepNode::Root) { in operator <<()
225 if (GN.Flags & GepNode::Internal) { in operator <<()
231 if (GN.Flags & GepNode::Used) { in operator <<()
236 if (GN.Flags & GepNode::InBounds) { in operator <<()
241 if (GN.Flags & GepNode::Pointer) { in operator <<()
247 if (GN.Flags & GepNode::Root) in operator <<()
310 bool operator() (GepNode *N) const { in operator ()()
320 inline void *operator new(size_t, SpecificBumpPtrAllocator<GepNode> &A) { in operator new()
348 GepNode *N = new (*Mem) GepNode; in processGepInst()
350 uint32_t InBounds = GepI->isInBounds() ? GepNode::InBounds : 0; in processGepInst()
354 N->Flags |= GepNode::Root | InBounds; in processGepInst()
362 N->Flags |= GepNode::Pointer; in processGepInst()
384 GepNode *PN = N; in processGepInst()
388 GepNode *Nx = new (*Mem) GepNode; in processGepInst()
390 Nx->Flags |= GepNode::Internal | InBounds; in processGepInst()
402 PN->Flags |= GepNode::Used; in processGepInst()
433 for (GepNode *N : Nodes) { in invert_find_roots()
434 if (N->Flags & GepNode::Root) { in invert_find_roots()
438 GepNode *PN = N->Parent; in invert_find_roots()
443 static void nodes_for_root(GepNode *Root, NodeChildrenMap &NCM, in nodes_for_root()
451 GepNode *N = *First; in nodes_for_root()
464 using NodePair = std::pair<GepNode *, GepNode *>;
469 static const NodeSet *node_class(GepNode *N, NodeSymRel &Rel) { in node_class()
479 static NodePair node_pair(GepNode *N1, GepNode *N2) { in node_pair()
487 static unsigned node_hash(GepNode *N) { in node_hash()
495 static bool node_eq(GepNode *N1, GepNode *N2, NodePairSet &Eq, in node_eq()
510 bool Root1 = N1->Flags & GepNode::Root; in node_eq()
511 uint32_t CmpFlags = GepNode::Root | GepNode::Pointer; in node_eq()
540 for (GepNode *N : Nodes) { in common()
552 GepNode *N = *NI; in common()
593 using ProjMap = std::map<const NodeSet *, GepNode *>; in common()
596 GepNode *Min = *std::min_element(S.begin(), S.end(), NodeOrder); in common()
604 for (GepNode *N : S) { in common()
608 if (NF & GepNode::Used) in common()
624 for (GepNode *N : Nodes) { in common()
625 if (N->Flags & GepNode::Root) in common()
634 GepNode *Rep = F->second; in common()
642 for (GepNode *N : Nodes) { in common()
745 BasicBlock *HexagonCommonGEP::recalculatePlacement(GepNode *Node, in recalculatePlacement()
758 if (Node->Flags & GepNode::Used) { in recalculatePlacement()
778 for (GepNode *CN : Cs) { in recalculatePlacement()
810 BasicBlock *HexagonCommonGEP::recalculatePlacementRec(GepNode *Node, in recalculatePlacementRec()
818 for (GepNode *C : Cs) in recalculatePlacementRec()
836 bool HexagonCommonGEP::isInvariantIn(GepNode *Node, Loop *L) { in isInvariantIn()
837 if (Node->Flags & GepNode::Root) in isInvariantIn()
865 BasicBlock *HexagonCommonGEP::adjustForInvariance(GepNode *Node, in adjustForInvariance()
871 if (Node->Flags & GepNode::Root) { in adjustForInvariance()
908 for (GepNode *C : Cs) in adjustForInvariance()
936 inline bool is_constant(GepNode *N) { in is_constant()
942 void HexagonCommonGEP::separateChainForNode(GepNode *Node, Use *U, in separateChainForNode()
949 GepNode *N = Node; in separateChainForNode()
950 GepNode *C = nullptr, *NewNode = nullptr; in separateChainForNode()
951 while (is_constant(N) && !(N->Flags & GepNode::Root)) { in separateChainForNode()
953 GepNode *NewN = new (*Mem) GepNode(N); in separateChainForNode()
959 NewN->Flags &= ~GepNode::Used; in separateChainForNode()
981 Node->Flags &= ~GepNode::Used; in separateChainForNode()
986 NewNode->Flags |= GepNode::Used; in separateChainForNode()
992 void HexagonCommonGEP::separateConstantChains(GepNode *Node, in separateConstantChains()
1002 for (GepNode *N : Ns) { in separateConstantChains()
1003 if (!(N->Flags & GepNode::Used)) in separateConstantChains()
1036 GepNode *N = FN.first; in separateConstantChains()
1052 for (GepNode *Root : Roots) in computeNodePlacement()
1058 for (GepNode *Root : Roots) in computeNodePlacement()
1065 for (GepNode *Root : Roots) in computeNodePlacement()
1083 GepNode *RN = NA[0]; in fabricateGEP()
1084 assert((RN->Flags & GepNode::Root) && "Creating GEP for non-root"); in fabricateGEP()
1096 if (!(NA[Idx]->Flags & GepNode::Pointer)) { in fabricateGEP()
1104 GepNode *N = NA[Idx-1]; in fabricateGEP()
1108 if (NA[Idx]->Flags & GepNode::Pointer) in fabricateGEP()
1113 NewInst->setIsInBounds(RN->Flags & GepNode::InBounds); in fabricateGEP()
1124 void HexagonCommonGEP::getAllUsersForNode(GepNode *Node, ValueVect &Values, in getAllUsersForNode()
1131 GepNode *N = *First; in getAllUsersForNode()
1133 if (N->Flags & GepNode::Used) { in getAllUsersForNode()
1158 GepNode *Root = *First, *Last = *First; in materialize()
1177 LastUsed = (Last->Flags & GepNode::Used); in materialize()
1184 GepNode *Child = CF->second.front(); in materialize()
1207 for (GepNode *CN : Cs) { in materialize()
1208 CN->Flags &= ~GepNode::Internal; in materialize()
1209 CN->Flags |= GepNode::Root; in materialize()
1270 SpecificBumpPtrAllocator<GepNode> Allocator; in runOnFunction()