Lines Matching defs: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)); }
86 bool operator()(const GepNode *N1, const GepNode *N2) const {
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 {
185 // Note: GEP indices generally traverse nested types, and so a GepNode
199 GepNode *Parent;
207 GepNode() : Parent(nullptr) {}
208 GepNode(const GepNode *N) : Flags(N->Flags), Idx(N->Idx), PTy(N->PTy) {
215 friend raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN);
218 raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN) {
221 if (GN.Flags & GepNode::Root) {
225 if (GN.Flags & GepNode::Internal) {
231 if (GN.Flags & GepNode::Used) {
236 if (GN.Flags & GepNode::InBounds) {
241 if (GN.Flags & GepNode::Pointer) {
247 if (GN.Flags & GepNode::Root)
310 bool operator() (GepNode *N) const {
320 inline void *operator new(size_t, SpecificBumpPtrAllocator<GepNode> &A) {
348 GepNode *N = new (*Mem) GepNode;
350 uint32_t InBounds = GepI->isInBounds() ? GepNode::InBounds : 0;
354 N->Flags |= GepNode::Root | InBounds;
362 N->Flags |= GepNode::Pointer;
384 GepNode *PN = N;
388 GepNode *Nx = new (*Mem) GepNode;
390 Nx->Flags |= GepNode::Internal | InBounds;
402 PN->Flags |= GepNode::Used;
433 for (GepNode *N : Nodes) {
434 if (N->Flags & GepNode::Root) {
438 GepNode *PN = N->Parent;
443 static void nodes_for_root(GepNode *Root, NodeChildrenMap &NCM,
451 GepNode *N = *First;
464 using NodePair = std::pair<GepNode *, GepNode *>;
469 static const NodeSet *node_class(GepNode *N, NodeSymRel &Rel) {
476 // Create an ordered pair of GepNode pointers. The pair will be used in
479 static NodePair node_pair(GepNode *N1, GepNode *N2) {
487 static unsigned node_hash(GepNode *N) {
495 static bool node_eq(GepNode *N1, GepNode *N2, NodePairSet &Eq,
510 bool Root1 = N1->Flags & GepNode::Root;
511 uint32_t CmpFlags = GepNode::Root | GepNode::Pointer;
540 for (GepNode *N : Nodes) {
552 GepNode *N = *NI;
593 using ProjMap = std::map<const NodeSet *, GepNode *>;
596 GepNode *Min = *llvm::min_element(S, NodeOrder);
604 for (GepNode *N : S) {
608 if (NF & GepNode::Used)
624 for (GepNode *N : Nodes) {
625 if (N->Flags & GepNode::Root)
634 GepNode *Rep = F->second;
642 for (GepNode *N : Nodes) {
745 BasicBlock *HexagonCommonGEP::recalculatePlacement(GepNode *Node,
758 if (Node->Flags & GepNode::Used) {
778 for (GepNode *CN : Cs) {
810 BasicBlock *HexagonCommonGEP::recalculatePlacementRec(GepNode *Node,
818 for (GepNode *C : Cs)
836 bool HexagonCommonGEP::isInvariantIn(GepNode *Node, Loop *L) {
837 if (Node->Flags & GepNode::Root)
865 BasicBlock *HexagonCommonGEP::adjustForInvariance(GepNode *Node,
871 if (Node->Flags & GepNode::Root) {
908 for (GepNode *C : Cs)
936 inline bool is_constant(GepNode *N) {
942 void HexagonCommonGEP::separateChainForNode(GepNode *Node, Use *U,
949 GepNode *N = Node;
950 GepNode *C = nullptr, *NewNode = nullptr;
951 while (is_constant(N) && !(N->Flags & GepNode::Root)) {
953 GepNode *NewN = new (*Mem) GepNode(N);
959 NewN->Flags &= ~GepNode::Used;
981 Node->Flags &= ~GepNode::Used;
986 NewNode->Flags |= GepNode::Used;
992 void HexagonCommonGEP::separateConstantChains(GepNode *Node,
1002 for (GepNode *N : Ns) {
1003 if (!(N->Flags & GepNode::Used))
1036 GepNode *N = FN.first;
1052 for (GepNode *Root : Roots)
1058 for (GepNode *Root : Roots)
1065 for (GepNode *Root : Roots)
1083 GepNode *RN = NA[0];
1084 assert((RN->Flags & GepNode::Root) && "Creating GEP for non-root");
1096 if (!(NA[Idx]->Flags & GepNode::Pointer)) {
1104 GepNode *N = NA[Idx-1];
1108 if (NA[Idx]->Flags & GepNode::Pointer)
1113 NewInst->setIsInBounds(RN->Flags & GepNode::InBounds);
1124 void HexagonCommonGEP::getAllUsersForNode(GepNode *Node, ValueVect &Values,
1131 GepNode *N = *First;
1133 if (N->Flags & GepNode::Used) {
1158 GepNode *Root = *First, *Last = *First;
1177 LastUsed = (Last->Flags & GepNode::Used);
1184 GepNode *Child = CF->second.front();
1207 for (GepNode *CN : Cs) {
1208 CN->Flags &= ~GepNode::Internal;
1209 CN->Flags |= GepNode::Root;
1270 SpecificBumpPtrAllocator<GepNode> Allocator;