Lines Matching defs:GepNode

69   struct GepNode;
70 using NodeSet = std::set<GepNode *>;
71 using NodeToValueMap = std::map<GepNode *, Value *>;
72 using NodeVect = std::vector<GepNode *>;
73 using NodeChildrenMap = std::map<GepNode *, NodeVect>;
75 using NodeToUsesMap = std::map<GepNode *, UseSet>;
82 void insert(const GepNode *N) { Map.insert(std::make_pair(N, ++LastNum)); }
85 bool operator()(const GepNode *N1, const GepNode *N2) const {
92 std::map<const GepNode *, unsigned> Map;
118 using ValueToNodeMap = std::map<Value *, GepNode *>;
120 using NodeToValuesMap = std::map<GepNode *, ValueVect>;
128 BasicBlock *recalculatePlacement(GepNode *Node, NodeChildrenMap &NCM,
130 BasicBlock *recalculatePlacementRec(GepNode *Node, NodeChildrenMap &NCM,
133 bool isInvariantIn(GepNode *Node, Loop *L);
135 BasicBlock *adjustForInvariance(GepNode *Node, NodeChildrenMap &NCM,
137 void separateChainForNode(GepNode *Node, Use *U, NodeToValueMap &Loc);
138 void separateConstantChains(GepNode *Node, NodeChildrenMap &NCM,
144 void getAllUsersForNode(GepNode *Node, ValueVect &Values,
153 SpecificBumpPtrAllocator<GepNode> *Mem;
175 struct GepNode {
184 // Note: GEP indices generally traverse nested types, and so a GepNode
198 GepNode *Parent;
206 GepNode() : Parent(nullptr) {}
207 GepNode(const GepNode *N) : Flags(N->Flags), Idx(N->Idx), PTy(N->PTy) {
214 friend raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN);
217 raw_ostream &operator<< (raw_ostream &OS, const GepNode &GN) {
220 if (GN.Flags & GepNode::Root) {
224 if (GN.Flags & GepNode::Internal) {
230 if (GN.Flags & GepNode::Used) {
235 if (GN.Flags & GepNode::InBounds) {
240 if (GN.Flags & GepNode::Pointer) {
246 if (GN.Flags & GepNode::Root)
309 bool operator() (GepNode *N) const {
319 inline void *operator new(size_t, SpecificBumpPtrAllocator<GepNode> &A) {
347 GepNode *N = new (*Mem) GepNode;
349 uint32_t InBounds = GepI->isInBounds() ? GepNode::InBounds : 0;
353 N->Flags |= GepNode::Root | InBounds;
361 N->Flags |= GepNode::Pointer;
383 GepNode *PN = N;
387 GepNode *Nx = new (*Mem) GepNode;
389 Nx->Flags |= GepNode::Internal | InBounds;
401 PN->Flags |= GepNode::Used;
432 for (GepNode *N : Nodes) {
433 if (N->Flags & GepNode::Root) {
437 GepNode *PN = N->Parent;
442 static void nodes_for_root(GepNode *Root, NodeChildrenMap &NCM,
450 GepNode *N = *First;
463 using NodePair = std::pair<GepNode *, GepNode *>;
468 static const NodeSet *node_class(GepNode *N, NodeSymRel &Rel) {
475 // Create an ordered pair of GepNode pointers. The pair will be used in
478 static NodePair node_pair(GepNode *N1, GepNode *N2) {
486 static unsigned node_hash(GepNode *N) {
494 static bool node_eq(GepNode *N1, GepNode *N2, NodePairSet &Eq,
509 bool Root1 = N1->Flags & GepNode::Root;
510 uint32_t CmpFlags = GepNode::Root | GepNode::Pointer;
539 for (GepNode *N : Nodes) {
551 GepNode *N = *NI;
592 using ProjMap = std::map<const NodeSet *, GepNode *>;
595 GepNode *Min = *llvm::min_element(S, NodeOrder);
603 for (GepNode *N : S) {
607 if (NF & GepNode::Used)
623 for (GepNode *N : Nodes) {
624 if (N->Flags & GepNode::Root)
633 GepNode *Rep = F->second;
641 for (GepNode *N : Nodes) {
744 BasicBlock *HexagonCommonGEP::recalculatePlacement(GepNode *Node,
757 if (Node->Flags & GepNode::Used) {
777 for (GepNode *CN : Cs) {
809 BasicBlock *HexagonCommonGEP::recalculatePlacementRec(GepNode *Node,
817 for (GepNode *C : Cs)
835 bool HexagonCommonGEP::isInvariantIn(GepNode *Node, Loop *L) {
836 if (Node->Flags & GepNode::Root)
864 BasicBlock *HexagonCommonGEP::adjustForInvariance(GepNode *Node,
870 if (Node->Flags & GepNode::Root) {
907 for (GepNode *C : Cs)
935 inline bool is_constant(GepNode *N) {
941 void HexagonCommonGEP::separateChainForNode(GepNode *Node, Use *U,
948 GepNode *N = Node;
949 GepNode *C = nullptr, *NewNode = nullptr;
950 while (is_constant(N) && !(N->Flags & GepNode::Root)) {
952 GepNode *NewN = new (*Mem) GepNode(N);
958 NewN->Flags &= ~GepNode::Used;
980 Node->Flags &= ~GepNode::Used;
985 NewNode->Flags |= GepNode::Used;
991 void HexagonCommonGEP::separateConstantChains(GepNode *Node,
1001 for (GepNode *N : Ns) {
1002 if (!(N->Flags & GepNode::Used))
1035 GepNode *N = FN.first;
1051 for (GepNode *Root : Roots)
1057 for (GepNode *Root : Roots)
1064 for (GepNode *Root : Roots)
1082 GepNode *RN = NA[0];
1083 assert((RN->Flags & GepNode::Root) && "Creating GEP for non-root");
1095 if (!(NA[Idx]->Flags & GepNode::Pointer)) {
1103 GepNode *N = NA[Idx-1];
1107 if (NA[Idx]->Flags & GepNode::Pointer)
1112 NewInst->setIsInBounds(RN->Flags & GepNode::InBounds);
1123 void HexagonCommonGEP::getAllUsersForNode(GepNode *Node, ValueVect &Values,
1130 GepNode *N = *First;
1132 if (N->Flags & GepNode::Used) {
1157 GepNode *Root = *First, *Last = *First;
1176 LastUsed = (Last->Flags & GepNode::Used);
1183 GepNode *Child = CF->second.front();
1206 for (GepNode *CN : Cs) {
1207 CN->Flags &= ~GepNode::Internal;
1208 CN->Flags |= GepNode::Root;
1269 SpecificBumpPtrAllocator<GepNode> Allocator;