diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-25 18:57:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-25 18:57:34 +0000 |
commit | 4c530ee667b91ee9ffbe1d5614efa48c5bde903d (patch) | |
tree | 2cbe45d11c952139b20b5a7b347c3fc5b35f7f7b /include/llvm/Target | |
parent | 4bf1d2735962ec4ab2a71cdc5ff836118f6a9639 (diff) | |
download | external_llvm-4c530ee667b91ee9ffbe1d5614efa48c5bde903d.zip external_llvm-4c530ee667b91ee9ffbe1d5614efa48c5bde903d.tar.gz external_llvm-4c530ee667b91ee9ffbe1d5614efa48c5bde903d.tar.bz2 |
this is (unfortunately) several changes mixed together:
1. Spell SectionFlags::Writeable as "Writable".
2. Add predicates for deriving SectionFlags from SectionKinds.
3. Sink ELF-specific getSectionPrefixForUniqueGlobal impl into
ELFTargetAsmInfo.
4. Fix SectionFlagsForGlobal to know that BSS/ThreadBSS has the
BSS bit set (the real fix for PR4619).
5. Fix isSuitableForBSS to not put globals with explicit sections
set in BSS (which was the reason #4 wasn't fixed earlier).
6. Remove my previous hack for PR4619.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target')
-rw-r--r-- | include/llvm/Target/DarwinTargetAsmInfo.h | 6 | ||||
-rw-r--r-- | include/llvm/Target/ELFTargetAsmInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Target/TargetAsmInfo.h | 28 |
3 files changed, 28 insertions, 8 deletions
diff --git a/include/llvm/Target/DarwinTargetAsmInfo.h b/include/llvm/Target/DarwinTargetAsmInfo.h index e1662dd..10faacc 100644 --- a/include/llvm/Target/DarwinTargetAsmInfo.h +++ b/include/llvm/Target/DarwinTargetAsmInfo.h @@ -43,12 +43,6 @@ namespace llvm { virtual const Section * getSectionForMergableConstant(uint64_t Size, unsigned ReloInfo) const; - virtual const char * - getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const { - // Darwin doesn't use uniqued sections for weak symbols. - return 0; - } - private: const Section* MergeableStringSection(const GlobalVariable *GV) const; }; diff --git a/include/llvm/Target/ELFTargetAsmInfo.h b/include/llvm/Target/ELFTargetAsmInfo.h index 54220e7..5bd9938 100644 --- a/include/llvm/Target/ELFTargetAsmInfo.h +++ b/include/llvm/Target/ELFTargetAsmInfo.h @@ -37,6 +37,8 @@ namespace llvm { /// ".tbss" gets the TLS bit set etc. virtual unsigned getFlagsForNamedSection(const char *Section) const; + const char *getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const; + virtual const Section* SelectSectionForGlobal(const GlobalValue *GV, SectionKind::Kind Kind) const; virtual std::string printSectionFlags(unsigned flags) const; diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index 24d54cc..b8851a6 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -62,13 +62,35 @@ namespace llvm { K == SectionKind::RODataMergeConst || K == SectionKind::RODataMergeStr); } + + static inline bool isBSS(Kind K) { + return K == BSS || K == ThreadBSS; + } + + static inline bool isTLS(Kind K) { + return K == ThreadData || K == ThreadBSS; + } + + static inline bool isCode(Kind K) { + return K == Text; + } + + static inline bool isWritable(Kind K) { + return isTLS(K) || + K == SectionKind::Data || + K == SectionKind::DataRel || + K == SectionKind::DataRelLocal || + K == SectionKind::DataRelRO || + K == SectionKind::DataRelROLocal || + K == SectionKind::BSS; + } } namespace SectionFlags { const unsigned Invalid = -1U; const unsigned None = 0; const unsigned Code = 1 << 0; ///< Section contains code - const unsigned Writeable = 1 << 1; ///< Section is writeable + const unsigned Writable = 1 << 1; ///< Section is writable const unsigned BSS = 1 << 2; ///< Section contains only zeroes const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data const unsigned Strings = 1 << 4; ///< Section contains C-type strings @@ -582,7 +604,9 @@ namespace llvm { /// global. This is important for globals that need to be merged across /// translation units. virtual const char * - getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const; + getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const { + return 0; + } /// getFlagsForNamedSection - If this target wants to be able to infer /// section flags based on the name of the section specified for a global |