Skip to content

Commit d0f8b45

Browse files
authored
Merge pull request #4507 from compnerd/refs-to-nodes
2 parents 5d21c2a + 9203283 commit d0f8b45

File tree

6 files changed

+48
-45
lines changed

6 files changed

+48
-45
lines changed

include/swift/SIL/CFG.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,71 +29,71 @@ namespace llvm {
2929
template <> struct GraphTraits<swift::SILBasicBlock*> {
3030
typedef swift::SILBasicBlock NodeType;
3131
typedef NodeType::SuccessorListTy::iterator ChildIteratorType;
32-
typedef NodeType *NodeRef;
32+
typedef swift::SILBasicBlock *NodeRef;
3333

34-
static NodeType *getEntryNode(NodeType *BB) { return BB; }
34+
static NodeRef getEntryNode(NodeRef BB) { return BB; }
3535

36-
static ChildIteratorType child_begin(NodeType *N) {
36+
static ChildIteratorType child_begin(NodeRef N) {
3737
return N->getSuccessors().begin();
3838
}
39-
static ChildIteratorType child_end(NodeType *N) {
39+
static ChildIteratorType child_end(NodeRef N) {
4040
return N->getSuccessors().end();
4141
}
4242
};
4343

4444
template <> struct GraphTraits<const swift::SILBasicBlock*> {
4545
typedef const swift::SILBasicBlock NodeType;
4646
typedef NodeType::ConstSuccessorListTy::iterator ChildIteratorType;
47-
typedef NodeType *NodeRef;
47+
typedef const swift::SILBasicBlock *NodeRef;
4848

49-
static NodeType *getEntryNode(NodeType *BB) { return BB; }
49+
static NodeRef getEntryNode(NodeRef BB) { return BB; }
5050

51-
static ChildIteratorType child_begin(NodeType *N) {
51+
static ChildIteratorType child_begin(NodeRef N) {
5252
return N->getSuccessors().begin();
5353
}
54-
static ChildIteratorType child_end(NodeType *N) {
54+
static ChildIteratorType child_end(NodeRef N) {
5555
return N->getSuccessors().end();
5656
}
5757
};
5858

5959
template <> struct GraphTraits<Inverse<swift::SILBasicBlock*> > {
6060
typedef swift::SILBasicBlock NodeType;
6161
typedef NodeType::pred_iterator ChildIteratorType;
62-
typedef NodeType *NodeRef;
62+
typedef swift::SILBasicBlock *NodeRef;
6363

64-
static NodeType *getEntryNode(Inverse<swift::SILBasicBlock *> G) {
64+
static NodeRef getEntryNode(Inverse<swift::SILBasicBlock *> G) {
6565
return G.Graph;
6666
}
67-
static inline ChildIteratorType child_begin(NodeType *N) {
67+
static inline ChildIteratorType child_begin(NodeRef N) {
6868
return N->pred_begin();
6969
}
70-
static inline ChildIteratorType child_end(NodeType *N) {
70+
static inline ChildIteratorType child_end(NodeRef N) {
7171
return N->pred_end();
7272
}
7373
};
7474

7575
template <> struct GraphTraits<Inverse<const swift::SILBasicBlock*> > {
7676
typedef const swift::SILBasicBlock NodeType;
7777
typedef NodeType::pred_iterator ChildIteratorType;
78-
typedef NodeType *NodeRef;
78+
typedef const swift::SILBasicBlock *NodeRef;
7979

80-
static NodeType *getEntryNode(Inverse<const swift::SILBasicBlock *> G) {
80+
static NodeRef getEntryNode(Inverse<const swift::SILBasicBlock *> G) {
8181
return G.Graph;
8282
}
83-
static inline ChildIteratorType child_begin(NodeType *N) {
83+
static inline ChildIteratorType child_begin(NodeRef N) {
8484
return N->pred_begin();
8585
}
86-
static inline ChildIteratorType child_end(NodeType *N) {
86+
static inline ChildIteratorType child_end(NodeRef N) {
8787
return N->pred_end();
8888
}
8989
};
9090

9191
template <> struct GraphTraits<swift::SILFunction*>
9292
: public GraphTraits<swift::SILBasicBlock*> {
9393
typedef swift::SILFunction *GraphType;
94-
typedef NodeType *NodeRef;
94+
typedef swift::SILBasicBlock *NodeRef;
9595

96-
static NodeType *getEntryNode(GraphType F) { return &F->front(); }
96+
static NodeRef getEntryNode(GraphType F) { return &F->front(); }
9797

9898
typedef swift::SILFunction::iterator nodes_iterator;
9999
static nodes_iterator nodes_begin(GraphType F) { return F->begin(); }
@@ -104,9 +104,9 @@ template <> struct GraphTraits<swift::SILFunction*>
104104
template <> struct GraphTraits<Inverse<swift::SILFunction*> >
105105
: public GraphTraits<Inverse<swift::SILBasicBlock*> > {
106106
typedef Inverse<swift::SILFunction *> GraphType;
107-
typedef NodeType *NodeRef;
107+
typedef NodeRef NodeRef;
108108

109-
static NodeType *getEntryNode(GraphType F) { return &F.Graph->front(); }
109+
static NodeRef getEntryNode(GraphType F) { return &F.Graph->front(); }
110110

111111
typedef swift::SILFunction::iterator nodes_iterator;
112112
static nodes_iterator nodes_begin(GraphType F) { return F.Graph->begin(); }

include/swift/SIL/Dominance.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,21 @@ namespace llvm {
170170
template <> struct GraphTraits<swift::DominanceInfoNode *> {
171171
using NodeType = swift::DominanceInfoNode;
172172
using ChildIteratorType = NodeType::iterator;
173-
typedef NodeType *NodeRef;
173+
typedef swift::DominanceInfoNode *NodeRef;
174174

175-
static NodeType *getEntryNode(NodeType *N) { return N; }
176-
static inline ChildIteratorType child_begin(NodeType *N) {
177-
return N->begin();
178-
}
179-
static inline ChildIteratorType child_end(NodeType *N) { return N->end(); }
175+
static NodeRef getEntryNode(NodeRef N) { return N; }
176+
static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
177+
static inline ChildIteratorType child_end(NodeRef N) { return N->end(); }
180178
};
181179

182180
template <> struct GraphTraits<const swift::DominanceInfoNode *> {
183181
using NodeType = const swift::DominanceInfoNode;
184182
using ChildIteratorType = NodeType::const_iterator;
185-
typedef NodeType *NodeRef;
183+
typedef const swift::DominanceInfoNode *NodeRef;
186184

187-
static NodeType *getEntryNode(NodeType *N) { return N; }
188-
static inline ChildIteratorType child_begin(NodeType *N) {
189-
return N->begin();
190-
}
191-
static inline ChildIteratorType child_end(NodeType *N) { return N->end(); }
185+
static NodeRef getEntryNode(NodeRef N) { return N; }
186+
static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
187+
static inline ChildIteratorType child_end(NodeRef N) { return N->end(); }
192188
};
193189

194190
} // end namespace llvm

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,21 +731,23 @@ namespace llvm {
731731
template <> struct GraphTraits<CGForDotView::Node *> {
732732
typedef CGForDotView::Node NodeType;
733733
typedef CGForDotView::child_iterator ChildIteratorType;
734+
typedef CGForDotView::Node *NodeRef;
734735

735-
static NodeType *getEntryNode(NodeType *N) { return N; }
736-
static inline ChildIteratorType child_begin(NodeType *N) {
736+
static NodeRef getEntryNode(NodeRef N) { return N; }
737+
static inline ChildIteratorType child_begin(NodeRef N) {
737738
return N->Children.begin();
738739
}
739-
static inline ChildIteratorType child_end(NodeType *N) {
740+
static inline ChildIteratorType child_end(NodeRef N) {
740741
return N->Children.end();
741742
}
742743
};
743744

744745
template <> struct GraphTraits<CGForDotView *>
745746
: public GraphTraits<CGForDotView::Node *> {
746747
typedef CGForDotView *GraphType;
748+
typedef CGForDotView::Node *NodeRef;
747749

748-
static NodeType *getEntryNode(GraphType F) { return nullptr; }
750+
static NodeRef getEntryNode(GraphType F) { return nullptr; }
749751

750752
typedef CGForDotView::iterator nodes_iterator;
751753
static nodes_iterator nodes_begin(GraphType OCG) {

lib/SILOptimizer/Analysis/LoopRegionAnalysis.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,19 +1036,21 @@ namespace llvm {
10361036
template <> struct GraphTraits<LoopRegionWrapper> {
10371037
using NodeType = LoopRegionWrapper;
10381038
using ChildIteratorType = alledge_iterator;
1039+
typedef LoopRegionWrapper *NodeRef;
10391040

1040-
static NodeType *getEntryNode(NodeType *BB) { return BB; }
1041+
static NodeRef getEntryNode(NodeRef BB) { return BB; }
10411042

1042-
static ChildIteratorType child_begin(NodeType *N) { return N->begin(); }
1043-
static ChildIteratorType child_end(NodeType *N) { return N->end(); }
1043+
static ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
1044+
static ChildIteratorType child_end(NodeRef N) { return N->end(); }
10441045
};
10451046

10461047
template <>
10471048
struct GraphTraits<LoopRegionFunctionInfoGrapherWrapper *>
10481049
: public GraphTraits<LoopRegionWrapper> {
10491050
using GraphType = LoopRegionFunctionInfoGrapherWrapper;
1051+
typedef LoopRegionWrapper *NodeRef;
10501052

1051-
static NodeType *getEntryNode(GraphType *F) { return &F->Data[0]; }
1053+
static NodeRef getEntryNode(GraphType *F) { return &F->Data[0]; }
10521054

10531055
using nodes_iterator = std::vector<LoopRegionWrapper>::iterator;
10541056

lib/SILOptimizer/PassManager/PassManager.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,21 +758,23 @@ namespace llvm {
758758
template <> struct GraphTraits<CallGraph::Node *> {
759759
typedef CallGraph::Node NodeType;
760760
typedef CallGraph::child_iterator ChildIteratorType;
761+
typedef CallGraph::Node *NodeRef;
761762

762-
static NodeType *getEntryNode(NodeType *N) { return N; }
763-
static inline ChildIteratorType child_begin(NodeType *N) {
763+
static NodeRef getEntryNode(NodeRef N) { return N; }
764+
static inline ChildIteratorType child_begin(NodeRef N) {
764765
return N->Children.begin();
765766
}
766-
static inline ChildIteratorType child_end(NodeType *N) {
767+
static inline ChildIteratorType child_end(NodeRef N) {
767768
return N->Children.end();
768769
}
769770
};
770771

771772
template <> struct GraphTraits<CallGraph *>
772773
: public GraphTraits<CallGraph::Node *> {
773774
typedef CallGraph *GraphType;
775+
typedef CallGraph::Node *NodeRef;
774776

775-
static NodeType *getEntryNode(GraphType F) { return nullptr; }
777+
static NodeRef getEntryNode(GraphType F) { return nullptr; }
776778

777779
typedef CallGraph::iterator nodes_iterator;
778780
static nodes_iterator nodes_begin(GraphType CG) {

lib/SILOptimizer/Transforms/StackPromotion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,9 @@ namespace llvm {
429429
template <> struct GraphTraits<StackPromoter *>
430430
: public GraphTraits<swift::SILBasicBlock*> {
431431
typedef StackPromoter *GraphType;
432+
typedef swift::SILBasicBlock *NodeRef;
432433

433-
static NodeType *getEntryNode(GraphType SP) {
434+
static NodeRef getEntryNode(GraphType SP) {
434435
return &SP->getFunction()->front();
435436
}
436437

0 commit comments

Comments
 (0)