63 using namespace dwarf;
70 for (
const auto &MFE: ModuleFlags) {
76 if (Key ==
"Objective-C Image Info Version") {
77 Version = mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
78 }
else if (Key ==
"Objective-C Garbage Collection" ||
79 Key ==
"Objective-C GC Only" ||
80 Key ==
"Objective-C Is Simulated" ||
81 Key ==
"Objective-C Class Properties" ||
82 Key ==
"Objective-C Image Swift Version") {
83 Flags |= mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
84 }
else if (Key ==
"Objective-C Image Info Section") {
85 Section = cast<MDString>(MFE.Val)->getString();
102 auto &
C = getContext();
110 for (
const auto &Operand : LinkerOptions->operands()) {
111 if (cast<MDNode>(Operand)->getNumOperands() != 2)
113 for (
const auto &Option : cast<MDNode>(Operand)->operands()) {
114 Streamer.
EmitBytes(cast<MDString>(Option)->getString());
125 if (!Section.
empty()) {
137 MDNode *CFGProfile =
nullptr;
139 for (
const auto &MFE : ModuleFlags) {
141 if (Key ==
"CG Profile") {
142 CFGProfile = cast<MDNode>(MFE.Val);
153 auto V = cast<ValueAsMetadata>(MDO);
154 const Function *
F = cast<Function>(V->getValue());
155 return TM->getSymbol(F);
158 for (
const auto &Edge : CFGProfile->
operands()) {
159 MDNode *
E = cast<MDNode>(Edge);
166 uint64_t Count = cast<ConstantAsMetadata>(E->
getOperand(2))
179 unsigned Encoding = getPersonalityEncoding();
181 return getContext().getOrCreateSymbol(
StringRef(
"DW.ref.") +
193 cast<MCSymbolELF>(getContext().getOrCreateSymbol(NameData));
216 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV,
".DW.stub", TM);
228 Encoding & ~DW_EH_PE_indirect, Streamer);
247 if (Name.
empty() || Name[0] !=
'.')
return K;
250 if (Name ==
".bss" ||
260 if (Name ==
".tdata" ||
266 if (Name ==
".tbss" ||
282 if (Name ==
".init_array")
285 if (Name ==
".fini_array")
288 if (Name ==
".preinit_array")
331 C->
getName() +
"' cannot be lowered.");
364 if (
Attrs.hasAttribute(
"bss-section") && Kind.
isBSS()) {
365 SectionName =
Attrs.getAttribute(
"bss-section").getValueAsString();
366 }
else if (
Attrs.hasAttribute(
"rodata-section") && Kind.
isReadOnly()) {
367 SectionName =
Attrs.getAttribute(
"rodata-section").getValueAsString();
368 }
else if (
Attrs.hasAttribute(
"data-section") && Kind.
isData()) {
369 SectionName =
Attrs.getAttribute(
"data-section").getValueAsString();
391 if (AssociatedSymbol) {
392 UniqueID = NextUniqueID++;
398 0, Group, UniqueID, AssociatedSymbol);
402 "Associated symbol mismatch between sections");
422 return ".data.rel.ro";
452 unsigned *NextUniqueID,
const MCSymbolELF *AssociatedSymbol) {
469 cast<GlobalVariable>(GO));
471 std::string SizeSpec =
".rodata.str" +
utostr(EntrySize) +
".";
472 Name = SizeSpec +
utostr(Align);
474 Name =
".rodata.cst";
475 Name +=
utostr(EntrySize);
480 if (
const auto *
F = dyn_cast<Function>(GO)) {
481 const auto &OptionalPrefix =
F->getSectionPrefix();
483 Name += *OptionalPrefix;
487 if (EmitUniqueSection) {
492 UniqueID = *NextUniqueID;
500 EntrySize, Group, UniqueID, AssociatedSymbol);
509 bool EmitUniqueSection =
false;
519 if (AssociatedSymbol) {
520 EmitUniqueSection =
true;
525 getContext(), GO, Kind, getMangler(), TM, EmitUniqueSection, Flags,
526 &NextUniqueID, AssociatedSymbol);
537 if (!EmitUniqueSection)
538 return ReadOnlySection;
541 getMangler(), TM, EmitUniqueSection,
547 bool UsesLabelDifference,
const Function &
F)
const {
557 unsigned &
Align)
const {
559 return MergeableConst4Section;
561 return MergeableConst8Section;
563 return MergeableConst16Section;
565 return MergeableConst32Section;
567 return ReadOnlySection;
570 return DataRelROSection;
574 bool IsCtor,
unsigned Priority,
587 Name =
".init_array";
590 Name =
".fini_array";
592 if (Priority != 65535) {
603 if (Priority != 65535)
612 unsigned Priority,
const MCSymbol *KeySym)
const {
618 unsigned Priority,
const MCSymbol *KeySym)
const {
645 UseInitArray = UseInitArray_;
693 for (
const auto &Option : LinkerOptions->operands()) {
695 for (
const auto &Piece : cast<MDNode>(Option)->operands())
696 StrOptions.
push_back(cast<MDString>(Piece)->getString());
701 unsigned VersionVal = 0;
702 unsigned ImageInfoFlags = 0;
708 if (SectionVal.
empty())
712 unsigned TAA = 0, StubSize = 0;
714 std::string ErrorCode =
716 TAA, TAAParsed, StubSize);
717 if (!ErrorCode.empty())
727 getOrCreateSymbol(
StringRef(
"L_OBJC_IMAGE_INFO")));
739 "' cannot be lowered.");
746 unsigned TAA = 0, StubSize = 0;
751 std::string ErrorCode =
753 TAA, TAAParsed, StubSize);
754 if (!ErrorCode.empty()) {
757 "' has an invalid section specifier '" +
773 if (S->getTypeAndAttributes() != TAA || S->getStubSize() != StubSize) {
776 "' section type or attributes does not match previous" 777 " section specifier");
807 cast<GlobalVariable>(GO)) < 32)
815 cast<GlobalVariable>(GO)) < 32)
855 unsigned &
Align)
const {
891 Encoding & ~DW_EH_PE_indirect, Streamer);
958 MCSymbol *Stub = Ctx.getOrCreateSymbol(Name);
963 StubValueTy(const_cast<MCSymbol *>(Sym),
true );
994 bool CannotUsePrivateLabel =
true;
998 CannotUsePrivateLabel =
1047 assert(C &&
"expected GV to have a Comdat!");
1053 "' does not exist.");
1057 "' is not a key for its COMDAT.");
1065 if (
const auto *GA = dyn_cast<GlobalAlias>(ComdatKey))
1067 if (ComdatKey == GV) {
1068 switch (
C->getSelectionKind()) {
1103 COMDATSymName = Sym->
getName();
1130 bool EmitUniquedSection;
1152 if (EmitUniquedSection)
1153 UniqueID = NextUniqueID++;
1165 COMDATSymName, Selection, UniqueID);
1170 Selection, UniqueID);
1195 bool CannotUsePrivateLabel =
false;
1199 CannotUsePrivateLabel =
true;
1210 if (!EmitUniqueSection)
1224 unsigned UniqueID = NextUniqueID++;
1227 SecName, Characteristics, Kind, COMDATSymName,
1239 for (
const auto &Option : LinkerOptions->operands()) {
1240 for (
const auto &Piece : cast<MDNode>(Option)->operands()) {
1242 std::string Directive(
" ");
1243 Directive.append(cast<MDString>(Piece)->getString());
1254 if (Section.
empty())
1258 auto *S =
C.getCOFFSection(
1301 std::string
Name = IsCtor ?
".ctors" :
".dtors";
1302 if (Priority != 65535)
1314 unsigned Priority,
const MCSymbol *KeySym)
const {
1321 unsigned Priority,
const MCSymbol *KeySym)
const {
1359 if (!isa<GlobalObject>(LHS) || !isa<GlobalVariable>(RHS) ||
1362 cast<GlobalVariable>(RHS)->hasInitializer() || RHS->
hasSection())
1373 unsigned Size = HexString.size();
1374 assert(Width >= Size &&
"hex string is too large!");
1375 HexString.insert(HexString.begin(), Width -
Size,
'0');
1382 if (isa<UndefValue>(C)) {
1384 }
else if (
const auto *CFP = dyn_cast<ConstantFP>(C)) {
1386 }
else if (
const auto *CI = dyn_cast<ConstantInt>(C)) {
1389 unsigned NumElements;
1390 if (isa<VectorType>(Ty))
1394 std::string HexString;
1395 for (
int I = NumElements - 1,
E = -1;
I !=
E; --
I)
1403 unsigned &
Align)
const {
1413 std::string COMDATSymName;
1437 if (!COMDATSymName.empty())
1458 "SelectionKind::Any, '" + C->
getName() +
"' cannot be " 1478 if (isa<Function>(GO)) {
1497 const TargetMachine &
TM,
bool EmitUniqueSection,
unsigned *NextUniqueID) {
1506 if (
const auto *
F = dyn_cast<Function>(GO)) {
1507 const auto &OptionalPrefix =
F->getSectionPrefix();
1509 Name += *OptionalPrefix;
1512 if (EmitUniqueSection && UniqueSectionNames) {
1517 if (EmitUniqueSection && !UniqueSectionNames) {
1518 UniqueID = *NextUniqueID;
1532 bool EmitUniqueSection =
false;
1540 EmitUniqueSection, &NextUniqueID);
1544 bool UsesLabelDifference,
const Function &
F)
const {
1576 unsigned Priority,
const MCSymbol *KeySym)
const {
1577 return Priority == UINT16_MAX ?
1584 unsigned Priority,
const MCSymbol *KeySym)
const {
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
const MCAsmInfo * getAsmInfo() const
AttributeSet getAttributes() const
Return the attribute set for this global.
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
StringRef getSection() const
Get the custom section of this global if it has one.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Tracking metadata reference owned by Metadata.
static SectionKind getData()
static MCSectionCOFF * getCOFFStaticStructorSection(MCContext &Ctx, const Triple &T, bool IsCtor, unsigned Priority, const MCSymbol *KeySym, MCSectionCOFF *Default)
static MCSectionELF * selectELFSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned Flags, unsigned *NextUniqueID, const MCSymbolELF *AssociatedSymbol)
bool isThreadData() const
bool hasLocalLinkage() const
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...
bool hasAttribute(unsigned Value) const
This represents a section on a Mach-O system (used by Mac OS X).
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
bool hasPrivateLinkage() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Compute iterated dominance frontiers using a linear time algorithm.
PointerTy getPointer() const
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
MCSection * SectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
.type _foo, STT_OBJECT # aka
This represents an "assembler immediate".
void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym) const override
StringRef getPrivateGlobalPrefix() const
static std::string scalarConstantToHexString(const Constant *C)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
void emitLinkerFlagsForGlobal(raw_ostream &OS, const GlobalValue *GV) const override
virtual void AddBlankLine()
AddBlankLine - Emit a blank line to a .s file to pretty it up.
MCSection * ConstDataSection
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSection * SixteenByteConstantSection
MCSection * TextSection
Section directive for standard text.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
MCSection * StaticCtorSection
This section contains the static constructor pointer list.
MCSection * ConstTextCoalSection
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit the module flags that specify the garbage collection information.
MCSection * DataCoalSection
static void checkMachOComdat(const GlobalValue *GV)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K)
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM...
bool isMergeableConst8() const
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
The data referenced by the COMDAT must be the same size.
A raw_ostream that writes to an SmallVector or SmallString.
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...
bool isMergeableCString() const
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
std::string getInstrProfSectionName(InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
Return the name of the profile section corresponding to IPSK.
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Given a constant with the SectionKind, return a section that it should be placed in.
const MDOperand & getOperand(unsigned I) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
const MCExpr * getIndirectSymViaGOTPCRel(const MCSymbol *Sym, const MCValue &MV, int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Get MachO PC relative GOT entry relocation.
unsigned getPointerABIAlignment(unsigned AS) const
Layout pointer alignment.
static bool isThumb(const MCSubtargetInfo &STI)
unsigned getTypeAndAttributes() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
bool isMergeable2ByteCString() const
MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=GenericSectionID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym...
Adds a requirement that another module flag be present and have a specified value after linking is pe...
This represents a section on Windows.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
static MCSectionWasm * selectWasmSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned *NextUniqueID)
int64_t getConstant() const
const MCSymbolRefExpr * getSymB() const
static SectionKind getBSS()
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
uint64_t getArrayNumElements() const
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Base class for the full range of assembler expressions which are needed for parsing.
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
The linker may choose any COMDAT.
bool hasCOFFComdatConstants() const
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
MCSection * EightByteConstantSection
S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for termination.
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
static const GlobalValue * getComdatGVForCOFF(const GlobalValue *GV)
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Context object for machine code objects.
bool hasExternalLinkage() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
MCSection * DataCommonSection
Type * getType() const
All values are typed, get the type of this value.
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...
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
Return the MCSection for the specified mach-o section.
op_range operands() const
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
static std::string APIntToHexString(const APInt &AI)
MCSection * StaticDtorSection
This section contains the static destructor pointer list.
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
static void GetObjCImageInfo(Module &M, unsigned &Version, unsigned &Flags, StringRef &Section)
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
MCSection * ConstDataCoalSection
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type. ...
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
bool isMergeableConst32() const
bool hasImplicitSection() const
Check if section name is present.
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
static SectionKind getThreadData()
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isWindowsItaniumEnvironment() const
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
bool isWindowsCoreCLREnvironment() const
static StringRef getCOFFSectionNameForUniqueGlobal(SectionKind Kind)
MCSection * DataSection
Section directive for standard data.
bool getDataSections() const
Return true if data objects should be emitted into their own section, corresponds to -fdata-sections...
bool isReadOnlyWithRel() const
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool getFunctionSections() const
Return true if functions should be emitted into their own section, corresponding to -ffunction-sectio...
void getModuleFlagsMetadata(SmallVectorImpl< ModuleFlagEntry > &Flags) const
Returns the module flags in the provided vector.
static const Comdat * getWasmComdat(const GlobalValue *GV)
No other Module may specify this COMDAT.
Streaming machine code generation interface.
StringRef getName() const
static std::string ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
PointerIntPair - This class implements a pair of a pointer and small integer.
The instances of the Type class are immutable: once they are created, they are never changed...
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Given a mergeable constant with the specified size and relocation information, return a section that ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
This represents a section on wasm.
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Return an MCExpr to use for a reference to the specified type info global variable from exception han...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K)
virtual MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const
Given a constant with the SectionKind, return a section that it should be placed in.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
MCSymbol * getSymbol(const GlobalValue *GV) const
void InitializeELF(bool UseInitArray_)
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const
True if the section is atomized using the symbols in it.
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, const TargetMachine &TM) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &TT, Mangler &Mangler)
SectionKind - This is a simple POD value that classifies the properties of a section.
MCContext & getContext() const
MCSection * UStringSection
const Triple & getTargetTriple() const
void emitLinkerFlagsForUsed(raw_ostream &OS, const GlobalValue *GV) const override
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const
Return an MCExpr to use for a reference to the specified global variable from exception handling info...
AMDGPU DAG DAG Pattern Instruction Selection
bool isMergeableConst16() const
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const override
Given a constant with the SectionKind, return a section that it should be placed in.
Ty & getObjFileInfo()
Keep track of various per-function pieces of information for backends that would like to do so...
The data referenced by the COMDAT must be the same.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
MCSection * getDrectveSection() const
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
The mach-o version of this method defaults to returning a stub reference.
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
bool isMergeableConst4() const
static const MCSymbolELF * getAssociatedSymbol(const GlobalObject *GO, const TargetMachine &TM)
S_ATTR_NO_DEAD_STRIP - No dead stripping.
static SectionKind getThreadBSS()
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, const MCSection &Section)
const MCSymbol & getSymbol() const
bool isMergeable4ByteCString() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
static SectionKind getMetadata()
const Triple & getTargetTriple() const
MCSection * DataBSSSection
static const Comdat * getELFComdat(const GlobalValue *GV)
The linker will choose the largest COMDAT.
bool hasGlobalUnnamedAddr() const
std::string utostr(uint64_t X, bool isNeg=false)
unsigned getVectorNumElements() const
unsigned getPreferredAlignment(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
This file contains constants used for implementing Dwarf debug support.
const Comdat * getComdat() const
Class for arbitrary precision integers.
static SectionKind getWasmKindForNamedSection(StringRef Name, SectionKind K)
TargetLoweringObjectFileMachO()
static StringRef getSectionPrefixForGlobal(SectionKind Kind)
Return the section prefix name used by options FunctionsSections and DataSections.
MCSection * FourByteConstantSection
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
const Comdat * getComdat() const
bool isMergeableConst() const
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
bool isFunctionTy() const
True if this is an instance of FunctionType.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
virtual void EmitLinkerOptions(ArrayRef< std::string > Kind)
Emit the given list Options of strings as linker options into the output.
bool getUniqueSectionNames() const
StringRef getValueAsString() const
Return the attribute's value as a string.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value...
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
StringRef getName() const
Return a constant reference to the value's name.
static int getSelectionForCOFF(const GlobalValue *GV)
COFFYAML::WeakExternalCharacteristics Characteristics
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
static unsigned getCOFFSectionFlags(SectionKind K, const TargetMachine &TM)
This represents a section on linux, lots of unix variants and some bare metal systems.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Type * getValueType() const
void emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &T, Mangler &M)
const Module * getModule() const
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
const GlobalObject * getBaseObject() const
StringRef getName() const
getName - Get the symbol name.
static unsigned getEntrySizeForKind(SectionKind Kind)
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCSection * TextCoalSection
A raw_ostream that writes to an std::string.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static MCSectionELF * getStaticStructorSection(MCContext &Ctx, bool UseInitArray, bool IsCtor, unsigned Priority, const MCSymbol *KeySym)
Module * getParent()
Get the module that this global value is contained inside of...
MCSection * CStringSection
bool isThreadLocal() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
bool isMergeable1ByteCString() const
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...
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
bool isExecuteOnly() const
This class implements an extremely fast bulk output stream that can only output to a stream...
bool SupportIndirectSymViaGOTPCRel
Mangler & getMangler() const
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
Primary interface to the complete machine description for the target machine.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
MCSection * BSSSection
Section that is default initialized to zero.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
const MCSymbol * getAssociatedSymbol() const
StringRef - Represent a constant reference to a string, i.e.
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
static unsigned getELFSectionFlags(SectionKind K)
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
static APInt getNullValue(unsigned numBits)
Get the '0' value.
S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for initialization.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
static SectionKind getReadOnly()
static unsigned getELFSectionType(StringRef Name, SectionKind K)
This class can be derived from and used by targets to hold private target-specific information for ea...
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
PointerType * getType() const
Global values are always pointers.
This class contains meta information specific to a module.
std::string utohexstr(uint64_t X, bool LowerCase=false)
SelectionKind getSelectionKind() const
static SectionKind getText()
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override