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();
112 PersonalityEncoding = isPositionIndependent()
117 LSDAEncoding = isPositionIndependent()
120 TTypeEncoding = isPositionIndependent()
126 if (isPositionIndependent()) {
137 PersonalityEncoding =
150 if (isPositionIndependent()) {
161 if (isPositionIndependent()) {
211 if (isPositionIndependent()) {
225 if (isPositionIndependent()) {
238 if (isPositionIndependent()) {
257 auto &
C = getContext();
265 for (
const auto &Operand : LinkerOptions->operands()) {
266 if (cast<MDNode>(Operand)->getNumOperands() != 2)
268 for (
const auto &Option : cast<MDNode>(Operand)->operands()) {
269 Streamer.
EmitBytes(cast<MDString>(Option)->getString());
280 if (!Section.
empty()) {
292 MDNode *CFGProfile =
nullptr;
294 for (
const auto &MFE : ModuleFlags) {
296 if (Key ==
"CG Profile") {
297 CFGProfile = cast<MDNode>(MFE.Val);
308 auto V = cast<ValueAsMetadata>(MDO);
309 const Function *
F = cast<Function>(V->getValue());
310 return TM->getSymbol(F);
313 for (
const auto &Edge : CFGProfile->
operands()) {
314 MDNode *
E = cast<MDNode>(Edge);
321 uint64_t Count = cast<ConstantAsMetadata>(E->
getOperand(2))
334 unsigned Encoding = getPersonalityEncoding();
336 return getContext().getOrCreateSymbol(
StringRef(
"DW.ref.") +
348 cast<MCSymbolELF>(getContext().getOrCreateSymbol(NameData));
371 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV,
".DW.stub", TM);
383 Encoding & ~DW_EH_PE_indirect, Streamer);
402 if (Name.
empty() || Name[0] !=
'.')
return K;
405 if (Name ==
".bss" ||
415 if (Name ==
".tdata" ||
421 if (Name ==
".tbss" ||
437 if (Name ==
".init_array")
440 if (Name ==
".fini_array")
443 if (Name ==
".preinit_array")
486 C->
getName() +
"' cannot be lowered.");
543 if (
Attrs.hasAttribute(
"bss-section") && Kind.
isBSS()) {
544 SectionName =
Attrs.getAttribute(
"bss-section").getValueAsString();
545 }
else if (
Attrs.hasAttribute(
"rodata-section") && Kind.
isReadOnly()) {
546 SectionName =
Attrs.getAttribute(
"rodata-section").getValueAsString();
547 }
else if (
Attrs.hasAttribute(
"data-section") && Kind.
isData()) {
548 SectionName =
Attrs.getAttribute(
"data-section").getValueAsString();
570 if (AssociatedSymbol) {
571 UniqueID = NextUniqueID++;
581 "Associated symbol mismatch between sections");
601 return ".data.rel.ro";
607 unsigned *NextUniqueID,
const MCSymbolELF *AssociatedSymbol) {
624 cast<GlobalVariable>(GO));
626 std::string SizeSpec =
".rodata.str" +
utostr(EntrySize) +
".";
627 Name = SizeSpec +
utostr(Align);
629 Name =
".rodata.cst";
630 Name +=
utostr(EntrySize);
635 if (
const auto *
F = dyn_cast<Function>(GO)) {
636 const auto &OptionalPrefix =
F->getSectionPrefix();
638 Name += *OptionalPrefix;
642 if (EmitUniqueSection) {
647 UniqueID = *NextUniqueID;
655 EntrySize, Group, UniqueID, AssociatedSymbol);
664 bool EmitUniqueSection =
false;
674 if (AssociatedSymbol) {
675 EmitUniqueSection =
true;
680 getContext(), GO, Kind, getMangler(), TM, EmitUniqueSection, Flags,
681 &NextUniqueID, AssociatedSymbol);
692 if (!EmitUniqueSection)
693 return ReadOnlySection;
696 getMangler(), TM, EmitUniqueSection,
702 bool UsesLabelDifference,
const Function &
F)
const {
712 unsigned &
Align)
const {
714 return MergeableConst4Section;
716 return MergeableConst8Section;
718 return MergeableConst16Section;
720 return MergeableConst32Section;
722 return ReadOnlySection;
725 return DataRelROSection;
729 bool IsCtor,
unsigned Priority,
742 Name =
".init_array";
745 Name =
".fini_array";
747 if (Priority != 65535) {
758 if (Priority != 65535)
767 unsigned Priority,
const MCSymbol *KeySym)
const {
773 unsigned Priority,
const MCSymbol *KeySym)
const {
808 UseInitArray = UseInitArray_;
862 for (
const auto &Option : LinkerOptions->operands()) {
864 for (
const auto &Piece : cast<MDNode>(Option)->operands())
865 StrOptions.
push_back(cast<MDString>(Piece)->getString());
870 unsigned VersionVal = 0;
871 unsigned ImageInfoFlags = 0;
877 if (SectionVal.
empty())
881 unsigned TAA = 0, StubSize = 0;
883 std::string ErrorCode =
885 TAA, TAAParsed, StubSize);
886 if (!ErrorCode.empty())
896 getOrCreateSymbol(
StringRef(
"L_OBJC_IMAGE_INFO")));
908 "' cannot be lowered.");
915 unsigned TAA = 0, StubSize = 0;
920 std::string ErrorCode =
922 TAA, TAAParsed, StubSize);
923 if (!ErrorCode.empty()) {
926 "' has an invalid section specifier '" +
942 if (S->getTypeAndAttributes() != TAA || S->getStubSize() != StubSize) {
945 "' section type or attributes does not match previous" 946 " section specifier");
976 cast<GlobalVariable>(GO)) < 32)
984 cast<GlobalVariable>(GO)) < 32)
1024 unsigned &
Align)
const {
1060 Encoding & ~DW_EH_PE_indirect, Streamer);
1143 MCSymbol *Stub = Ctx.getOrCreateSymbol(Name);
1182 bool CannotUsePrivateLabel =
true;
1186 CannotUsePrivateLabel =
1235 assert(C &&
"expected GV to have a Comdat!");
1241 "' does not exist.");
1245 "' is not a key for its COMDAT.");
1253 if (
const auto *GA = dyn_cast<GlobalAlias>(ComdatKey))
1255 if (ComdatKey == GV) {
1256 switch (
C->getSelectionKind()) {
1291 COMDATSymName = Sym->
getName();
1318 bool EmitUniquedSection;
1340 if (EmitUniquedSection)
1341 UniqueID = NextUniqueID++;
1354 COMDATSymName, Selection, UniqueID);
1359 Selection, UniqueID);
1384 bool CannotUsePrivateLabel =
false;
1388 CannotUsePrivateLabel =
true;
1399 if (!EmitUniqueSection)
1413 unsigned UniqueID = NextUniqueID++;
1416 SecName, Characteristics, Kind, COMDATSymName,
1428 for (
const auto &Option : LinkerOptions->operands()) {
1429 for (
const auto &Piece : cast<MDNode>(Option)->operands()) {
1431 std::string Directive(
" ");
1432 Directive.append(cast<MDString>(Piece)->getString());
1443 if (Section.
empty())
1447 auto *S =
C.getCOFFSection(
1489 if (Priority == 65535)
1500 OS <<
".CRT$XC" << (Priority < 200 ?
'A' :
'T') <<
format(
"%05u", Priority);
1507 std::string
Name = IsCtor ?
".ctors" :
".dtors";
1508 if (Priority != 65535)
1520 unsigned Priority,
const MCSymbol *KeySym)
const {
1527 unsigned Priority,
const MCSymbol *KeySym)
const {
1565 if (!isa<GlobalObject>(LHS) || !isa<GlobalVariable>(RHS) ||
1568 cast<GlobalVariable>(RHS)->hasInitializer() || RHS->
hasSection())
1579 unsigned Size = HexString.size();
1580 assert(Width >= Size &&
"hex string is too large!");
1581 HexString.insert(HexString.begin(), Width -
Size,
'0');
1588 if (isa<UndefValue>(C)) {
1590 }
else if (
const auto *CFP = dyn_cast<ConstantFP>(C)) {
1592 }
else if (
const auto *CI = dyn_cast<ConstantInt>(C)) {
1595 unsigned NumElements;
1596 if (isa<VectorType>(Ty))
1600 std::string HexString;
1601 for (
int I = NumElements - 1,
E = -1;
I !=
E; --
I)
1609 unsigned &
Align)
const {
1619 std::string COMDATSymName;
1643 if (!COMDATSymName.empty())
1664 "SelectionKind::Any, '" + C->
getName() +
"' cannot be " 1684 if (isa<Function>(GO)) {
1703 const TargetMachine &
TM,
bool EmitUniqueSection,
unsigned *NextUniqueID) {
1712 if (
const auto *
F = dyn_cast<Function>(GO)) {
1713 const auto &OptionalPrefix =
F->getSectionPrefix();
1715 Name += *OptionalPrefix;
1718 if (EmitUniqueSection && UniqueSectionNames) {
1723 if (EmitUniqueSection && !UniqueSectionNames) {
1724 UniqueID = *NextUniqueID;
1738 bool EmitUniqueSection =
false;
1746 EmitUniqueSection, &NextUniqueID);
1750 bool UsesLabelDifference,
const Function &
F)
const {
1786 unsigned Priority,
const MCSymbol *KeySym)
const {
1787 return Priority == UINT16_MAX ?
1794 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 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.
This class represents lattice values for constants.
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
void push_back(const T &Elt)
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.
setjmp/longjmp based exceptions
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
S_ATTR_NO_DEAD_STRIP - No dead stripping.
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...
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
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
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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
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".
MCSection * getSectionForCommandLines() const override
If supported, return the section to use for the llvm.commandline metadata.
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...
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)
static SectionKind getThreadBSS()
BlockVerifier::State From
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.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
const Comdat * getComdat() const
Class for arbitrary precision integers.
CodeModel::Model getCodeModel() const
Returns the code model.
static SectionKind getWasmKindForNamedSection(StringRef Name, SectionKind K)
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
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
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.
ExceptionHandling getExceptionHandlingType() const
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)
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)
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
SelectionKind getSelectionKind() const
static SectionKind getText()
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override