Expunge the last uses of std::map from LiveIntervals.
[oota-llvm.git] / include / llvm / GlobalVariable.h
index 5a42e78a4acbec2f74e725c015986b22ac4f0477..b6910d54c9bdd36e281ea0d780d4ebe195a35535 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "llvm/GlobalValue.h"
 #include "llvm/OperandTraits.h"
+#include "llvm/ADT/ilist_node.h"
 
 namespace llvm {
 
@@ -31,7 +32,7 @@ class PointerType;
 template<typename ValueSubClass, typename ItemParentClass>
   class SymbolTableListTraits;
 
-class GlobalVariable : public GlobalValue {
+class GlobalVariable : public GlobalValue, public ilist_node<GlobalVariable> {
   friend class SymbolTableListTraits<GlobalVariable, Module>;
   void *operator new(size_t, unsigned);       // Do not implement
   void operator=(const GlobalVariable &);     // Do not implement
@@ -39,10 +40,6 @@ class GlobalVariable : public GlobalValue {
 
   void setParent(Module *parent);
 
-  GlobalVariable *Prev, *Next;
-  void setNext(GlobalVariable *N) { Next = N; }
-  void setPrev(GlobalVariable *N) { Prev = N; }
-
   bool isConstantGlobal : 1;           // Is this a global constant?
   bool isThreadLocalSymbol : 1;        // Is this symbol "Thread Local"?
 
@@ -112,11 +109,15 @@ public:
   /// leads to undefined behavior.
   ///
   bool isConstant() const { return isConstantGlobal; }
-  void setConstant(bool Value) { isConstantGlobal = Value; }
+  void setConstant(bool Val) { isConstantGlobal = Val; }
 
   /// If the value is "Thread Local", its value isn't shared by the threads.
   bool isThreadLocal() const { return isThreadLocalSymbol; }
-  void setThreadLocal(bool Value) { isThreadLocalSymbol = Value; }
+  void setThreadLocal(bool Val) { isThreadLocalSymbol = Val; }
+
+  /// copyAttributesFrom - copy all additional attributes (those not needed to
+  /// create a GlobalVariable) from the GlobalVariable Src to this one.
+  void copyAttributesFrom(const GlobalValue *Src);
 
   /// removeFromParent - This method unlinks 'this' from the containing module,
   /// but does not delete it.
@@ -140,12 +141,6 @@ public:
   static inline bool classof(const Value *V) {
     return V->getValueID() == Value::GlobalVariableVal;
   }
-private:
-  // getNext/Prev - Return the next or previous global variable in the list.
-        GlobalVariable *getNext()       { return Next; }
-  const GlobalVariable *getNext() const { return Next; }
-        GlobalVariable *getPrev()       { return Prev; }
-  const GlobalVariable *getPrev() const { return Prev; }
 };
 
 template <>