Added ImmutableMap constructor that accepts a const TreeTy*.
[oota-llvm.git] / include / llvm / GlobalValue.h
index 808471d0a4c37ed44847d5327eb38288628bf9ce..6b6610b724f0dde6dbbf77edc9ea1a90e8e4dda6 100644 (file)
@@ -38,7 +38,8 @@ public:
     DLLImportLinkage,   ///< Function to be imported from DLL
     DLLExportLinkage,   ///< Function to be accessible from DLL
     ExternalWeakLinkage,///< ExternalWeak linkage description
-    GhostLinkage        ///< Stand-in functions for streaming fns from BC files    
+    GhostLinkage,       ///< Stand-in functions for streaming fns from BC files
+    CommonLinkage       ///< Tentative definitions
   };
 
   /// @brief An enumeration for the kinds of visibility of global values.
@@ -49,9 +50,9 @@ public:
   };
 
 protected:
-  GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps,
+  GlobalValue(const Type *ty, ValueTy vty, Use *Ops, unsigned NumOps,
               LinkageTypes linkage, const std::string &name = "")
-    : Constant(Ty, vty, Ops, NumOps), Parent(0),
+    : Constant(ty, vty, Ops, NumOps), Parent(0),
       Linkage(linkage), Visibility(DefaultVisibility), Alignment(0) {
     if (!name.empty()) setName(name);
   }
@@ -100,6 +101,7 @@ public:
   bool hasExternalLinkage()   const { return Linkage == ExternalLinkage; }
   bool hasLinkOnceLinkage()   const { return Linkage == LinkOnceLinkage; }
   bool hasWeakLinkage()       const { return Linkage == WeakLinkage; }
+  bool hasCommonLinkage()     const { return Linkage == CommonLinkage; }
   bool hasAppendingLinkage()  const { return Linkage == AppendingLinkage; }
   bool hasInternalLinkage()   const { return Linkage == InternalLinkage; }
   bool hasDLLImportLinkage()  const { return Linkage == DLLImportLinkage; }
@@ -108,6 +110,19 @@ public:
   void setLinkage(LinkageTypes LT) { Linkage = LT; }
   LinkageTypes getLinkage() const { return Linkage; }
 
+  /// isWeakForLinker - Determines if symbol is weak for linker having weak or
+  /// linkonce or common or extweak LLVM linkage.
+  bool isWeakForLinker() const {
+    return (Linkage == WeakLinkage ||
+            Linkage == LinkOnceLinkage ||
+            Linkage == CommonLinkage ||
+            Linkage == ExternalWeakLinkage);
+  }
+
+  /// copyAttributesFrom - copy all additional attributes (those not needed to
+  /// create a GlobalValue) from the GlobalValue Src to this one.
+  virtual void copyAttributesFrom(const GlobalValue *Src);
+
   /// hasNotBeenReadFromBitcode - If a module provider is being used to lazily
   /// stream in functions from disk, this method can be used to check to see if
   /// the function has been read in yet or not.  Unless you are working on the