61 std::vector<const MDNode *> &) {
68 bool DoAutoReset,
StringRef Swift5ReflSegmentName)
69 : Swift5ReflectionSegmentName(Swift5ReflSegmentName), TT(TheTriple),
71 MAI(mai), MRI(mri), MSTI(msti), Symbols(Allocator),
72 InlineAsmUsedLabelNames(Allocator),
74 AutoReset(DoAutoReset), TargetOptions(TargetOpts) {
75 SaveTempLabels = TargetOptions && TargetOptions->MCSaveTempLabels;
78 SecureLogFile = TargetOptions ? TargetOptions->AsSecureLogFile :
"";
80 if (SrcMgr && SrcMgr->getNumBuffers())
81 MainFileName = std::string(SrcMgr->getMemoryBuffer(SrcMgr->getMainFileID())
82 ->getBufferIdentifier());
89 if (!TheTriple.isOSWindows() && !TheTriple.isUEFI()) {
90 reportFatalUsageError(
91 "cannot initialize MC for non-Windows COFF object files");
139 InlineSrcMgr.reset();
144 COFFAllocator.DestroyAll();
145 DXCAllocator.DestroyAll();
146 ELFAllocator.DestroyAll();
147 GOFFAllocator.DestroyAll();
148 MachOAllocator.DestroyAll();
149 WasmAllocator.DestroyAll();
150 XCOFFAllocator.DestroyAll();
151 MCInstAllocator.DestroyAll();
152 SPIRVAllocator.DestroyAll();
153 WasmSignatureAllocator.DestroyAll();
157 MCSubtargetAllocator.DestroyAll();
158 InlineAsmUsedLabelNames.clear();
162 CompilationDir.clear();
163 MainFileName.clear();
164 MCDwarfLineTablesCUMap.clear();
165 SectionsForRanges.clear();
166 MCGenDwarfLabelEntries.clear();
168 DwarfCompileUnitID = 0;
171 MachOUniquingMap.clear();
172 ELFUniquingMap.clear();
173 GOFFUniquingMap.clear();
174 COFFUniquingMap.clear();
175 WasmUniquingMap.clear();
176 XCOFFUniquingMap.clear();
177 DXCUniquingMap.clear();
181 ELFEntrySizeMap.clear();
182 ELFSeenGenericMergeableSections.clear();
184 DwarfLocSeen =
false;
185 GenDwarfForAssembly =
false;
186 GenDwarfFileNumber = 0;
196 return new (MCInstAllocator.Allocate())
MCInst;
205 StringRef NameRef = Name.toStringRef(NameSV);
207 assert(!NameRef.
empty() &&
"Normal symbols cannot be unnamed!");
210 if (!Entry.second.Symbol) {
211 bool IsRenamable = NameRef.
starts_with(MAI->getPrivateGlobalPrefix());
212 bool IsTemporary = IsRenamable && !SaveTempLabels;
213 if (!Entry.second.Used) {
214 Entry.second.Used =
true;
215 Entry.second.Symbol = createSymbolImpl(&Entry, IsTemporary);
217 assert(IsRenamable &&
"cannot rename non-private symbol");
219 Entry.second.Symbol = createRenamableSymbol(NameRef,
false, IsTemporary);
223 return Entry.second.Symbol;
228 StringRef NameRef = Name.toStringRef(SV);
235 for (
size_t I = 0, E = SV.
size();
I != E; ++
I) {
237 if (
C ==
'\\' &&
I + 1 != E) {
257 "$frame_escape_" +
Twine(Idx));
262 "$parent_frame_offset");
276 static_assert(std::is_trivially_destructible<MCSymbolCOFF>(),
277 "MCSymbol classes must be trivially destructible");
278 static_assert(std::is_trivially_destructible<MCSymbolELF>(),
279 "MCSymbol classes must be trivially destructible");
280 static_assert(std::is_trivially_destructible<MCSymbolMachO>(),
281 "MCSymbol classes must be trivially destructible");
282 static_assert(std::is_trivially_destructible<MCSymbolWasm>(),
283 "MCSymbol classes must be trivially destructible");
284 static_assert(std::is_trivially_destructible<MCSymbolXCOFF>(),
285 "MCSymbol classes must be trivially destructible");
289 return new (
Name, *
this) MCSymbolCOFF(Name, IsTemporary);
291 return new (
Name, *
this) MCSymbolELF(Name, IsTemporary);
293 return new (
Name, *
this) MCSymbolGOFF(Name, IsTemporary);
295 return new (
Name, *
this) MCSymbolMachO(Name, IsTemporary);
297 return new (
Name, *
this) MCSymbolWasm(Name, IsTemporary);
299 return createXCOFFSymbolImpl(Name, IsTemporary);
310 auto Name = Sym.getNameEntryPtr();
321 NewSym =
new (Name, *
this)
329 NewSym->getNameEntryPtr() = Name;
340 bool AlwaysAddSuffix,
343 Name.toVector(NewName);
344 size_t NameLen = NewName.
size();
348 while (AlwaysAddSuffix || EntryPtr->
second.Used) {
349 AlwaysAddSuffix =
false;
353 EntryPtr = &getSymbolTableEntry(NewName.
str());
356 EntryPtr->
second.Used =
true;
357 return createSymbolImpl(EntryPtr, IsTemporary);
361 if (!UseNamesOnTempLabels)
362 return createSymbolImpl(
nullptr,
true);
363 return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name,
364 AlwaysAddSuffix,
true);
368 return createRenamableSymbol(MAI->getPrivateGlobalPrefix() + Name,
true,
376 bool IsTemporary = !SaveTempLabels;
377 if (IsTemporary && !UseNamesOnTempLabels)
378 return createSymbolImpl(
nullptr, IsTemporary);
379 return createRenamableSymbol(MAI->getPrivateLabelPrefix() + Name,
388 return createRenamableSymbol(MAI->getLinkerPrivateGlobalPrefix() + Name,
401 return createSymbolImpl(&NameEntry,
false);
404unsigned MCContext::NextInstance(
unsigned LocalLabelVal) {
405 MCLabel *&Label = Instances[LocalLabelVal];
407 Label =
new (*this)
MCLabel(0);
408 return Label->incInstance();
411unsigned MCContext::GetInstance(
unsigned LocalLabelVal) {
412 MCLabel *&Label = Instances[LocalLabelVal];
414 Label =
new (*this)
MCLabel(0);
415 return Label->getInstance();
418MCSymbol *MCContext::getOrCreateDirectionalLocalSymbol(
unsigned LocalLabelVal,
420 MCSymbol *&Sym = LocalSymbols[std::make_pair(LocalLabelVal, Instance)];
427 unsigned Instance = NextInstance(LocalLabelVal);
428 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
433 unsigned Instance = GetInstance(LocalLabelVal);
436 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
441template <
typename Symbol>
442Symbol *MCContext::getOrCreateSectionSymbol(
StringRef Section) {
444 auto &SymEntry = getSymbolTableEntry(Section);
445 MCSymbol *Sym = SymEntry.second.Symbol;
451 if (Sym && Sym->
getIndex() != -1u) {
452 R =
static_cast<Symbol *
>(Sym);
454 SymEntry.second.Used =
true;
455 R =
new (&SymEntry, *
this) Symbol(&SymEntry,
false);
457 SymEntry.second.Symbol = R;
466 StringRef NameRef = Name.toStringRef(NameSV);
467 return Symbols.lookup(NameRef).Symbol;
477 InlineAsmUsedLabelNames[Sym->
getName()] = Sym;
487 return new (
nullptr, *
this)
MCSymbolXCOFF(
nullptr, IsTemporary);
505 const bool IsEntryPoint = InvalidName.starts_with(
".");
507 StringRef(IsEntryPoint ?
"._Renamed.." :
"_Renamed..");
511 for (
char &
C : InvalidName) {
521 ValidName.
append(InvalidName.substr(1, InvalidName.size() - 1));
523 ValidName.
append(InvalidName);
526 assert(!NameEntry.
second.Used &&
"This name is used somewhere else.");
527 NameEntry.
second.Used =
true;
530 MCSymbolXCOFF *XSym =
531 new (&NameEntry, *
this) MCSymbolXCOFF(&NameEntry, IsTemporary);
541 unsigned TypeAndAttributes,
543 const char *BeginSymName) {
549 assert(Section.size() <= 16 &&
"section name is too long");
550 assert(!memchr(Section.data(),
'\0', Section.size()) &&
551 "section name cannot contain NUL");
554 auto R = MachOUniquingMap.try_emplace((Segment +
Twine(
',') + Section).str());
556 return R.first->second;
564 auto *Ret =
new (MachOAllocator.Allocate())
565 MCSectionMachO(Segment, Name.substr(Name.size() - Section.size()),
566 TypeAndAttributes, Reserved2, Kind, Begin);
567 R.first->second = Ret;
577 auto *R = getOrCreateSectionSymbol<MCSymbolELF>(Section);
588 std::tie(
I, Inserted) = RelSecNames.insert(std::make_pair(Name.str(),
true));
590 return createELFSectionImpl(
591 I->getKey(),
Type, Flags, EntrySize, Group,
true,
true,
598 unsigned EntrySize) {
604 unsigned Flags,
unsigned EntrySize,
605 const Twine &Group,
bool IsComdat,
617 unsigned Flags,
unsigned EntrySize,
627 std::pair<StringMap<MCSectionELF *>::iterator,
bool> EntryNewPair;
632 Section.toVector(Buffer);
633 SectionLen = Buffer.
size();
642 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
643 }
else if (!Section.isSingleStringRef()) {
645 StringRef UniqueMapKey = Section.toStringRef(Buffer);
646 SectionLen = UniqueMapKey.
size();
647 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
649 StringRef UniqueMapKey = Section.getSingleStringRef();
650 SectionLen = UniqueMapKey.
size();
651 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
654 if (!EntryNewPair.second)
655 return EntryNewPair.first->second;
657 StringRef CachedName = EntryNewPair.first->getKey().take_front(SectionLen);
660 createELFSectionImpl(CachedName,
Type, Flags, EntrySize, GroupSym,
662 EntryNewPair.first->second = Result;
665 Result->getUniqueID(), Result->getEntrySize());
672 return createELFSectionImpl(
".group",
ELF::SHT_GROUP, 0, 4, Group, IsComdat,
678 unsigned EntrySize) {
681 ELFSeenGenericMergeableSections.insert(
SectionName);
692 ELFEntrySizeMap.insert(std::make_pair(
704 ELFSeenGenericMergeableSections.count(
SectionName);
707std::optional<unsigned>
709 unsigned EntrySize) {
710 auto I = ELFEntrySizeMap.find(std::make_tuple(
SectionName, Flags, EntrySize));
711 return (
I != ELFEntrySizeMap.end()) ? std::optional<unsigned>(
I->second)
715template <
typename TAttr>
719 std::string UniqueName(Name);
721 UniqueName.append(
"/").append(Parent->
getName());
723 UniqueName.append(
"/").append(
P->getName());
726 auto [Iter, Inserted] = GOFFUniquingMap.try_emplace(UniqueName);
734 Iter->second = GOFFSection;
740 return getGOFFSection<GOFF::SDAttr>(Kind, Name, SDAttributes,
nullptr,
747 return getGOFFSection<GOFF::EDAttr>(
748 Kind, Name, EDAttributes, Parent,
755 return getGOFFSection<GOFF::PRAttr>(Kind, Name, PRAttributes, Parent,
760 unsigned Characteristics,
764 if (!COMDATSymName.
empty()) {
766 assert(COMDATSymbol &&
"COMDATSymbol is null");
767 COMDATSymName = COMDATSymbol->
getName();
780 auto [Iter, Inserted] = COFFUniquingMap.try_emplace(
T);
784 StringRef CachedName = Iter->first.SectionName;
785 MCSymbol *Begin = getOrCreateSectionSymbol<MCSymbolCOFF>(Section);
788 Iter->second = Result;
794 unsigned Characteristics) {
819 unsigned Flags,
const Twine &Group,
825 if (K.isMetadata() && !GroupSym->
getType().has_value()) {
843 auto IterBool = WasmUniquingMap.insert(
844 std::make_pair(WasmSectionKey{Section.str(), Group,
UniqueID},
nullptr));
845 auto &Entry = *IterBool.first;
846 if (!IterBool.second)
849 StringRef CachedName = Entry.first.SectionName;
851 MCSymbol *Begin = createRenamableSymbol(CachedName,
true,
false);
853 getSymbolTableEntry(Begin->
getName()).second.Symbol = Begin;
858 Entry.second = Result;
865 return XCOFFUniquingMap.count(
866 XCOFFSectionKey(Section.str(), CsectProp.
MappingClass)) != 0;
871 std::optional<XCOFF::CsectProperties> CsectProp,
bool MultiSymbolsAllowed,
874 assert((IsDwarfSec != CsectProp.has_value()) &&
"Invalid XCOFF section!");
877 auto IterBool = XCOFFUniquingMap.insert(std::make_pair(
879 : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
881 auto &Entry = *IterBool.first;
882 if (!IterBool.second) {
891 StringRef CachedName = Entry.first.SectionName;
909 Result =
new (XCOFFAllocator.Allocate())
911 CsectProp->Type, Kind, QualName,
nullptr, CachedName,
912 MultiSymbolsAllowed);
914 Entry.second = Result;
926 auto ItInsertedPair = DXCUniquingMap.try_emplace(Section);
927 if (!ItInsertedPair.second)
928 return ItInsertedPair.first->second;
930 auto MapIt = ItInsertedPair.first;
939 return MapIt->second;
947 const std::string &To) {
948 DebugPrefixMap.emplace_back(From, To);
958 const auto &DebugPrefixMap = this->DebugPrefixMap;
959 if (DebugPrefixMap.empty())
967 for (
auto &CUIDTablePair : MCDwarfLineTablesCUMap) {
968 for (
auto &Dir : CUIDTablePair.second.getMCDwarfDirs()) {
971 Dir = std::string(
P);
976 P = CUIDTablePair.second.getRootFile().Name;
978 CUIDTablePair.second.getRootFile().Name = std::string(
P);
989 return TargetOptions->EmitDwarfUnwind;
994 return TargetOptions->EmitCompactUnwindNonCanonical;
1001 std::optional<MD5::MD5Result> Cksum;
1019 if (FileNameBuf.
empty() || FileNameBuf ==
"-")
1020 FileNameBuf =
"<stdin>";
1040 unsigned FileNumber,
1041 std::optional<MD5::MD5Result> Checksum,
1042 std::optional<StringRef> Source,
unsigned CUID) {
1044 return Table.
tryGetFile(Directory, FileName, Checksum, Source, DwarfVersion,
1052 if (FileNumber == 0)
1063 SectionsForRanges.remove_if(
1078 assert(DiagHandler &&
"MCContext::DiagHandler is not set");
1079 bool UseInlineSrcMgr =
false;
1083 }
else if (InlineSrcMgr) {
1084 SMP = InlineSrcMgr.get();
1085 UseInlineSrcMgr =
true;
1088 DiagHandler(SMD, UseInlineSrcMgr, *SMP, LocInfos);
1091void MCContext::reportCommon(
1101 bool UseInlineSrcMgr =
false;
1107 if (
Loc.isValid()) {
1110 }
else if (InlineSrcMgr) {
1111 SMP = InlineSrcMgr.get();
1112 UseInlineSrcMgr =
true;
1119 DiagHandler(
D, UseInlineSrcMgr, *SMP, LocInfos);
1130 if (TargetOptions && TargetOptions->MCNoWarn)
1132 if (TargetOptions && TargetOptions->MCFatalWarnings) {
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.
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 MCContext(const Triple &TheTriple, const MCAsmInfo *MAI, const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI, const SourceMgr *Mgr=nullptr, MCTargetOptions const *TargetOpts=nullptr, bool DoAutoReset=true, StringRef Swift5ReflSegmentName={})
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 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).
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
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(StringRef 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.
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