[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.41 -> 1.42 --- Log message: Fix comment --- Diffs of the changes: (+4 -3) GlobalValue.h |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.41 llvm/include/llvm/GlobalValue.h:1.42 --- llvm/include/llvm/GlobalValue.h:1.41Sun Apr 29 13:35:00 2007 +++ llvm/include/llvm/GlobalValue.h Mon Apr 30 14:14:56 2007 @@ -8,9 +8,10 @@ //===--===// // // This file is a common base class of all globally definable objects. As such, -// it is subclassed by GlobalVariable and by Function. This is used because you -// can do certain things with these global objects that you can't do to anything -// else. For example, use the address of one as a constant. +// it is subclassed by GlobalVariable, GlobalAlias and by Function. This is +// used because you can do certain things with these global objects that you +// can't do to anything else. For example, use the address of one as a +// constant. // //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.40 -> 1.41 --- Log message: Implement protected visibility. This partly implements PR1363: http://llvm.org/PR1363 . Linker should be taught to deal with protected symbols. --- Diffs of the changes: (+6 -2) GlobalValue.h |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.40 llvm/include/llvm/GlobalValue.h:1.41 --- llvm/include/llvm/GlobalValue.h:1.40Sat Apr 28 08:44:59 2007 +++ llvm/include/llvm/GlobalValue.h Sun Apr 29 13:35:00 2007 @@ -43,7 +43,8 @@ /// @brief An enumeration for the kinds of visibility of global values. enum VisibilityTypes { DefaultVisibility = 0, ///< The GV is visible -HiddenVisibility///< The GV is hidden +HiddenVisibility, ///< The GV is hidden +ProtectedVisibility ///< The GV is protected }; protected: @@ -58,7 +59,7 @@ // 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 : 1;// The visibility style of this global + unsigned Visibility : 2;// The visibility style of this global unsigned Alignment : 16;// Alignment of this symbol, must be power of two std::string Section;// Section to emit this into, empty mean default public: @@ -74,6 +75,9 @@ VisibilityTypes getVisibility() const { return (VisibilityTypes)Visibility; } bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; } + bool hasProtectedVisibility() const { +return Visibility == ProtectedVisibility; + } void setVisibility(VisibilityTypes V) { Visibility = V; } bool hasSection() const { return !Section.empty(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.37 -> 1.38 --- Log message: Implement review feedback. --- Diffs of the changes: (+2 -2) GlobalValue.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.37 llvm/include/llvm/GlobalValue.h:1.38 --- llvm/include/llvm/GlobalValue.h:1.37Sat Apr 21 10:29:13 2007 +++ llvm/include/llvm/GlobalValue.h Sun Apr 22 10:11:24 2007 @@ -58,7 +58,7 @@ // 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 - VisibilityTypes Visibility : 2; // The visibility style of this global + unsigned Visibility : 1;// The visibility style of this global unsigned Alignment : 16;// Alignment of this symbol, must be power of two std::string Section;// Section to emit this into, empty mean default public: @@ -72,7 +72,7 @@ Alignment = Align; } - VisibilityTypes getVisibility() const { return Visibility; } + VisibilityTypes getVisibility() const { return (VisibilityTypes)Visibility; } bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; } void setVisibility(VisibilityTypes V) { Visibility = V; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
> Index: llvm/include/llvm/GlobalValue.h > diff -u llvm/include/llvm/GlobalValue.h:1.36 llvm/include/llvm/ > GlobalValue.h:1.37 > --- llvm/include/llvm/GlobalValue.h:1.36 Mon Apr 16 23:31:29 2007 > +++ llvm/include/llvm/GlobalValue.h Sat Apr 21 10:29:13 2007 > @@ -55,8 +55,10 @@ >} > >Module *Parent; > - LinkageTypes Linkage : 4; // The linkage of this global > - VisibilityTypes Visibility : 1; // The visibility style of this > global > + // 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 > + VisibilityTypes Visibility : 2; // The visibility style of this > global >unsigned Alignment : 16;// Alignment of this symbol, must be > power of two >std::string Section;// Section to emit this into, empty > mean default > public: Please change the enum type to "unsigned Visibility : 1", and add a cast to the getVisibility() accessor. Thanks, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.36 -> 1.37 --- Log message: Fix breakage of bytecode reader when built with VC++. --- Diffs of the changes: (+4 -2) GlobalValue.h |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.36 llvm/include/llvm/GlobalValue.h:1.37 --- llvm/include/llvm/GlobalValue.h:1.36Mon Apr 16 23:31:29 2007 +++ llvm/include/llvm/GlobalValue.h Sat Apr 21 10:29:13 2007 @@ -55,8 +55,10 @@ } Module *Parent; - LinkageTypes Linkage : 4; // The linkage of this global - VisibilityTypes Visibility : 1; // The visibility style of this global + // 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 + VisibilityTypes Visibility : 2; // The visibility style of this global unsigned Alignment : 16;// Alignment of this symbol, must be power of two std::string Section;// Section to emit this into, empty mean default public: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.33 -> 1.34 --- Log message: Rework GlobalValue::removeDeadConstantUsers to always remove dead constant exprs hanging off a global, even if the global is not otherwise dead. This requires some tricky iterator gymnastics. This implements Transforms/GlobalOpt/constantexpr-dangle.ll by deleting a constantexpr that made it appear that the address of the function was taken. --- Diffs of the changes: (+0 -4) GlobalValue.h |4 1 files changed, 4 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.33 llvm/include/llvm/GlobalValue.h:1.34 --- llvm/include/llvm/GlobalValue.h:1.33Sun Feb 11 23:18:08 2007 +++ llvm/include/llvm/GlobalValue.h Sun Feb 25 15:06:13 2007 @@ -128,10 +128,6 @@ /// 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. - /// - /// This method tries to make the global dead. If it detects a user that - /// would prevent it from becoming completely dead, it gives up early, - /// potentially leaving some dead constant users around. void removeDeadConstantUsers(); // Methods for support type inquiry through isa, cast, and dyn_cast: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.30 -> 1.31 --- Log message: Add some comments, fix an 80 cols violation. --- Diffs of the changes: (+16 -12) GlobalValue.h | 28 1 files changed, 16 insertions(+), 12 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.30 llvm/include/llvm/GlobalValue.h:1.31 --- llvm/include/llvm/GlobalValue.h:1.30Fri Jan 12 13:20:46 2007 +++ llvm/include/llvm/GlobalValue.h Fri Jan 26 22:42:50 2007 @@ -27,21 +27,25 @@ class GlobalValue : public Constant { GlobalValue(const GlobalValue &); // do not implement public: + /// @brief An enumeration for the kinds of linkage for global values. enum LinkageTypes { -ExternalLinkage, /// Externally visible function -LinkOnceLinkage, /// Keep one copy of function when linking (inline) -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) -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 +ExternalLinkage,///< Externally visible function +LinkOnceLinkage,///< Keep one copy of function when linking (inline) +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) +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 }; + + /// @brief An enumeration for the kinds of visibility of global values. enum VisibilityTypes { -DefaultVisibility, -HiddenVisibility +DefaultVisibility, ///< The GV is visible +HiddenVisibility///< The GV is hidden }; + protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") @@ -91,7 +95,7 @@ bool hasInternalLinkage() const { return Linkage == InternalLinkage; } bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; } bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; } - bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; } + bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; } void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.29 -> 1.30 --- Log message: * PIC codegen for X86/Linux has been implemented * PIC-aware internal structures in X86 Codegen have been refactored * Visibility (default/weak) has been added * Docs fixes (external weak linkage, visibility, formatting) --- Diffs of the changes: (+11 -2) GlobalValue.h | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.29 llvm/include/llvm/GlobalValue.h:1.30 --- llvm/include/llvm/GlobalValue.h:1.29Wed Dec 6 14:28:46 2006 +++ llvm/include/llvm/GlobalValue.h Fri Jan 12 13:20:46 2007 @@ -38,14 +38,19 @@ ExternalWeakLinkage, /// ExternalWeak linkage description GhostLinkage /// Stand-in functions for streaming fns from BC files }; + enum VisibilityTypes { +DefaultVisibility, +HiddenVisibility + }; protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") -: Constant(Ty, vty, Ops, NumOps, name), - Parent(0), Linkage(linkage), Alignment(0) { } +: Constant(Ty, vty, Ops, NumOps, name), Parent(0), + Linkage(linkage), Visibility(DefaultVisibility), Alignment(0) { } Module *Parent; LinkageTypes Linkage; // The linkage of this global + VisibilityTypes Visibility; // The visibility style of this global unsigned Alignment; // Alignment of this symbol, must be power of two std::string Section;// Section to emit this into, empty mean default public: @@ -58,6 +63,10 @@ assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); Alignment = Align; } + + VisibilityTypes getVisibility() const { return Visibility; } + bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; } + void setVisibility(VisibilityTypes V) { Visibility = V; } bool hasSection() const { return !Section.empty(); } const std::string &getSection() const { return Section; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.28 -> 1.29 --- Log message: Fix some 80 col violations. --- Diffs of the changes: (+2 -2) GlobalValue.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.28 llvm/include/llvm/GlobalValue.h:1.29 --- llvm/include/llvm/GlobalValue.h:1.28Thu Sep 14 13:23:26 2006 +++ llvm/include/llvm/GlobalValue.h Wed Dec 6 14:28:46 2006 @@ -29,13 +29,13 @@ public: enum LinkageTypes { ExternalLinkage, /// Externally visible function -LinkOnceLinkage, /// Keep one copy of named function when linking (inline) +LinkOnceLinkage, /// Keep one copy of function when linking (inline) 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) DLLImportLinkage,/// Function to be imported from DLL DLLExportLinkage,/// Function to be accessible from DLL -ExternalWeakLinkage, /// TBD: ExternalWeak linkage description +ExternalWeakLinkage, /// ExternalWeak linkage description GhostLinkage /// Stand-in functions for streaming fns from BC files }; protected: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.27 -> 1.28 --- Log message: Adding dllimport, dllexport and external weak linkage types. DLL* linkages got full (I hope) codegeneration support in C & both x86 assembler backends. External weak linkage added for future use, we don't provide any codegeneration, etc. support for it. --- Diffs of the changes: (+17 -11) GlobalValue.h | 28 +--- 1 files changed, 17 insertions(+), 11 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.27 llvm/include/llvm/GlobalValue.h:1.28 --- llvm/include/llvm/GlobalValue.h:1.27Fri Nov 11 18:09:49 2005 +++ llvm/include/llvm/GlobalValue.h Thu Sep 14 13:23:26 2006 @@ -28,12 +28,15 @@ GlobalValue(const GlobalValue &); // do not implement public: enum LinkageTypes { -ExternalLinkage, /// Externally visible function -LinkOnceLinkage, /// Keep one copy of named function when linking (inline) -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) -GhostLinkage /// Stand-in functions for streaming fns from BC files +ExternalLinkage, /// Externally visible function +LinkOnceLinkage, /// Keep one copy of named function when linking (inline) +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) +DLLImportLinkage,/// Function to be imported from DLL +DLLExportLinkage,/// Function to be accessible from DLL +ExternalWeakLinkage, /// TBD: ExternalWeak linkage description +GhostLinkage /// Stand-in functions for streaming fns from BC files }; protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, @@ -72,11 +75,14 @@ return reinterpret_cast(User::getType()); } - bool hasExternalLinkage() const { return Linkage == ExternalLinkage; } - bool hasLinkOnceLinkage() const { return Linkage == LinkOnceLinkage; } - bool hasWeakLinkage() const { return Linkage == WeakLinkage; } - bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; } - bool hasInternalLinkage() const { return Linkage == InternalLinkage; } + bool hasExternalLinkage() const { return Linkage == ExternalLinkage; } + bool hasLinkOnceLinkage() const { return Linkage == LinkOnceLinkage; } + bool hasWeakLinkage() const { return Linkage == WeakLinkage; } + bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; } + bool hasInternalLinkage() const { return Linkage == InternalLinkage; } + bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; } + bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; } + bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; } void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.26 -> 1.27 --- Log message: Add support for putting globals in a particular section --- Diffs of the changes: (+9 -4) GlobalValue.h | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.26 llvm/include/llvm/GlobalValue.h:1.27 --- llvm/include/llvm/GlobalValue.h:1.26Sun Nov 6 02:22:18 2005 +++ llvm/include/llvm/GlobalValue.h Fri Nov 11 18:09:49 2005 @@ -38,12 +38,13 @@ protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") -: Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), - Parent(0), Alignment(0) { } +: Constant(Ty, vty, Ops, NumOps, name), + Parent(0), Linkage(linkage), Alignment(0) { } - LinkageTypes Linkage; // The linkage of this global Module *Parent; - unsigned Alignment; + LinkageTypes Linkage; // The linkage of this global + unsigned Alignment; // Alignment of this symbol, must be power of two + std::string Section;// Section to emit this into, empty mean default public: ~GlobalValue() { removeDeadConstantUsers(); // remove any dead constants using this. @@ -55,6 +56,10 @@ Alignment = Align; } + bool hasSection() const { return !Section.empty(); } + const std::string &getSection() const { return Section; } + void setSection(const std::string &S) { Section = S; } + /// If the usage is empty (except transitively dead constants), then this /// global value can can be safely deleted since the destructor will /// delete the dead constants as well. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.25 -> 1.26 --- Log message: Make sure to initialize the alignment field --- Diffs of the changes: (+2 -1) GlobalValue.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.25 llvm/include/llvm/GlobalValue.h:1.26 --- llvm/include/llvm/GlobalValue.h:1.25Sun Nov 6 00:44:42 2005 +++ llvm/include/llvm/GlobalValue.h Sun Nov 6 02:22:18 2005 @@ -38,7 +38,8 @@ protected: GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const std::string &name = "") -: Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), Parent(0) { } +: Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), + Parent(0), Alignment(0) { } LinkageTypes Linkage; // The linkage of this global Module *Parent; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h
Changes in directory llvm/include/llvm: GlobalValue.h updated: 1.24 -> 1.25 --- Log message: allow functions and modules to have an explicit alignment --- Diffs of the changes: (+7 -0) GlobalValue.h |7 +++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.24 llvm/include/llvm/GlobalValue.h:1.25 --- llvm/include/llvm/GlobalValue.h:1.24Tue Oct 25 12:59:28 2005 +++ llvm/include/llvm/GlobalValue.h Sun Nov 6 00:44:42 2005 @@ -42,11 +42,18 @@ LinkageTypes Linkage; // The linkage of this global Module *Parent; + unsigned Alignment; public: ~GlobalValue() { removeDeadConstantUsers(); // remove any dead constants using this. } + unsigned getAlignment() const { return Alignment; } + void setAlignment(unsigned Align) { +assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); +Alignment = Align; + } + /// If the usage is empty (except transitively dead constants), then this /// global value can can be safely deleted since the destructor will /// delete the dead constants as well. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits