llvm.org GIT mirror llvm / 76d3838
Reapply r66415, which was reverted in r66426 for causing a bootstrap failure. Bootstraps here on x86-32-linux and x86-64-linux. Requested by the author Gabor Greif who says that a bug that might have been causing the failure has since been fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67844 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 11 years ago
6 changed file(s) with 34 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1717 namespace llvm {
1818
1919 template
20 struct ilist_nextprev_traits;
20 struct ilist_traits;
21
22 /// ilist_half_node - Base class that provides prev services for sentinels.
23 ///
24 template
25 class ilist_half_node {
26 friend struct ilist_traits;
27 NodeTy *Prev;
28 protected:
29 NodeTy *getPrev() { return Prev; }
30 const NodeTy *getPrev() const { return Prev; }
31 void setPrev(NodeTy *P) { Prev = P; }
32 ilist_half_node() : Prev(0) {}
33 };
2134
2235 template
23 struct ilist_traits;
36 struct ilist_nextprev_traits;
2437
2538 /// ilist_node - Base class that provides next/prev services for nodes
2639 /// that use ilist_nextprev_traits or ilist_default_traits.
2740 ///
2841 template
29 class ilist_node {
30 private:
42 class ilist_node : ilist_half_node {
3143 friend struct ilist_nextprev_traits;
3244 friend struct ilist_traits;
33 NodeTy *Prev, *Next;
34 NodeTy *getPrev() { return Prev; }
45 NodeTy *Next;
3546 NodeTy *getNext() { return Next; }
36 const NodeTy *getPrev() const { return Prev; }
3747 const NodeTy *getNext() const { return Next; }
38 void setPrev(NodeTy *N) { Prev = N; }
3948 void setNext(NodeTy *N) { Next = N; }
4049 protected:
41 ilist_node() : Prev(0), Next(0) {}
50 ilist_node() : Next(0) {}
4251 };
52
53 /// When assertions are off, the Next field of sentinels
54 /// will not be accessed. So it is not necessary to allocate
55 /// space for it. The following macro selects the most
56 /// efficient trais class.
57 #ifndef NDEBUG
58 # define ILIST_NODE ilist_node
59 #else
60 # define ILIST_NODE ilist_half_node
61 #endif
4362
4463 } // End llvm namespace
4564
4545 Instruction *ensureHead(Instruction*) const { return createSentinel(); }
4646 static void noteHead(Instruction*, Instruction*) {}
4747 private:
48 mutable ilist_node Sentinel;
48 mutable ILIST_NODE Sentinel;
4949 };
5050
5151 /// This represents a single basic block in LLVM. A basic block is simply a
2525 template <>
2626 struct ilist_traits : public ilist_default_traits {
2727 private:
28 mutable ilist_node Sentinel;
28 mutable ILIST_NODE Sentinel;
2929
3030 // this is only set by the MachineBasicBlock owning the LiveList
3131 friend class MachineBasicBlock;
3636 template <>
3737 struct ilist_traits
3838 : public ilist_default_traits {
39 mutable ilist_node Sentinel;
39 mutable ILIST_NODE Sentinel;
4040 public:
4141 MachineBasicBlock *createSentinel() const {
4242 return static_cast(&Sentinel);
3838
3939 template<> struct ilist_traits : public ilist_default_traits {
4040 private:
41 mutable ilist_node Sentinel;
41 mutable ILIST_NODE Sentinel;
4242 public:
4343 SDNode *createSentinel() const {
4444 return static_cast(&Sentinel);
4444
4545 static ValueSymbolTable *getSymTab(Function *ItemParent);
4646 private:
47 mutable ilist_node Sentinel;
47 mutable ILIST_NODE Sentinel;
4848 };
4949
5050 template<> struct ilist_traits
6161
6262 static ValueSymbolTable *getSymTab(Function *ItemParent);
6363 private:
64 mutable ilist_node Sentinel;
64 mutable ILIST_NODE Sentinel;
6565 };
6666
6767 class Function : public GlobalValue, public Annotable,