aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-08 21:26:26 +0000
committerChris Lattner <sabre@nondot.org>2010-04-08 21:26:26 +0000
commit74aae4726a66733c5872588287535a984f9a94c7 (patch)
tree881707df3911fb308e40f805a973d89773ec36d3 /include
parent2d16a67b9466102ae479f0027cedc1a20dd493d1 (diff)
move elf section uniquing to MCContext. Along the way
merge XCore's section into MCSectionELF git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/TargetLoweringObjectFileImpl.h5
-rw-r--r--include/llvm/MC/MCAsmInfo.h2
-rw-r--r--include/llvm/MC/MCContext.h6
-rw-r--r--include/llvm/MC/MCSectionELF.h43
-rw-r--r--include/llvm/MC/MCSectionMachO.h24
5 files changed, 26 insertions, 54 deletions
diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 3fec42430f..a9cbe3963c 100644
--- a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -33,7 +33,6 @@ namespace llvm {
class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
- mutable void *UniquingMap;
protected:
/// TLSDataSection - Section directive for Thread Local data.
///
@@ -58,8 +57,8 @@ protected:
unsigned Flags, SectionKind Kind,
bool IsExplicit = false) const;
public:
- TargetLoweringObjectFileELF() : UniquingMap(0) {}
- ~TargetLoweringObjectFileELF();
+ TargetLoweringObjectFileELF() {}
+ ~TargetLoweringObjectFileELF() {}
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 33def86189..6c141a1a86 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -280,7 +280,7 @@ namespace llvm {
/// getNonexecutableStackSection - Targets can implement this method to
/// specify a section to switch to if the translation unit doesn't have any
/// trampolines that require an executable stack.
- virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
+ virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
return 0;
}
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index f1f05949f8..b6798ecff5 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -50,7 +50,7 @@ namespace llvm {
/// objects.
BumpPtrAllocator Allocator;
- void *MachOUniquingMap;
+ void *MachOUniquingMap, *ELFUniquingMap;
public:
explicit MCContext(const MCAsmInfo &MAI);
~MCContext();
@@ -94,6 +94,10 @@ namespace llvm {
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
}
+ const MCSection *getELFSection(StringRef Section, unsigned Type,
+ unsigned Flags, SectionKind Kind,
+ bool IsExplicit);
+
/// @}
void *Allocate(unsigned Size, unsigned Align = 8) {
diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h
index e550cd2c11..7054668eb1 100644
--- a/include/llvm/MC/MCSectionELF.h
+++ b/include/llvm/MC/MCSectionELF.h
@@ -36,16 +36,14 @@ class MCSectionELF : public MCSection {
/// explicit section specified.
bool IsExplicit;
-protected:
+private:
+ friend class MCContext;
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
: MCSection(K), SectionName(Section), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
+ ~MCSectionELF();
public:
-
- static MCSectionELF *Create(StringRef Section, unsigned Type,
- unsigned Flags, SectionKind K, bool isExplicit,
- MCContext &Ctx);
/// ShouldOmitSectionDirective - Decides whether a '.section' directive
/// should be printed before the section name
@@ -153,40 +151,33 @@ public:
// This section holds Thread-Local Storage.
SHF_TLS = 0x400U,
+
+
+ // Start of target-specific flags.
+
+ /// XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
+ /// together by the linker to form the constant pool and the cp register is
+ /// set to the start of the constant pool by the boot code.
+ XCORE_SHF_CP_SECTION = 0x800U,
- /// FIRST_TARGET_DEP_FLAG - This is the first flag that subclasses are
- /// allowed to specify.
- FIRST_TARGET_DEP_FLAG = 0x800U,
-
- /// TARGET_INDEP_SHF - This is the bitmask for all the target independent
- /// section flags. Targets can define their own target flags above these.
- /// If they do that, they should implement their own MCSectionELF subclasses
- /// and implement the virtual method hooks below to handle printing needs.
- TARGET_INDEP_SHF = FIRST_TARGET_DEP_FLAG-1U
+ /// XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
+ /// together by the linker to form the data section and the dp register is
+ /// set to the start of the section by the boot code.
+ XCORE_SHF_DP_SECTION = 0x1000U
};
StringRef getSectionName() const { return SectionName; }
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
- virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
- raw_ostream &OS) const;
+ void PrintSwitchToSection(const MCAsmInfo &MAI,
+ raw_ostream &OS) const;
/// isBaseAddressKnownZero - We know that non-allocatable sections (like
/// debug info) have a base of zero.
virtual bool isBaseAddressKnownZero() const {
return (getFlags() & SHF_ALLOC) == 0;
}
-
- /// PrintTargetSpecificSectionFlags - Targets that define their own
- /// MCSectionELF subclasses with target specific section flags should
- /// implement this method if they end up adding letters to the attributes
- /// list.
- virtual void PrintTargetSpecificSectionFlags(const MCAsmInfo &MAI,
- raw_ostream &OS) const {
- }
-
-
};
} // end namespace llvm
diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h
index 465013c880..f3bc8edd84 100644
--- a/include/llvm/MC/MCSectionMachO.h
+++ b/include/llvm/MC/MCSectionMachO.h
@@ -34,29 +34,7 @@ class MCSectionMachO : public MCSection {
unsigned Reserved2;
MCSectionMachO(StringRef Segment, StringRef Section,
- unsigned TAA, unsigned reserved2, SectionKind K)
- : MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
- assert(Segment.size() <= 16 && Section.size() <= 16 &&
- "Segment or section string too long");
- for (unsigned i = 0; i != 16; ++i) {
- if (i < Segment.size())
- SegmentName[i] = Segment[i];
- else
- SegmentName[i] = 0;
-
- if (i < Section.size())
- SectionName[i] = Section[i];
- else
- SectionName[i] = 0;
- }
- }
-
- static MCSectionMachO *Create(StringRef Segment,
- StringRef Section,
- unsigned TypeAndAttributes,
- unsigned Reserved2,
- SectionKind K, MCContext &Ctx);
-
+ unsigned TAA, unsigned reserved2, SectionKind K);
friend class MCContext;
public: