diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-08 20:30:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-08 20:30:37 +0000 |
commit | f0559e4b242e85d4b9d1dd08758814c599bdce13 (patch) | |
tree | 34a32e10829a20b60ac0167daabec94e2bb351d5 /include/llvm/MC | |
parent | a57fabe815ccf016eead526eb3ef475f116ab155 (diff) | |
download | external_llvm-f0559e4b242e85d4b9d1dd08758814c599bdce13.tar.gz external_llvm-f0559e4b242e85d4b9d1dd08758814c599bdce13.tar.bz2 external_llvm-f0559e4b242e85d4b9d1dd08758814c599bdce13.zip |
move macho section uniquing from MCParser and TLOF to MCContext where
the compiler and asmparser now unique to the same sections. This fixes
rdar://7835021.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC')
-rw-r--r-- | include/llvm/MC/MCContext.h | 15 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/AsmParser.h | 11 | ||||
-rw-r--r-- | include/llvm/MC/MCSectionMachO.h | 4 |
3 files changed, 18 insertions, 12 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 968d55f214..a600f96464 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -10,6 +10,7 @@ #ifndef LLVM_MC_MCCONTEXT_H #define LLVM_MC_MCCONTEXT_H +#include "llvm/MC/SectionKind.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Allocator.h" @@ -21,6 +22,7 @@ namespace llvm { class MCSymbol; class StringRef; class Twine; + class MCSectionMachO; /// MCContext - Context object for machine code objects. This class owns all /// of the sections that it creates. @@ -47,6 +49,8 @@ namespace llvm { /// We use a bump pointer allocator to avoid the need to track all allocated /// objects. BumpPtrAllocator Allocator; + + void *MachOUniquingMap; public: explicit MCContext(const MCAsmInfo &MAI); ~MCContext(); @@ -72,6 +76,17 @@ namespace llvm { MCSymbol *LookupSymbol(StringRef Name) const; /// @} + + /// @name Section Managment + /// @{ + + const MCSectionMachO *getMachOSection(StringRef Segment, + StringRef Section, + unsigned TypeAndAttributes, + unsigned Reserved2, + SectionKind K); + + /// @} void *Allocate(unsigned Size, unsigned Align = 8) { return Allocator.Allocate(Size, Align); diff --git a/include/llvm/MC/MCParser/AsmParser.h b/include/llvm/MC/MCParser/AsmParser.h index 23f4a1fb72..82e046e819 100644 --- a/include/llvm/MC/MCParser/AsmParser.h +++ b/include/llvm/MC/MCParser/AsmParser.h @@ -50,10 +50,6 @@ private: AsmCond TheCondState; std::vector<AsmCond> TheCondStack; - // FIXME: Figure out where this should leave, the code is a copy of that which - // is also used by TargetLoweringObjectFile. - mutable void *SectionUniquingMap; - /// DirectiveMap - This is a table handlers for directives. Each handler is /// invoked after the directive identifier is read and is responsible for /// parsing and validating the rest of the directive. The handler is passed @@ -97,13 +93,6 @@ public: private: MCSymbol *CreateSymbol(StringRef Name); - // FIXME: See comment on SectionUniquingMap. - const MCSection *getMachOSection(const StringRef &Segment, - const StringRef &Section, - unsigned TypeAndAttributes, - unsigned Reserved2, - SectionKind Kind) const; - bool ParseStatement(); bool TokError(const char *Msg); diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h index 5839c281ed..465013c880 100644 --- a/include/llvm/MC/MCSectionMachO.h +++ b/include/llvm/MC/MCSectionMachO.h @@ -50,7 +50,6 @@ class MCSectionMachO : public MCSection { SectionName[i] = 0; } } -public: static MCSectionMachO *Create(StringRef Segment, StringRef Section, @@ -58,6 +57,9 @@ public: unsigned Reserved2, SectionKind K, MCContext &Ctx); + friend class MCContext; +public: + /// These are the section type and attributes fields. A MachO section can /// have only one Type, but can have any of the attributes specified. enum { |