61 std::vector<const MDNode *> &) {
69 : Swift5ReflectionSegmentName(Swift5ReflSegmentName), TT(TheTriple),
71 MAI(mai), MRI(mri), MSTI(msti), Symbols(Allocator),
72 InlineAsmUsedLabelNames(Allocator),
74 AutoReset(DoAutoReset) {
81 if (SrcMgr && SrcMgr->getNumBuffers())
82 MainFileName = std::string(SrcMgr->getMemoryBuffer(SrcMgr->getMainFileID())
83 ->getBufferIdentifier());
92 "cannot initialize MC for non-Windows COFF object files");
122 return MAI.getTargetOptions();
144 InlineSrcMgr.reset();
149 COFFAllocator.DestroyAll();
150 DXCAllocator.DestroyAll();
151 ELFAllocator.DestroyAll();
152 GOFFAllocator.DestroyAll();
153 MachOAllocator.DestroyAll();
154 WasmAllocator.DestroyAll();
155 XCOFFAllocator.DestroyAll();
156 MCInstAllocator.DestroyAll();
157 SPIRVAllocator.DestroyAll();
158 WasmSignatureAllocator.DestroyAll();
162 MCSubtargetAllocator.DestroyAll();
163 InlineAsmUsedLabelNames.clear();
167 CompilationDir.clear();
168 MainFileName.clear();
169 MCDwarfLineTablesCUMap.clear();
170 SectionsForRanges.clear();
171 MCGenDwarfLabelEntries.clear();
173 DwarfCompileUnitID = 0;
176 MachOUniquingMap.clear();
177 ELFUniquingMap.clear();
178 GOFFUniquingMap.clear();
179 COFFUniquingMap.clear();
180 WasmUniquingMap.clear();
181 XCOFFUniquingMap.clear();
182 DXCUniquingMap.clear();
186 ELFEntrySizeMap.clear();
187 ELFSeenGenericMergeableSections.clear();
189 DwarfLocSeen =
false;
190 GenDwarfForAssembly =
false;
191 GenDwarfFileNumber = 0;
201 return new (MCInstAllocator.Allocate())
MCInst;
210 StringRef NameRef = Name.toStringRef(NameSV);
212 assert(!NameRef.
empty() &&
"Normal symbols cannot be unnamed!");
215 if (!Entry.second.Symbol) {
216 bool IsRenamable = NameRef.
starts_with(MAI.getInternalSymbolPrefix());
217 bool IsTemporary = IsRenamable && !SaveTempLabels;
218 if (!Entry.second.Used) {
219 Entry.second.Used =
true;
220 Entry.second.Symbol = createSymbolImpl(&Entry, IsTemporary);
222 assert(IsRenamable &&
"cannot rename non-private symbol");
224 Entry.second.Symbol = createRenamableSymbol(NameRef,
false, IsTemporary);
228 return Entry.second.Symbol;
233 StringRef NameRef = Name.toStringRef(SV);
240 for (
size_t I = 0, E = SV.
size();
I != E; ++
I) {
242 if (
C ==
'\\' &&
I + 1 != E) {
262 "$frame_escape_" +
Twine(Idx));
267 "$parent_frame_offset");
281 static_assert(std::is_trivially_destructible<MCSymbolCOFF>(),
282 "MCSymbol classes must be trivially destructible");
283 static_assert(std::is_trivially_destructible<MCSymbolELF>(),
284 "MCSymbol classes must be trivially destructible");
285 static_assert(std::is_trivially_destructible<MCSymbolMachO>(),
286 "MCSymbol classes must be trivially destructible");
287 static_assert(std::is_trivially_destructible<MCSymbolWasm>(),
288 "MCSymbol classes must be trivially destructible");
289 static_assert(std::is_trivially_destructible<MCSymbolXCOFF>(),
290 "MCSymbol classes must be trivially destructible");
294 return new (
Name, *
this) MCSymbolCOFF(Name, IsTemporary);
296 return new (
Name, *
this) MCSymbolELF(Name, IsTemporary);
298 return new (
Name, *
this) MCSymbolGOFF(Name, IsTemporary);
300 return new (
Name, *
this) MCSymbolMachO(Name, IsTemporary);
302 return new (
Name, *
this) MCSymbolWasm(Name, IsTemporary);
304 return createXCOFFSymbolImpl(Name, IsTemporary);
315 auto Name = Sym.getNameEntryPtr();
326 NewSym =
new (Name, *
this)
334 NewSym->getNameEntryPtr() = Name;
345 bool AlwaysAddSuffix,
348 Name.toVector(NewName);
349 size_t NameLen = NewName.
size();
353 while (AlwaysAddSuffix || EntryPtr->
second.Used) {
354 AlwaysAddSuffix =
false;
358 EntryPtr = &getSymbolTableEntry(NewName.
str());
361 EntryPtr->
second.Used =
true;
362 return createSymbolImpl(EntryPtr, IsTemporary);
366 if (!UseNamesOnTempLabels)
367 return createSymbolImpl(
nullptr,
true);
368 return createRenamableSymbol(MAI.getInternalSymbolPrefix() + Name,
369 AlwaysAddSuffix,
true);
373 return createRenamableSymbol(MAI.getInternalSymbolPrefix() + Name,
true,
381 bool IsTemporary = !SaveTempLabels;
382 if (IsTemporary && !UseNamesOnTempLabels)
383 return createSymbolImpl(
nullptr, IsTemporary);
384 return createRenamableSymbol(MAI.getPrivateLabelPrefix() + Name,
393 return createRenamableSymbol(MAI.getLinkerPrivateGlobalPrefix() + Name,
406 return createSymbolImpl(&NameEntry,
false);
409unsigned MCContext::NextInstance(
unsigned LocalLabelVal) {
410 MCLabel *&Label = Instances[LocalLabelVal];
412 Label =
new (*this)
MCLabel(0);
413 return Label->incInstance();
416unsigned MCContext::GetInstance(
unsigned LocalLabelVal) {
417 MCLabel *&Label = Instances[LocalLabelVal];
419 Label =
new (*this)
MCLabel(0);
420 return Label->getInstance();
423MCSymbol *MCContext::getOrCreateDirectionalLocalSymbol(
unsigned LocalLabelVal,
425 MCSymbol *&Sym = LocalSymbols[std::make_pair(LocalLabelVal, Instance)];
432 unsigned Instance = NextInstance(LocalLabelVal);
433 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
438 unsigned Instance = GetInstance(LocalLabelVal);
441 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
446template <
typename Symbol>
447Symbol *MCContext::getOrCreateSectionSymbol(
StringRef Section) {
449 auto &SymEntry = getSymbolTableEntry(Section);
450 MCSymbol *Sym = SymEntry.second.Symbol;
460 if (Sym && Sym->
getIndex() != -1u) {
461 R =
static_cast<Symbol *
>(Sym);
463 SymEntry.second.Used =
true;
464 R =
new (&SymEntry, *
this)
Symbol(&SymEntry,
false);
466 SymEntry.second.Symbol =
R;
475 StringRef NameRef = Name.toStringRef(NameSV);
476 return Symbols.lookup(NameRef).Symbol;
486 InlineAsmUsedLabelNames[Sym->
getName()] = Sym;
496 return new (
nullptr, *
this)
MCSymbolXCOFF(
nullptr, IsTemporary);
514 const bool IsEntryPoint = InvalidName.starts_with(
".");
516 StringRef(IsEntryPoint ?
"._Renamed.." :
"_Renamed..");
520 for (
char &
C : InvalidName) {
530 ValidName.
append(InvalidName.substr(1, InvalidName.size() - 1));
532 ValidName.
append(InvalidName);
535 assert(!NameEntry.
second.Used &&
"This name is used somewhere else.");
536 NameEntry.
second.Used =
true;
539 MCSymbolXCOFF *XSym =
540 new (&NameEntry, *
this) MCSymbolXCOFF(&NameEntry, IsTemporary);
550 unsigned TypeAndAttributes,
552 const char *BeginSymName) {
558 assert(Section.size() <= 16 &&
"section name is too long");
559 assert(!memchr(Section.data(),
'\0', Section.size()) &&
560 "section name cannot contain NUL");
563 auto R = MachOUniquingMap.try_emplace((Segment +
Twine(
',') + Section).str());
565 return R.first->second;
573 auto *Ret =
new (MachOAllocator.Allocate())
574 MCSectionMachO(Segment, Name.substr(Name.size() - Section.size()),
575 TypeAndAttributes, Reserved2, Kind, Begin);
576 R.first->second = Ret;
586 auto *R = getOrCreateSectionSymbol<MCSymbolELF>(Section);
597 std::tie(
I, Inserted) = RelSecNames.insert(std::make_pair(Name.str(),
true));
599 return createELFSectionImpl(
600 I->getKey(),
Type, Flags, EntrySize, Group,
true,
true,
607 unsigned EntrySize) {
613 unsigned Flags,
unsigned EntrySize,
614 const Twine &Group,
bool IsComdat,
626 unsigned Flags,
unsigned EntrySize,
636 std::pair<StringMap<MCSectionELF *>::iterator,
bool> EntryNewPair;
641 Section.toVector(Buffer);
642 SectionLen = Buffer.
size();
651 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
652 }
else if (!Section.isSingleStringRef()) {
654 StringRef UniqueMapKey = Section.toStringRef(Buffer);
655 SectionLen = UniqueMapKey.
size();
656 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
658 StringRef UniqueMapKey = Section.getSingleStringRef();
659 SectionLen = UniqueMapKey.
size();
660 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
663 if (!EntryNewPair.second)
664 return EntryNewPair.first->second;
666 StringRef CachedName = EntryNewPair.first->getKey().take_front(SectionLen);
669 createELFSectionImpl(CachedName,
Type, Flags, EntrySize, GroupSym,
671 EntryNewPair.first->second = Result;
674 Result->getUniqueID(), Result->getEntrySize());
681 return createELFSectionImpl(
".group",
ELF::SHT_GROUP, 0, 4, Group, IsComdat,
687 unsigned EntrySize) {
690 ELFSeenGenericMergeableSections.insert(
SectionName);
701 ELFEntrySizeMap.insert(std::make_pair(
713 ELFSeenGenericMergeableSections.count(
SectionName);
716std::optional<unsigned>
718 unsigned EntrySize) {
719 auto I = ELFEntrySizeMap.find(std::make_tuple(
SectionName, Flags, EntrySize));
720 return (
I != ELFEntrySizeMap.end()) ? std::optional<unsigned>(
I->second)
724template <
typename TAttr>
728 std::string UniqueName(Name);
730 UniqueName.append(
"/").append(Parent->
getName());
732 UniqueName.append(
"/").append(
P->getName());
735 auto [Iter, Inserted] = GOFFUniquingMap.try_emplace(UniqueName);
743 Iter->second = GOFFSection;
749 return getGOFFSection<GOFF::SDAttr>(Kind, Name, SDAttributes,
nullptr,
756 return getGOFFSection<GOFF::EDAttr>(
757 Kind, Name, EDAttributes, Parent,
764 return getGOFFSection<GOFF::PRAttr>(Kind, Name, PRAttributes, Parent,
769 unsigned Characteristics,
773 if (!COMDATSymName.
empty()) {
775 assert(COMDATSymbol &&
"COMDATSymbol is null");
776 COMDATSymName = COMDATSymbol->
getName();
789 auto [Iter, Inserted] = COFFUniquingMap.try_emplace(
T);
793 StringRef CachedName = Iter->first.SectionName;
794 MCSymbol *Begin = getOrCreateSectionSymbol<MCSymbolCOFF>(Section);
797 Iter->second = Result;
803 unsigned Characteristics) {
828 unsigned Flags,
const Twine &Group,
834 if (K.isMetadata() && !GroupSym->
getType().has_value()) {
852 auto IterBool = WasmUniquingMap.insert(
853 std::make_pair(WasmSectionKey{Section.str(), Group,
UniqueID},
nullptr));
854 auto &Entry = *IterBool.first;
855 if (!IterBool.second)
858 StringRef CachedName = Entry.first.SectionName;
860 MCSymbol *Begin = createRenamableSymbol(CachedName,
true,
false);
862 getSymbolTableEntry(Begin->
getName()).second.Symbol = Begin;
867 Entry.second = Result;
874 return XCOFFUniquingMap.count(
875 XCOFFSectionKey(Section.str(), CsectProp.
MappingClass)) != 0;
880 std::optional<XCOFF::CsectProperties> CsectProp,
bool MultiSymbolsAllowed,
883 assert((IsDwarfSec != CsectProp.has_value()) &&
"Invalid XCOFF section!");
886 auto IterBool = XCOFFUniquingMap.insert(std::make_pair(
888 : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
890 auto &Entry = *IterBool.first;
891 if (!IterBool.second) {
900 StringRef CachedName = Entry.first.SectionName;
918 Result =
new (XCOFFAllocator.Allocate())
920 CsectProp->Type, Kind, QualName,
nullptr, CachedName,
921 MultiSymbolsAllowed);
923 Entry.second = Result;
935 auto ItInsertedPair = DXCUniquingMap.try_emplace(Section);
936 if (!ItInsertedPair.second)
937 return ItInsertedPair.first->second;
939 auto MapIt = ItInsertedPair.first;
948 return MapIt->second;
956 const std::string &To) {
957 DebugPrefixMap.emplace_back(From, To);
967 const auto &DebugPrefixMap = this->DebugPrefixMap;
968 if (DebugPrefixMap.empty())
976 for (
auto &CUIDTablePair : MCDwarfLineTablesCUMap) {
977 for (
auto &Dir : CUIDTablePair.second.getMCDwarfDirs()) {
980 Dir = std::string(
P);
985 P = CUIDTablePair.second.getRootFile().Name;
987 CUIDTablePair.second.getRootFile().Name = std::string(
P);
1006 std::optional<MD5::MD5Result> Cksum;
1024 if (FileNameBuf.
empty() || FileNameBuf ==
"-")
1025 FileNameBuf =
"<stdin>";
1045 unsigned FileNumber,
1046 std::optional<MD5::MD5Result> Checksum,
1047 std::optional<StringRef> Source,
unsigned CUID) {
1049 return Table.
tryGetFile(Directory, FileName, Checksum, Source, DwarfVersion,
1057 if (FileNumber == 0)
1068 SectionsForRanges.remove_if(
1083 assert(DiagHandler &&
"MCContext::DiagHandler is not set");
1084 bool UseInlineSrcMgr =
false;
1088 }
else if (InlineSrcMgr) {
1089 SMP = InlineSrcMgr.get();
1090 UseInlineSrcMgr =
true;
1093 DiagHandler(SMD, UseInlineSrcMgr, *SMP, LocInfos);
1096void MCContext::reportCommon(
1106 bool UseInlineSrcMgr =
false;
1112 if (
Loc.isValid()) {
1115 }
else if (InlineSrcMgr) {
1116 SMP = InlineSrcMgr.get();
1117 UseInlineSrcMgr =
true;
1124 DiagHandler(
D, UseInlineSrcMgr, *SMP, LocInfos);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
static const Function * getParent(const Value *V)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void defaultDiagHandler(const SMDiagnostic &SMD, bool, const SourceMgr &, std::vector< const MDNode * > &)
#define DWARF2_FLAG_IS_STMT
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
This file contains the MCSymbolGOFF class.
static constexpr unsigned SM(unsigned Version)
This file defines the SmallString class.
This file defines the SmallVector class.
Holds state from .cv_file and .cv_loc directives for later emission.
Tagged union holding either a T or a Error.
This class is intended to be used as a base class for asm properties and features specific to the tar...
virtual bool isAcceptableChar(char C) const
Return true if C is an acceptable character inside a symbol name.
virtual bool isValidUnquotedName(StringRef Name) const
Return true if the identifier Name does not need quotes to be syntactically correct.
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
LLVM_ABI void remapDebugPath(SmallVectorImpl< char > &Path)
Remap one path in-place as per the debug prefix map.
LLVM_ABI MCSymbol * createBlockSymbol(const Twine &Name, bool AlwaysEmit=false)
Get or create a symbol for a basic block.
LLVM_ABI MCSubtargetInfo & getSubtargetCopy(const MCSubtargetInfo &STI)
LLVM_ABI 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.
Environment getObjectFileType() const
LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val)
Set value for a symbol.
const std::string & getMainFileName() const
Get the main file name for use in error messages and debug info.
LLVM_ABI MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, StringRef COMDATSymName, int Selection, unsigned UniqueID=MCSection::NonUniqueID)
LLVM_ABI void addDebugPrefixMapEntry(const std::string &From, const std::string &To)
Add an entry to the debug prefix map.
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
StringRef getCompilationDir() const
Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setComp...
LLVM_ABI void RemapDebugPaths()
LLVM_ABI MCInst * createMCInst()
Create and return a new MC instruction.
LLVM_ABI MCSymbol * getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx)
Gets a symbol that will be defined to the final stack offset of a local variable after codegen.
LLVM_ABI MCSectionELF * createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection)
LLVM_ABI MCSymbol * createLinkerPrivateTempSymbol()
Create a new linker temporary symbol with the specified prefix (Name) or "tmp".
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags, unsigned UniqueID, unsigned EntrySize)
LLVM_ABI Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
LLVM_ABI wasm::WasmSignature * createWasmSignature()
Allocates and returns a new WasmSignature instance (with empty parameter and return type lists).
LLVM_ABI MCSectionELF * getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, unsigned EntrySize=0)
Get a section with the provided group identifier.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
LLVM_ABI MCSectionXCOFF * getXCOFFSection(StringRef Section, SectionKind K, std::optional< XCOFF::CsectProperties > CsectProp=std::nullopt, bool MultiSymbolsAllowed=false, std::optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=std::nullopt)
LLVM_ABI void diagnose(const SMDiagnostic &SMD)
LLVM_ABI bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID=0)
isValidDwarfFileNumber - takes a dwarf file number and returns true if it currently is assigned and f...
LLVM_ABI void registerInlineAsmLabel(MCSymbol *Sym)
registerInlineAsmLabel - Records that the name is a label referenced in inline assembly.
LLVM_ABI MCSymbol * createLocalSymbol(StringRef Name)
Create a local, non-temporary symbol like an ELF mapping symbol.
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
LLVM_ABI void initInlineSourceManager()
LLVM_ABI MCSymbol * getOrCreateParentFrameOffsetSymbol(const Twine &FuncName)
LLVM_ABI MCSymbol * lookupSymbol(const Twine &Name) const
Get the symbol for Name, or null.
LLVM_ABI bool emitCompactUnwindNonCanonical() const
LLVM_ABI CodeViewContext & getCVContext()
LLVM_ABI void reset()
reset - return object to right after construction state to prepare to process a new module
LLVM_ABI bool isELFGenericMergeableSection(StringRef Name)
LLVM_ABI std::optional< unsigned > getELFUniqueIDForEntsize(StringRef SectionName, unsigned Flags, unsigned EntrySize)
Return the unique ID of the section with the given name, flags and entry size, if it exists.
LLVM_ABI MCSymbol * createDirectionalLocalSymbol(unsigned LocalLabelVal)
Create the definition of a directional local symbol for numbered label (used for "1:" definitions).
LLVM_ABI void reportWarning(SMLoc L, const Twine &Msg)
uint16_t getDwarfVersion() const
LLVM_ABI void finalizeDwarfSections(MCStreamer &MCOS)
Remove empty sections from SectionsForRanges, to avoid generating useless debug info for them.
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
LLVM_ABI MCContext(const Triple &TheTriple, const MCAsmInfo &MAI, const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI, const SourceMgr *Mgr=nullptr, bool DoAutoReset=true, StringRef Swift5ReflSegmentName={})
LLVM_ABI MCSymbol * getOrCreateLSDASymbol(const Twine &FuncName)
LLVM_ABI MCSectionDXContainer * getDXContainerSection(StringRef Section, SectionKind K)
Get the section for the provided Section name.
LLVM_ABI bool hasXCOFFSection(StringRef Section, XCOFF::CsectProperties CsectProp) const
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
LLVM_ABI MCSymbol * createLinkerPrivateSymbol(const Twine &Name)
LLVM_ABI MCSectionSPIRV * getSPIRVSection()
LLVM_ABI MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=MCSection::NonUniqueID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym.
LLVM_ABI MCSymbol * cloneSymbol(MCSymbol &Sym)
Clone a symbol for the .set directive, replacing it in the symbol table.
LLVM_ABI MCSymbol * parseSymbol(const Twine &Name)
Variant of getOrCreateSymbol that handles backslash-escaped symbols.
LLVM_ABI EmitDwarfUnwindType emitDwarfUnwindInfo() const
LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name)
LLVM_ABI MCSectionELF * createELFGroupSection(const MCSymbolELF *Group, bool IsComdat)
void setUseNamesOnTempLabels(bool Value)
LLVM_ABI void setGenDwarfRootFile(StringRef FileName, StringRef Buffer)
Specifies information about the "root file" for assembler clients (e.g., llvm-mc).
LLVM_ABI const MCTargetOptions & getTargetOptions() const
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
LLVM_ABI MCSymbol * getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before)
Create and return a directional local symbol for numbered label (used for "1b" or 1f" references).
LLVM_ABI MCSymbol * createNamedTempSymbol()
Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
LLVM_ABI Expected< unsigned > tryGetFile(StringRef &Directory, StringRef &FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, uint16_t DwarfVersion, unsigned FileNumber=0)
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Instances of this class represent the information from a dwarf .loc directive.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent a label name in the MC file, and MCLabel are created and uniqued by...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This represents a section on Windows.
MCSymbol * getCOMDATSymbol() const
unsigned getCharacteristics() const
This represents a section on linux, lots of unix variants and some bare metal systems.
This represents a section on a Mach-O system (used by Mac OS X).
This represents a section on wasm.
bool isMultiSymbolsAllowed() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
static constexpr unsigned NonUniqueID
StringRef getName() const
MCSymbol * getBeginSymbol()
Streaming machine code generation interface.
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual bool mayHaveInstructions(MCSection &Sec) const
Generic base class for all target subtargets.
void setComdat(bool isComdat)
void setType(wasm::WasmSymbolType type)
std::optional< wasm::WasmSymbolType > getType() const
static StringRef getUnqualifiedName(StringRef Name)
void setSymbolTableName(StringRef STN)
StringRef getUnqualifiedName() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute).
StringRef getName() const
getName - Get the symbol name.
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
uint32_t getIndex() const
Get the (implementation defined) index.
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
unsigned IsTemporary
IsTemporary - True if this is an assembler temporary label, which typically does not survive in the ....
void setIsRegistered(bool Value) const
std::string AsSecureLogFile
bool EmitCompactUnwindNonCanonical
EmitDwarfUnwindType EmitDwarfUnwind
LLVM_ABI void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
LLVM_ABI void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
LLVM_ABI void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true, bool ShowLocation=true) const
Represents a location in source code.
SectionKind - This is a simple POD value that classifies the properties of a section.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
StringRef str() const
Explicit conversion to StringRef.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
LLVM_ABI SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges={}, ArrayRef< SMFixIt > FixIts={}) const
Return an SMDiagnostic at the specified location with the specified string.
StringMapIterBase< ValueTy, false > iterator
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&...Args)
Emplace a new element for the specified key into the map if the key isn't already in the map.
StringRef - Represent a constant reference to a string, i.e.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
constexpr size_t size() const
size - Get the string size.
char front() const
front - Get the first character in the string.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
Triple - Helper class for working with autoconf configuration names.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
bool isUEFI() const
Tests whether the OS is UEFI.
bool isOSWindows() const
Tests whether the OS is Windows.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
bool isTriviallyEmpty() const
Check if this twine is trivially empty; a false return value does not necessarily mean the twine is e...
The instances of the Type class are immutable: once they are created, they are never changed.
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
@ C
The default llvm calling convention, compatible with C.
DwarfSectionSubtypeFlags
Values for defining the section subtype of sections of type STYP_DWARF as they would appear in the (s...
LLVM_ABI StringRef getMappingClassString(XCOFF::StorageMappingClass SMC)
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
LLVM_ABI void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
LLVM_ABI bool replace_path_prefix(SmallVectorImpl< char > &Path, StringRef OldPrefix, StringRef NewPrefix, Style style=Style::native)
Replace matching path prefix with another path.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
LLVM_ABI bool is_separator(char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
@ WASM_SYMBOL_TYPE_SECTION
This is an optimization pass for GlobalISel generic memory operations.
auto reverse(ContainerTy &&C)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
StringMapEntry< MCSymbolTableValue > MCSymbolTableEntry
MCContext stores MCSymbolTableValue in a string map (see MCSymbol::operator new).
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
GOFF::ESDBindingAlgorithm BindAlgorithm
The value for an entry in the symbol table of an MCContext.
StorageMappingClass MappingClass