X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FGlobalValue.h;h=8fb5580d0d71099602df1cebcacdc30ad0a53077;hb=236aa8a5032282d8793b537c0f3f7ffb381a83d4;hp=b13a122e1a396d0f61e94e95755fcbdd735bda88;hpb=13d57320bd212483463d4f8992d5787b29eda5df;p=oota-llvm.git diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index b13a122e1a3..8fb5580d0d7 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -35,6 +35,7 @@ public: WeakLinkage, ///< Keep one copy of named function when linking (weak) AppendingLinkage, ///< Special purpose, only applies to global arrays InternalLinkage, ///< Rename collisions when linking (static functions) + PrivateLinkage, ///< Like Internal, but omit from symbol table DLLImportLinkage, ///< Function to be imported from DLL DLLExportLinkage, ///< Function to be accessible from DLL ExternalWeakLinkage,///< ExternalWeak linkage description @@ -104,12 +105,31 @@ public: bool hasCommonLinkage() const { return Linkage == CommonLinkage; } bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; } bool hasInternalLinkage() const { return Linkage == InternalLinkage; } + bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; } + bool hasLocalLinkage() const { + return Linkage == InternalLinkage || Linkage == PrivateLinkage; + } bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; } bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; } bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; } + bool hasGhostLinkage() const { return Linkage == GhostLinkage; } void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } + /// mayBeOverridden - Whether the definition of this global may be replaced + /// at link time. For example, if a function has weak linkage then the code + /// defining it may be replaced by different code. + bool mayBeOverridden() 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 @@ -128,6 +148,14 @@ public: /// value is outside of the current translation unit... virtual bool isDeclaration() const = 0; + /// removeFromParent - This method unlinks 'this' from the containing module, + /// but does not delete it. + virtual void removeFromParent() = 0; + + /// eraseFromParent - This method unlinks 'this' from the containing module + /// and deletes it. + virtual void eraseFromParent() = 0; + /// getParent - Get the module that this global value is contained inside /// of... inline Module *getParent() { return Parent; }