X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FGlobalValue.h;h=81a11a4c9258c7e832ebe31e7431d5f0e12a43d4;hb=db0bbdea472d547b3183d8b365752b3002517407;hp=68cb8e2604cb0462bc256276e4368bc06db74a63;hpb=8e4f4390bc3e6ed0ec72281c67950f54474f915d;p=oota-llvm.git diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 68cb8e2604c..81a11a4c925 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -57,19 +57,20 @@ public: }; protected: - GlobalValue(const Type *ty, ValueTy vty, Use *Ops, unsigned NumOps, + GlobalValue(Type *ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const Twine &Name) - : Constant(ty, vty, Ops, NumOps), Parent(0), - Linkage(linkage), Visibility(DefaultVisibility), Alignment(0) { + : Constant(ty, vty, Ops, NumOps), Linkage(linkage), + Visibility(DefaultVisibility), Alignment(0), UnnamedAddr(0), Parent(0) { setName(Name); } - Module *Parent; // Note: VC++ treats enums as signed, so an extra bit is required to prevent // Linkage and Visibility from turning into negative values. LinkageTypes Linkage : 5; // The linkage of this global unsigned Visibility : 2; // The visibility style of this global unsigned Alignment : 16; // Alignment of this symbol, must be power of two + unsigned UnnamedAddr : 1; // This value's address is not significant + Module *Parent; // The containing module. std::string Section; // Section to emit this into, empty mean default public: ~GlobalValue() { @@ -81,6 +82,9 @@ public: } void setAlignment(unsigned Align); + bool hasUnnamedAddr() const { return UnnamedAddr; } + void setUnnamedAddr(bool Val) { UnnamedAddr = Val; } + VisibilityTypes getVisibility() const { return VisibilityTypes(Visibility); } bool hasDefaultVisibility() const { return Visibility == DefaultVisibility; } bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; } @@ -101,8 +105,8 @@ public: bool use_empty_except_constants(); /// getType - Global values are always pointers. - inline const PointerType *getType() const { - return reinterpret_cast(User::getType()); + inline PointerType *getType() const { + return reinterpret_cast(User::getType()); } static LinkageTypes getLinkOnceLinkage(bool ODR) { @@ -253,16 +257,12 @@ public: /// @} - /// Override from Constant class. No GlobalValue's are null values so this - /// always returns false. - virtual bool isNullValue() const { return false; } - /// Override from Constant class. virtual void destroyConstant(); /// isDeclaration - Return true if the primary definition of this global - /// value is outside of the current translation unit... - virtual bool isDeclaration() const = 0; + /// value is outside of the current translation unit. + bool isDeclaration() const; /// removeFromParent - This method unlinks 'this' from the containing module, /// but does not delete it. @@ -277,12 +277,6 @@ public: inline Module *getParent() { return Parent; } inline const Module *getParent() const { return Parent; } - /// removeDeadConstantUsers - If there are any dead constant users dangling - /// off of this global value, remove them. This method is useful for clients - /// that want to check to see if a global is unused, but don't want to deal - /// with potentially dead constants hanging off of the globals. - void removeDeadConstantUsers() const; - // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalValue *) { return true; } static inline bool classof(const Value *V) {