61 std::vector<const MDNode *> &) {
68 bool DoAutoReset,
StringRef Swift5ReflSegmentName)
69 : Swift5ReflectionSegmentName(Swift5ReflSegmentName), TT(TheTriple),
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;
212 for (
size_t I = 0, E = NameSV.
size();
I != E; ++
I) {
214 if (
C ==
'\\' &&
I + 1 != E) {
215 switch (NameSV[
I + 1]) {
228 assert(!NameRef.
empty() &&
"Normal symbols cannot be unnamed!");
231 if (!Entry.second.Symbol) {
233 bool IsTemporary = IsRenamable && !SaveTempLabels;
234 if (!Entry.second.Used) {
235 Entry.second.Used =
true;
236 Entry.second.Symbol = createSymbolImpl(&Entry, IsTemporary);
238 assert(IsRenamable &&
"cannot rename non-private symbol");
240 Entry.second.Symbol = createRenamableSymbol(NameRef,
false, IsTemporary);
244 return Entry.second.Symbol;
255 "$parent_frame_offset");
269 static_assert(std::is_trivially_destructible<MCSymbolCOFF>(),
270 "MCSymbol classes must be trivially destructible");
271 static_assert(std::is_trivially_destructible<MCSymbolELF>(),
272 "MCSymbol classes must be trivially destructible");
273 static_assert(std::is_trivially_destructible<MCSymbolMachO>(),
274 "MCSymbol classes must be trivially destructible");
275 static_assert(std::is_trivially_destructible<MCSymbolWasm>(),
276 "MCSymbol classes must be trivially destructible");
277 static_assert(std::is_trivially_destructible<MCSymbolXCOFF>(),
278 "MCSymbol classes must be trivially destructible");
292 return createXCOFFSymbolImpl(
Name, IsTemporary);
303 auto Name =
Sym.getNameEntryPtr();
314 NewSym =
new (
Name, *
this)
322 NewSym->getNameEntryPtr() =
Name;
328 Sym.IsTemporary =
true;
333 bool AlwaysAddSuffix,
336 Name.toVector(NewName);
337 size_t NameLen = NewName.
size();
341 while (AlwaysAddSuffix || EntryPtr->
second.Used) {
342 AlwaysAddSuffix =
false;
346 EntryPtr = &getSymbolTableEntry(NewName.
str());
349 EntryPtr->
second.Used =
true;
350 return createSymbolImpl(EntryPtr, IsTemporary);
354 if (!UseNamesOnTempLabels)
355 return createSymbolImpl(
nullptr,
true);
357 AlwaysAddSuffix,
true);
369 bool IsTemporary = !SaveTempLabels;
370 if (IsTemporary && !UseNamesOnTempLabels)
371 return createSymbolImpl(
nullptr, IsTemporary);
394 return createSymbolImpl(&NameEntry,
false);
397unsigned MCContext::NextInstance(
unsigned LocalLabelVal) {
398 MCLabel *&Label = Instances[LocalLabelVal];
400 Label =
new (*this)
MCLabel(0);
401 return Label->incInstance();
404unsigned MCContext::GetInstance(
unsigned LocalLabelVal) {
405 MCLabel *&Label = Instances[LocalLabelVal];
407 Label =
new (*this)
MCLabel(0);
408 return Label->getInstance();
411MCSymbol *MCContext::getOrCreateDirectionalLocalSymbol(
unsigned LocalLabelVal,
413 MCSymbol *&
Sym = LocalSymbols[std::make_pair(LocalLabelVal, Instance)];
420 unsigned Instance = NextInstance(LocalLabelVal);
421 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
426 unsigned Instance = GetInstance(LocalLabelVal);
429 return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
434template <
typename Symbol>
435Symbol *MCContext::getOrCreateSectionSymbol(
StringRef Section) {
437 auto &SymEntry = getSymbolTableEntry(Section);
439 if (
Sym &&
Sym->isDefined() &&
440 (!
Sym->isInSection() ||
Sym->getSection().getBeginSymbol() !=
Sym))
444 if (
Sym &&
Sym->getIndex() != -1u) {
445 R =
static_cast<Symbol *
>(
Sym);
447 SymEntry.second.Used =
true;
448 R =
new (&SymEntry, *
this) Symbol(&SymEntry,
false);
450 SymEntry.second.Symbol = R;
470 InlineAsmUsedLabelNames[
Sym->getName()] =
Sym;
480 return new (
nullptr, *
this)
MCSymbolXCOFF(
nullptr, IsTemporary);
498 const bool IsEntryPoint = InvalidName.starts_with(
".");
500 StringRef(IsEntryPoint ?
"._Renamed.." :
"_Renamed..");
504 for (
char &
C : InvalidName) {
514 ValidName.
append(InvalidName.substr(1, InvalidName.size() - 1));
516 ValidName.
append(InvalidName);
519 assert(!NameEntry.
second.Used &&
"This name is used somewhere else.");
520 NameEntry.
second.Used =
true;
524 new (&NameEntry, *
this)
MCSymbolXCOFF(&NameEntry, IsTemporary);
534 unsigned TypeAndAttributes,
536 const char *BeginSymName) {
542 assert(Section.size() <= 16 &&
"section name is too long");
543 assert(!memchr(Section.data(),
'\0', Section.size()) &&
544 "section name cannot contain NUL");
547 auto R = MachOUniquingMap.try_emplace((Segment +
Twine(
',') + Section).str());
549 return R.first->second;
557 auto *Ret =
new (MachOAllocator.Allocate())
559 TypeAndAttributes, Reserved2, Kind, Begin);
560 R.first->second = Ret;
568 bool Comdat,
unsigned UniqueID,
570 auto *R = getOrCreateSectionSymbol<MCSymbolELF>(Section);
572 Section,
Type, Flags, EntrySize, Group,
Comdat, UniqueID, R, LinkedToSym);
581 std::tie(
I, Inserted) = RelSecNames.
insert(std::make_pair(
Name.str(),
true));
583 return createELFSectionImpl(
584 I->getKey(),
Type, Flags, EntrySize, Group,
true,
true,
591 unsigned EntrySize) {
597 unsigned Flags,
unsigned EntrySize,
598 const Twine &Group,
bool IsComdat,
606 UniqueID, LinkedToSym);
610 unsigned Flags,
unsigned EntrySize,
612 bool IsComdat,
unsigned UniqueID,
620 std::pair<StringMap<MCSectionELF *>::iterator,
bool> EntryNewPair;
625 Section.toVector(Buffer);
626 SectionLen = Buffer.
size();
635 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
636 }
else if (!Section.isSingleStringRef()) {
638 StringRef UniqueMapKey = Section.toStringRef(Buffer);
639 SectionLen = UniqueMapKey.
size();
640 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
642 StringRef UniqueMapKey = Section.getSingleStringRef();
643 SectionLen = UniqueMapKey.
size();
644 EntryNewPair = ELFUniquingMap.try_emplace(UniqueMapKey);
647 if (!EntryNewPair.second)
648 return EntryNewPair.first->second;
653 createELFSectionImpl(CachedName,
Type, Flags, EntrySize, GroupSym,
654 IsComdat, UniqueID, LinkedToSym);
655 EntryNewPair.first->second = Result;
658 Result->getUniqueID(), Result->getEntrySize());
665 return createELFSectionImpl(
".group",
ELF::SHT_GROUP, 0, 4, Group, IsComdat,
670 unsigned Flags,
unsigned UniqueID,
671 unsigned EntrySize) {
674 ELFSeenGenericMergeableSections.insert(
SectionName);
685 ELFEntrySizeMap.insert(std::make_pair(
686 std::make_tuple(
SectionName, Flags, EntrySize), UniqueID));
697 ELFSeenGenericMergeableSections.count(
SectionName);
700std::optional<unsigned>
702 unsigned EntrySize) {
703 auto I = ELFEntrySizeMap.find(std::make_tuple(
SectionName, Flags, EntrySize));
704 return (
I != ELFEntrySizeMap.end()) ? std::optional<unsigned>(
I->second)
708template <
typename TAttr>
712 std::string UniqueName(
Name);
714 UniqueName.append(
"/").append(Parent->
getName());
716 UniqueName.append(
"/").append(
P->getName());
719 auto [Iter, Inserted] = GOFFUniquingMap.try_emplace(UniqueName);
727 Iter->second = GOFFSection;
733 return getGOFFSection<GOFF::SDAttr>(Kind,
Name, SDAttributes,
nullptr,
740 return getGOFFSection<GOFF::EDAttr>(
741 Kind,
Name, EDAttributes, Parent,
748 return getGOFFSection<GOFF::PRAttr>(Kind,
Name, PRAttributes, Parent,
757 if (!COMDATSymName.
empty()) {
759 assert(COMDATSymbol &&
"COMDATSymbol is null");
760 COMDATSymName = COMDATSymbol->
getName();
772 COFFSectionKey
T{Section, COMDATSymName,
Selection, UniqueID};
773 auto [Iter, Inserted] = COFFUniquingMap.try_emplace(
T);
777 StringRef CachedName = Iter->first.SectionName;
778 MCSymbol *Begin = getOrCreateSectionSymbol<MCSymbolCOFF>(Section);
781 Iter->second = Result;
812 unsigned Flags,
const Twine &Group,
818 if (K.isMetadata() && !GroupSym->
getType().has_value()) {
836 auto IterBool = WasmUniquingMap.insert(
837 std::make_pair(WasmSectionKey{Section.str(), Group, UniqueID},
nullptr));
838 auto &Entry = *IterBool.first;
839 if (!IterBool.second)
842 StringRef CachedName = Entry.first.SectionName;
844 MCSymbol *Begin = createRenamableSymbol(CachedName,
true,
false);
850 MCSectionWasm(CachedName, Kind, Flags, GroupSym, UniqueID, Begin);
851 Entry.second = Result;
858 return XCOFFUniquingMap.count(
859 XCOFFSectionKey(Section.str(), CsectProp.
MappingClass)) != 0;
864 std::optional<XCOFF::CsectProperties> CsectProp,
bool MultiSymbolsAllowed,
867 assert((IsDwarfSec != CsectProp.has_value()) &&
"Invalid XCOFF section!");
870 auto IterBool = XCOFFUniquingMap.insert(std::make_pair(
872 : XCOFFSectionKey(Section.str(), CsectProp->MappingClass),
874 auto &Entry = *IterBool.first;
875 if (!IterBool.second) {
884 StringRef CachedName = Entry.first.SectionName;
902 Result =
new (XCOFFAllocator.Allocate())
904 CsectProp->Type, Kind, QualName,
nullptr, CachedName,
905 MultiSymbolsAllowed);
907 Entry.second = Result;
919 auto ItInsertedPair = DXCUniquingMap.try_emplace(Section);
920 if (!ItInsertedPair.second)
921 return ItInsertedPair.first->second;
923 auto MapIt = ItInsertedPair.first;
932 return MapIt->second;
940 const std::string &To) {
951 const auto &DebugPrefixMap = this->DebugPrefixMap;
952 if (DebugPrefixMap.
empty())
960 for (
auto &CUIDTablePair : MCDwarfLineTablesCUMap) {
961 for (
auto &Dir : CUIDTablePair.second.getMCDwarfDirs()) {
964 Dir = std::string(
P);
969 P = CUIDTablePair.second.getRootFile().Name;
971 CUIDTablePair.second.getRootFile().Name = std::string(
P);
994 std::optional<MD5::MD5Result> Cksum;
1012 if (FileNameBuf.
empty() || FileNameBuf ==
"-")
1013 FileNameBuf =
"<stdin>";
1033 unsigned FileNumber,
1034 std::optional<MD5::MD5Result> Checksum,
1035 std::optional<StringRef> Source,
unsigned CUID) {
1037 return Table.
tryGetFile(Directory, FileName, Checksum, Source, DwarfVersion,
1045 if (FileNumber == 0)
1056 SectionsForRanges.remove_if(
1071 assert(DiagHandler &&
"MCContext::DiagHandler is not set");
1072 bool UseInlineSrcMgr =
false;
1076 }
else if (InlineSrcMgr) {
1077 SMP = InlineSrcMgr.get();
1078 UseInlineSrcMgr =
true;
1081 DiagHandler(SMD, UseInlineSrcMgr, *SMP, LocInfos);
1084void MCContext::reportCommon(
1094 bool UseInlineSrcMgr =
false;
1103 }
else if (InlineSrcMgr) {
1104 SMP = InlineSrcMgr.get();
1105 UseInlineSrcMgr =
true;
1112 DiagHandler(
D, UseInlineSrcMgr, *SMP, LocInfos);
unsigned const MachineRegisterInfo * MRI
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)
BlockVerifier::State From
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
COFFYAML::WeakExternalCharacteristics Characteristics
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
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.
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it,...
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...
StringRef getPrivateGlobalPrefix() const
StringRef getLinkerPrivateGlobalPrefix() const
StringRef getPrivateLabelPrefix() const
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 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.
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
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.
virtual StringRef getBufferIdentifier() const
Return an identifier for this buffer, typically the filename it was read from.
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.
constexpr bool isValid() const
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...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
unsigned getMainFileID() const
const MemoryBuffer * getMemoryBuffer(unsigned i) const
unsigned getNumBuffers() const
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.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
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.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into 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.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
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.
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.
MCSymbol * Symbol
The symbol associated with the name, if any.
StorageMappingClass MappingClass