LLVM: lib/Target/XCore/XCoreTargetObjectFile.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
16
17using namespace llvm;
18
19
22
26 BSSSectionLarge = Ctx.getELFSection(".dp.bss.large", ELF::SHT_NOBITS,
32 DataSectionLarge = Ctx.getELFSection(".dp.data.large", ELF::SHT_PROGBITS,
38 DataRelROSectionLarge = Ctx.getELFSection(
44 ReadOnlySectionLarge =
60
61
62
63 }
64
70
72 unsigned Flags = 0;
73
74 if (!K.isMetadata())
76
77 if (K.isText())
79 else if (IsCPRel)
81 else
83
84 if (K.isWriteable())
86
87 if (K.isMergeableCString() || K.isMergeableConst4() ||
88 K.isMergeableConst8() || K.isMergeableConst16())
90
91 if (K.isMergeableCString())
93
94 return Flags;
95}
96
100
101 bool IsCPRel = SectionName.starts_with(".cp.");
102 if (IsCPRel && !Kind.isReadOnly())
106}
107
110
112
114 if (UseCPRel) {
115 if (Kind.isMergeable1ByteCString()) return CStringSection;
119 }
126 if (Kind.isBSS() || Kind.isCommon())return BSSSection;
127 if (Kind.isData())
130 } else {
131 if (Kind.isReadOnly()) return UseCPRel? ReadOnlySectionLarge
132 : DataRelROSectionLarge;
133 if (Kind.isBSS() || Kind.isCommon())return BSSSectionLarge;
134 if (Kind.isData())
135 return DataSectionLarge;
136 if (Kind.isReadOnlyWithRel()) return DataRelROSectionLarge;
137 }
138
139 assert((Kind.isThreadLocal() || Kind.isCommon()) && "Unknown section kind");
140 report_fatal_error("Target does not support TLS or Common sections");
141}
142
145 Align &Alignment) const {
149 assert((Kind.isReadOnly() || Kind.isReadOnlyWithRel()) &&
150 "Unknown section kind");
151
152
154}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static unsigned getXCoreSectionType(SectionKind K)
Definition XCoreTargetObjectFile.cpp:65
static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel)
Definition XCoreTargetObjectFile.cpp:71
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
StringRef getSection() const
Get the custom section of this global if it has one.
bool hasLocalLinkage() const
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
Type * getValueType() const
Context object for machine code objects.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
MCSection * MergeableConst16Section
MCSection * MergeableConst4Section
MCSection * TextSection
Section directive for standard text.
MCSection * MergeableConst8Section
MCSection * DataRelROSection
MCSection * CStringSection
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
MCSection * BSSSection
Section that is default initialized to zero.
MCContext & getContext() const
MCSection * DataSection
Section directive for standard data.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
SectionKind - This is a simple POD value that classifies the properties of a section.
StringRef - Represent a constant reference to a string, i.e.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Primary interface to the complete machine description for the target machine.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Definition XCoreTargetObjectFile.cpp:20
MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
Definition XCoreTargetObjectFile.cpp:97
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a constant with the SectionKind, return a section that it should be placed in.
Definition XCoreTargetObjectFile.cpp:143
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Definition XCoreTargetObjectFile.cpp:108
@ C
The default llvm calling convention, compatible with C.
@ XCORE_SHF_DP_SECTION
All sections with the "d" flag are grouped together by the linker to form the data section and the dp...
@ XCORE_SHF_CP_SECTION
All sections with the "c" flag are grouped together by the linker to form the constant pool and the c...
This is an optimization pass for GlobalISel generic memory operations.
static const unsigned CodeModelLargeSize
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
This struct is a compact representation of a valid (non-zero power of two) alignment.