diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-22 00:05:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-22 00:05:44 +0000 |
commit | bdb23b3806e83737a67a023a729547caf03fc533 (patch) | |
tree | 9eaf5648fd1b7eb369792e52af192cbf59dbdb0e /include | |
parent | 67fa48e612ec949ec3504e7903a4d09360d27a3d (diff) | |
download | external_llvm-bdb23b3806e83737a67a023a729547caf03fc533.zip external_llvm-bdb23b3806e83737a67a023a729547caf03fc533.tar.gz external_llvm-bdb23b3806e83737a67a023a729547caf03fc533.tar.bz2 |
reimplement Constant::ContainsRelocations as
Constant::getRelocationInfo(), which has a much simpler
to use API. It still should not be part of libvmcore, but
is better than it was. Also teach it to be smart about
hidden visibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Constant.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index 62b75a7..4314b2c 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -20,20 +20,6 @@ namespace llvm { template<typename T> class SmallVectorImpl; class LLVMContext; - /// If object contains references to other objects, then relocations are - /// usually required for emission of such object (especially in PIC mode). One - /// usually distinguishes local and global relocations. Local relocations are - /// made wrt objects in the same module and these objects have local (internal - /// or private) linkage. Global relocations are made wrt externally visible - /// objects. In most cases local relocations can be resolved via so-called - /// 'pre-link' technique. - namespace Reloc { - const unsigned None = 0; - const unsigned Local = 1 << 0; ///< Local relocations are required - const unsigned Global = 1 << 1; ///< Global relocations are required - const unsigned LocalOrGlobal = Local | Global; - } - /// This is an important base class in LLVM. It provides the common facilities /// of all constant values in an LLVM program. A constant is a value that is /// immutable at runtime. Functions are constants because their address is @@ -73,12 +59,21 @@ public: /// true for things like constant expressions that could divide by zero. bool canTrap() const; - /// ContainsRelocations - Return true if the constant value contains - /// relocations which cannot be resolved at compile time. Note that answer is - /// not exclusive: there can be possibility that relocations of other kind are - /// required as well. - bool ContainsRelocations(unsigned Kind = Reloc::LocalOrGlobal) const; - + /// getRelocationInfo - This method classifies the entry according to + /// whether or not it may generate a relocation entry. This must be + /// conservative, so if it might codegen to a relocatable entry, it should say + /// so. The return values are: + /// + /// 0: This constant pool entry is guaranteed to never have a relocation + /// applied to it (because it holds a simple constant like '4'). + /// 1: This entry has relocations, but the entries are guaranteed to be + /// resolvable by the static linker, so the dynamic linker will never see + /// them. + /// 2: This entry may have arbitrary relocations. + /// + /// FIXME: This really should not be in VMCore. + unsigned getRelocationInfo() const; + // Specialize get/setOperand for Constants as their operands are always // constants as well. Constant *getOperand(unsigned i) { |