LLVM 22.0.0git
llvm::MCContext Class Reference

Context object for machine code objects. More...

#include "llvm/MC/MCContext.h"

Public Types

enum  Environment {
  IsMachO , IsELF , IsGOFF , IsCOFF ,
  IsSPIRV , IsWasm , IsXCOFF , IsDXContainer
}
using SymbolTable = StringMap<MCSymbolTableValue, BumpPtrAllocator &>
using DiagHandlerTy

Public Member Functions

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={})
 MCContext (const MCContext &)=delete
MCContextoperator= (const MCContext &)=delete
LLVM_ABI ~MCContext ()
Environment getObjectFileType () const
bool isELF () const
bool isMachO () const
bool isXCOFF () const
const StringRefgetSwift5ReflectionSegmentName () const
const TriplegetTargetTriple () const
const SourceMgrgetSourceManager () const
LLVM_ABI void initInlineSourceManager ()
SourceMgrgetInlineSourceManager ()
std::vector< const MDNode * > & getLocInfos ()
void setDiagnosticHandler (DiagHandlerTy DiagHandler)
void setObjectFileInfo (const MCObjectFileInfo *Mofi)
const MCAsmInfogetAsmInfo () const
const MCRegisterInfogetRegisterInfo () const
const MCObjectFileInfogetObjectFileInfo () const
const MCSubtargetInfogetSubtargetInfo () const
const MCTargetOptionsgetTargetOptions () const
LLVM_ABI CodeViewContextgetCVContext ()
void setUseNamesOnTempLabels (bool Value)
StringRef getSecureLogFile ()
raw_fd_ostreamgetSecureLog ()
void setSecureLog (std::unique_ptr< raw_fd_ostream > Value)
bool getSecureLogUsed ()
void setSecureLogUsed (bool Value)
void * allocate (unsigned Size, unsigned Align=8)
void deallocate (void *Ptr)
StringRef allocateString (StringRef s)
 Allocates a copy of the given string on the allocator managed by this context and returns the result.
bool hadError ()
LLVM_ABI void diagnose (const SMDiagnostic &SMD)
LLVM_ABI void reportError (SMLoc L, const Twine &Msg)
LLVM_ABI void reportWarning (SMLoc L, const Twine &Msg)
MCAsmMacrolookupMacro (StringRef Name)
void defineMacro (StringRef Name, MCAsmMacro Macro)
void undefineMacro (StringRef Name)
MCPseudoProbeTablegetMCPseudoProbeTable ()
Module Lifetime Management
LLVM_ABI void reset ()
 reset - return object to right after construction state to prepare to process a new module
McInst Management
LLVM_ABI MCInstcreateMCInst ()
 Create and return a new MC instruction.
Symbol Management
LLVM_ABI MCSymbolcreateLinkerPrivateTempSymbol ()
 Create a new linker temporary symbol with the specified prefix (Name) or "tmp".
LLVM_ABI MCSymbolcreateLinkerPrivateSymbol (const Twine &Name)
LLVM_ABI MCSymbolcreateTempSymbol ()
 Create a temporary symbol with a unique name.
LLVM_ABI MCSymbolcreateTempSymbol (const Twine &Name, bool AlwaysAddSuffix=true)
LLVM_ABI MCSymbolcreateNamedTempSymbol ()
 Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
LLVM_ABI MCSymbolcreateNamedTempSymbol (const Twine &Name)
LLVM_ABI MCSymbolcreateBlockSymbol (const Twine &Name, bool AlwaysEmit=false)
 Get or create a symbol for a basic block.
LLVM_ABI MCSymbolcreateLocalSymbol (StringRef Name)
 Create a local, non-temporary symbol like an ELF mapping symbol.
LLVM_ABI MCSymbolcreateDirectionalLocalSymbol (unsigned LocalLabelVal)
 Create the definition of a directional local symbol for numbered label (used for "1:" definitions).
LLVM_ABI MCSymbolgetDirectionalLocalSymbol (unsigned LocalLabelVal, bool Before)
 Create and return a directional local symbol for numbered label (used for "1b" or 1f" references).
LLVM_ABI MCSymbolgetOrCreateSymbol (const Twine &Name)
 Lookup the symbol inside with the specified Name.
LLVM_ABI MCSymbolparseSymbol (const Twine &Name)
 Variant of getOrCreateSymbol that handles backslash-escaped symbols.
LLVM_ABI MCSymbolgetOrCreateFrameAllocSymbol (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 MCSymbolgetOrCreateParentFrameOffsetSymbol (const Twine &FuncName)
LLVM_ABI MCSymbolgetOrCreateLSDASymbol (const Twine &FuncName)
LLVM_ABI MCSymbollookupSymbol (const Twine &Name) const
 Get the symbol for Name, or null.
LLVM_ABI MCSymbolcloneSymbol (MCSymbol &Sym)
 Clone a symbol for the .set directive, replacing it in the symbol table.
LLVM_ABI void setSymbolValue (MCStreamer &Streamer, const Twine &Sym, uint64_t Val)
 Set value for a symbol.
const SymbolTablegetSymbols () const
 getSymbols - Get a reference for the symbol table for clients that want to, for example, iterate over all symbols.
MCSymbolgetInlineAsmLabel (StringRef Name) const
 isInlineAsmLabel - Return true if the name is a label referenced in inline assembly.
LLVM_ABI void registerInlineAsmLabel (MCSymbol *Sym)
 registerInlineAsmLabel - Records that the name is a label referenced in inline assembly.
LLVM_ABI wasm::WasmSignaturecreateWasmSignature ()
 Allocates and returns a new WasmSignature instance (with empty parameter and return type lists).
Section Management
LLVM_ABI MCSectionMachOgetMachOSection (StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
 Return the MCSection for the specified mach-o section.
MCSectionMachOgetMachOSection (StringRef Segment, StringRef Section, unsigned TypeAndAttributes, SectionKind K, const char *BeginSymName=nullptr)
MCSectionELFgetELFSection (const Twine &Section, unsigned Type, unsigned Flags)
MCSectionELFgetELFSection (const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize)
MCSectionELFgetELFSection (const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize, const Twine &Group, bool IsComdat)
LLVM_ABI MCSectionELFgetELFSection (const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize, const Twine &Group, bool IsComdat, unsigned UniqueID, const MCSymbolELF *LinkedToSym)
LLVM_ABI MCSectionELFgetELFSection (const Twine &Section, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, bool IsComdat, unsigned UniqueID, const MCSymbolELF *LinkedToSym)
LLVM_ABI MCSectionELFgetELFNamedSection (const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, unsigned EntrySize=0)
 Get a section with the provided group identifier.
LLVM_ABI MCSectionELFcreateELFRelSection (const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection)
LLVM_ABI MCSectionELFcreateELFGroupSection (const MCSymbolELF *Group, bool IsComdat)
LLVM_ABI void recordELFMergeableSectionInfo (StringRef SectionName, unsigned Flags, unsigned UniqueID, unsigned EntrySize)
LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix (StringRef Name)
LLVM_ABI bool isELFGenericMergeableSection (StringRef Name)
LLVM_ABI std::optional< unsignedgetELFUniqueIDForEntsize (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 MCSectionGOFFgetGOFFSection (SectionKind Kind, StringRef Name, GOFF::SDAttr SDAttributes)
LLVM_ABI MCSectionGOFFgetGOFFSection (SectionKind Kind, StringRef Name, GOFF::EDAttr EDAttributes, MCSection *Parent)
LLVM_ABI MCSectionGOFFgetGOFFSection (SectionKind Kind, StringRef Name, GOFF::PRAttr PRAttributes, MCSection *Parent)
LLVM_ABI MCSectionCOFFgetCOFFSection (StringRef Section, unsigned Characteristics, StringRef COMDATSymName, int Selection, unsigned UniqueID=MCSection::NonUniqueID)
LLVM_ABI MCSectionCOFFgetCOFFSection (StringRef Section, unsigned Characteristics)
LLVM_ABI MCSectionCOFFgetAssociativeCOFFSection (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 MCSectionSPIRVgetSPIRVSection ()
MCSectionWasmgetWasmSection (const Twine &Section, SectionKind K, unsigned Flags=0)
LLVM_ABI MCSectionWasmgetWasmSection (const Twine &Section, SectionKind K, unsigned Flags, const Twine &Group, unsigned UniqueID)
LLVM_ABI MCSectionWasmgetWasmSection (const Twine &Section, SectionKind K, unsigned Flags, const MCSymbolWasm *Group, unsigned UniqueID)
LLVM_ABI MCSectionDXContainergetDXContainerSection (StringRef Section, SectionKind K)
 Get the section for the provided Section name.
LLVM_ABI bool hasXCOFFSection (StringRef Section, XCOFF::CsectProperties CsectProp) const
LLVM_ABI MCSectionXCOFFgetXCOFFSection (StringRef Section, SectionKind K, std::optional< XCOFF::CsectProperties > CsectProp=std::nullopt, bool MultiSymbolsAllowed=false, std::optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=std::nullopt)
LLVM_ABI MCSubtargetInfogetSubtargetCopy (const MCSubtargetInfo &STI)
uint8_t getBBAddrMapVersion () const
Dwarf Management
StringRef getCompilationDir () const
 Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setCompilationDir before calling this function.
void setCompilationDir (StringRef S)
 Set the compilation directory for DW_AT_comp_dir.
LLVM_ABI void addDebugPrefixMapEntry (const std::string &From, const std::string &To)
 Add an entry to the debug prefix map.
LLVM_ABI void remapDebugPath (SmallVectorImpl< char > &Path)
 Remap one path in-place as per the debug prefix map.
LLVM_ABI void RemapDebugPaths ()
const std::string & getMainFileName () const
 Get the main file name for use in error messages and debug info.
void setMainFileName (StringRef S)
 Set the main file name and override the default.
LLVM_ABI Expected< unsignedgetDwarfFile (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 bool isValidDwarfFileNumber (unsigned FileNumber, unsigned CUID=0)
 isValidDwarfFileNumber - takes a dwarf file number and returns true if it currently is assigned and false otherwise.
const std::map< unsigned, MCDwarfLineTable > & getMCDwarfLineTables () const
MCDwarfLineTablegetMCDwarfLineTable (unsigned CUID)
const MCDwarfLineTablegetMCDwarfLineTable (unsigned CUID) const
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles (unsigned CUID=0)
const SmallVectorImpl< std::string > & getMCDwarfDirs (unsigned CUID=0)
unsigned getDwarfCompileUnitID ()
void setDwarfCompileUnitID (unsigned CUIndex)
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.
bool isDwarfMD5UsageConsistent (unsigned CUID) const
 Reports whether MD5 checksum usage is consistent (all-or-none).
void setCurrentDwarfLoc (unsigned FileNum, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator)
 Saves the information from the currently parsed dwarf .loc directive and sets DwarfLocSeen.
void clearDwarfLocSeen ()
bool getDwarfLocSeen ()
const MCDwarfLocgetCurrentDwarfLoc ()
bool getGenDwarfForAssembly ()
void setGenDwarfForAssembly (bool Value)
unsigned getGenDwarfFileNumber ()
LLVM_ABI EmitDwarfUnwindType emitDwarfUnwindInfo () const
LLVM_ABI bool emitCompactUnwindNonCanonical () const
void setGenDwarfFileNumber (unsigned FileNumber)
LLVM_ABI void setGenDwarfRootFile (StringRef FileName, StringRef Buffer)
 Specifies information about the "root file" for assembler clients (e.g., llvm-mc).
const SetVector< MCSection * > & getGenDwarfSectionSyms ()
bool addGenDwarfSection (MCSection *Sec)
LLVM_ABI void finalizeDwarfSections (MCStreamer &MCOS)
 Remove empty sections from SectionsForRanges, to avoid generating useless debug info for them.
const std::vector< MCGenDwarfLabelEntry > & getMCGenDwarfLabelEntries () const
void addMCGenDwarfLabelEntry (const MCGenDwarfLabelEntry &E)
void setDwarfDebugFlags (StringRef S)
StringRef getDwarfDebugFlags ()
void setDwarfDebugProducer (StringRef S)
StringRef getDwarfDebugProducer ()
void setDwarfFormat (dwarf::DwarfFormat f)
dwarf::DwarfFormat getDwarfFormat () const
void setDwarfVersion (uint16_t v)
uint16_t getDwarfVersion () const

Detailed Description

Context object for machine code objects.

This class owns all of the sections that it creates.

Definition at line 83 of file MCContext.h.

Member Typedef Documentation

◆ DiagHandlerTy

Initial value:
std::function<void(const SMDiagnostic &, bool, const SourceMgr &,
std::vector<const MDNode *> &)>
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition SourceMgr.h:282
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:32

Definition at line 86 of file MCContext.h.

◆ SymbolTable

Member Enumeration Documentation

◆ Environment

Enumerator
IsMachO 
IsELF 
IsGOFF 
IsCOFF 
IsSPIRV 
IsWasm 
IsXCOFF 
IsDXContainer 

Definition at line 89 of file MCContext.h.

Constructor & Destructor Documentation

◆ MCContext() [1/2]

◆ MCContext() [2/2]

llvm::MCContext::MCContext ( const MCContext & )
delete

References MCContext().

◆ ~MCContext()

MCContext::~MCContext ( )

Definition at line 120 of file MCContext.cpp.

References reset().

Member Function Documentation

◆ addDebugPrefixMapEntry()

void MCContext::addDebugPrefixMapEntry ( const std::string & From,
const std::string & To )

Add an entry to the debug prefix map.

Definition at line 946 of file MCContext.cpp.

◆ addGenDwarfSection()

bool llvm::MCContext::addGenDwarfSection ( MCSection * Sec)
inline

Definition at line 793 of file MCContext.h.

◆ addMCGenDwarfLabelEntry()

void llvm::MCContext::addMCGenDwarfLabelEntry ( const MCGenDwarfLabelEntry & E)
inline

Definition at line 803 of file MCContext.h.

References E().

Referenced by llvm::MCGenDwarfLabelEntry::Make().

◆ allocate()

void * llvm::MCContext::allocate ( unsigned Size,
unsigned Align = 8 )
inline

Definition at line 831 of file MCContext.h.

References Size.

◆ allocateString()

StringRef llvm::MCContext::allocateString ( StringRef s)
inline

Allocates a copy of the given string on the allocator managed by this context and returns the result.

Definition at line 839 of file MCContext.h.

References llvm::StringSaver::save().

◆ clearDwarfLocSeen()

void llvm::MCContext::clearDwarfLocSeen ( )
inline

◆ cloneSymbol()

MCSymbol * MCContext::cloneSymbol ( MCSymbol & Sym)

Clone a symbol for the .set directive, replacing it in the symbol table.

Existing references to the original symbol remain unchanged, and the original symbol is not emitted to the symbol table.

Definition at line 308 of file MCContext.cpp.

References getObjectFileType(), IsCOFF, IsELF, IsMachO, llvm::MCSymbol::IsTemporary, llvm::reportFatalUsageError(), and llvm::MCSymbol::setIsRegistered().

Referenced by llvm::MCParserUtils::parseAssignmentExpression().

◆ createBlockSymbol()

MCSymbol * MCContext::createBlockSymbol ( const Twine & Name,
bool AlwaysEmit = false )

Get or create a symbol for a basic block.

For non-always-emit symbols, this behaves like createTempSymbol, except that it uses the PrivateLabelPrefix instead of the PrivateGlobalPrefix. When AlwaysEmit is true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.

Definition at line 372 of file MCContext.cpp.

References getOrCreateSymbol().

Referenced by llvm::MachineBasicBlock::getEndSymbol().

◆ createDirectionalLocalSymbol()

MCSymbol * MCContext::createDirectionalLocalSymbol ( unsigned LocalLabelVal)

Create the definition of a directional local symbol for numbered label (used for "1:" definitions).

Definition at line 426 of file MCContext.cpp.

◆ createELFGroupSection()

MCSectionELF * MCContext::createELFGroupSection ( const MCSymbolELF * Group,
bool IsComdat )

Definition at line 670 of file MCContext.cpp.

References llvm::MCSection::NonUniqueID, and llvm::ELF::SHT_GROUP.

◆ createELFRelSection()

MCSectionELF * MCContext::createELFRelSection ( const Twine & Name,
unsigned Type,
unsigned Flags,
unsigned EntrySize,
const MCSymbolELF * Group,
const MCSectionELF * RelInfoSection )

Definition at line 583 of file MCContext.cpp.

References llvm::MCSection::getBeginSymbol(), and I.

◆ createLinkerPrivateSymbol()

MCSymbol * MCContext::createLinkerPrivateSymbol ( const Twine & Name)

Definition at line 387 of file MCContext.cpp.

Referenced by createLinkerPrivateTempSymbol().

◆ createLinkerPrivateTempSymbol()

MCSymbol * MCContext::createLinkerPrivateTempSymbol ( )

Create a new linker temporary symbol with the specified prefix (Name) or "tmp".

This creates a "l"-prefixed symbol for Mach-O and is identical to createNamedTempSymbol for other object file formats.

Definition at line 383 of file MCContext.cpp.

References createLinkerPrivateSymbol().

◆ createLocalSymbol()

MCSymbol * MCContext::createLocalSymbol ( StringRef Name)

Create a local, non-temporary symbol like an ELF mapping symbol.

Calling the function with the same name will generate new, unique instances.

Definition at line 399 of file MCContext.cpp.

◆ createMCInst()

MCInst * MCContext::createMCInst ( )

Create and return a new MC instruction.

Definition at line 195 of file MCContext.cpp.

Referenced by llvm::HexagonLowerToMC().

◆ createNamedTempSymbol() [1/2]

MCSymbol * MCContext::createNamedTempSymbol ( )

Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.

This is rarely used.

Definition at line 395 of file MCContext.cpp.

References createNamedTempSymbol().

Referenced by createNamedTempSymbol().

◆ createNamedTempSymbol() [2/2]

MCSymbol * MCContext::createNamedTempSymbol ( const Twine & Name)

Definition at line 367 of file MCContext.cpp.

◆ createTempSymbol() [1/2]

◆ createTempSymbol() [2/2]

MCSymbol * MCContext::createTempSymbol ( const Twine & Name,
bool AlwaysAddSuffix = true )

Definition at line 360 of file MCContext.cpp.

◆ createWasmSignature()

wasm::WasmSignature * MCContext::createWasmSignature ( )

Allocates and returns a new WasmSignature instance (with empty parameter and return type lists).

Definition at line 480 of file MCContext.cpp.

◆ deallocate()

void llvm::MCContext::deallocate ( void * Ptr)
inline

Definition at line 835 of file MCContext.h.

References Ptr.

◆ defineMacro()

void llvm::MCContext::defineMacro ( StringRef Name,
MCAsmMacro Macro )
inline

Definition at line 853 of file MCContext.h.

References llvm::Macro.

◆ diagnose()

void MCContext::diagnose ( const SMDiagnostic & SMD)

Definition at line 1077 of file MCContext.cpp.

References assert(), and llvm_unreachable.

◆ emitCompactUnwindNonCanonical()

bool MCContext::emitCompactUnwindNonCanonical ( ) const

◆ emitDwarfUnwindInfo()

EmitDwarfUnwindType MCContext::emitDwarfUnwindInfo ( ) const

Definition at line 986 of file MCContext.cpp.

References llvm::Default.

◆ finalizeDwarfSections()

void MCContext::finalizeDwarfSections ( MCStreamer & MCOS)

Remove empty sections from SectionsForRanges, to avoid generating useless debug info for them.

Definition at line 1062 of file MCContext.cpp.

References llvm::MCStreamer::mayHaveInstructions().

Referenced by llvm::MCGenDwarfInfo::Emit().

◆ getAsmInfo()

◆ getAssociativeCOFFSection()

MCSectionCOFF * MCContext::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.

For example, to create a debug info section associated with an inline function, pass the normal debug info section as Sec and the function symbol as KeySym.

Definition at line 799 of file MCContext.cpp.

References llvm::MCSectionCOFF::getCharacteristics(), getCOFFSection(), llvm::MCSection::getName(), llvm::MCSymbol::getName(), llvm::COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE, llvm::COFF::IMAGE_SCN_LNK_COMDAT, and llvm::MCSection::NonUniqueID.

◆ getBBAddrMapVersion()

uint8_t llvm::MCContext::getBBAddrMapVersion ( ) const
inline

Definition at line 672 of file MCContext.h.

◆ getCOFFSection() [1/2]

MCSectionCOFF * MCContext::getCOFFSection ( StringRef Section,
unsigned Characteristics )

Definition at line 793 of file MCContext.cpp.

References getCOFFSection(), and llvm::MCSection::NonUniqueID.

◆ getCOFFSection() [2/2]

◆ getCompilationDir()

StringRef llvm::MCContext::getCompilationDir ( ) const
inline

Get the compilation directory for DW_AT_comp_dir The compilation directory should be set with setCompilationDir before calling this function.

If it is unset, an empty string will be returned.

Definition at line 682 of file MCContext.h.

Referenced by EmitGenDwarfAbbrev(), EmitGenDwarfInfo(), and setGenDwarfRootFile().

◆ getCurrentDwarfLoc()

const MCDwarfLoc & llvm::MCContext::getCurrentDwarfLoc ( )
inline

◆ getCVContext()

◆ getDirectionalLocalSymbol()

MCSymbol * MCContext::getDirectionalLocalSymbol ( unsigned LocalLabelVal,
bool Before )

Create and return a directional local symbol for numbered label (used for "1b" or 1f" references).

Definition at line 431 of file MCContext.cpp.

◆ getDwarfCompileUnitID()

unsigned llvm::MCContext::getDwarfCompileUnitID ( )
inline

Definition at line 735 of file MCContext.h.

Referenced by llvm::MCDwarfLineEntry::make().

◆ getDwarfDebugFlags()

StringRef llvm::MCContext::getDwarfDebugFlags ( )
inline

Definition at line 808 of file MCContext.h.

Referenced by EmitGenDwarfAbbrev(), and EmitGenDwarfInfo().

◆ getDwarfDebugProducer()

StringRef llvm::MCContext::getDwarfDebugProducer ( )
inline

Definition at line 811 of file MCContext.h.

Referenced by EmitGenDwarfInfo().

◆ getDwarfFile()

Expected< unsigned > MCContext::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.

getDwarfFile - takes a file name and number to place in the dwarf file and directory tables.

If the file number has already been allocated it is an error and zero is returned and the client reports the error, else the allocated file number is returned. The file numbers may be in any order.

Definition at line 1039 of file MCContext.cpp.

References llvm::MCDwarfLineTable::tryGetFile().

Referenced by llvm::MCStreamer::tryEmitDwarfFileDirective().

◆ getDwarfFormat()

◆ getDwarfLocSeen()

bool llvm::MCContext::getDwarfLocSeen ( )
inline

Definition at line 772 of file MCContext.h.

Referenced by llvm::MCDwarfLineEntry::make().

◆ getDwarfVersion()

◆ getDXContainerSection()

MCSectionDXContainer * MCContext::getDXContainerSection ( StringRef Section,
SectionKind K )

Get the section for the provided Section name.

Definition at line 923 of file MCContext.cpp.

Referenced by DXILTargetObjectFile::getExplicitSectionGlobal().

◆ getELFNamedSection()

MCSectionELF * MCContext::getELFNamedSection ( const Twine & Prefix,
const Twine & Suffix,
unsigned Type,
unsigned Flags,
unsigned EntrySize = 0 )

Get a section with the provided group identifier.

This section is named by concatenating Prefix with '.' then Suffix. The Type describes the type of the section and Flags are used to further configure this named section.

Definition at line 595 of file MCContext.cpp.

References getELFSection().

Referenced by llvm::TargetLoweringObjectFileELF::emitPersonalityValue().

◆ getELFSection() [1/5]

◆ getELFSection() [2/5]

MCSectionELF * llvm::MCContext::getELFSection ( const Twine & Section,
unsigned Type,
unsigned Flags,
unsigned EntrySize )
inline

Definition at line 558 of file MCContext.h.

References getELFSection(), and llvm::MCSection::NonUniqueID.

◆ getELFSection() [3/5]

◆ getELFSection() [4/5]

MCSectionELF * llvm::MCContext::getELFSection ( const Twine & Section,
unsigned Type,
unsigned Flags,
unsigned EntrySize,
const Twine & Group,
bool IsComdat )
inline

Definition at line 564 of file MCContext.h.

References getELFSection(), and llvm::MCSection::NonUniqueID.

◆ getELFSection() [5/5]

MCSectionELF * MCContext::getELFSection ( const Twine & Section,
unsigned Type,
unsigned Flags,
unsigned EntrySize,
const Twine & Group,
bool IsComdat,
unsigned UniqueID,
const MCSymbolELF * LinkedToSym )

◆ getELFUniqueIDForEntsize()

std::optional< unsigned > MCContext::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.

Definition at line 708 of file MCContext.cpp.

References I.

◆ getGenDwarfFileNumber()

unsigned llvm::MCContext::getGenDwarfFileNumber ( )
inline

Definition at line 777 of file MCContext.h.

Referenced by llvm::MCGenDwarfLabelEntry::Make().

◆ getGenDwarfForAssembly()

bool llvm::MCContext::getGenDwarfForAssembly ( )
inline

Definition at line 775 of file MCContext.h.

◆ getGenDwarfSectionSyms()

const SetVector< MCSection * > & llvm::MCContext::getGenDwarfSectionSyms ( )
inline

◆ getGOFFSection() [1/3]

MCSectionGOFF * MCContext::getGOFFSection ( SectionKind Kind,
StringRef Name,
GOFF::EDAttr EDAttributes,
MCSection * Parent )

Definition at line 744 of file MCContext.cpp.

References llvm::GOFF::EDAttr::BindAlgorithm, and llvm::GOFF::ESD_BA_Merge.

◆ getGOFFSection() [2/3]

MCSectionGOFF * MCContext::getGOFFSection ( SectionKind Kind,
StringRef Name,
GOFF::PRAttr PRAttributes,
MCSection * Parent )

Definition at line 752 of file MCContext.cpp.

◆ getGOFFSection() [3/3]

MCSectionGOFF * MCContext::getGOFFSection ( SectionKind Kind,
StringRef Name,
GOFF::SDAttr SDAttributes )

Definition at line 738 of file MCContext.cpp.

◆ getInlineAsmLabel()

MCSymbol * llvm::MCContext::getInlineAsmLabel ( StringRef Name) const
inline

isInlineAsmLabel - Return true if the name is a label referenced in inline assembly.

Definition at line 522 of file MCContext.h.

◆ getInlineSourceManager()

SourceMgr * llvm::MCContext::getInlineSourceManager ( )
inline

Definition at line 404 of file MCContext.h.

◆ getLocInfos()

std::vector< const MDNode * > & llvm::MCContext::getLocInfos ( )
inline

Definition at line 405 of file MCContext.h.

◆ getMachOSection() [1/2]

MCSectionMachO * llvm::MCContext::getMachOSection ( StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
SectionKind K,
const char * BeginSymName = nullptr )
inline

Definition at line 546 of file MCContext.h.

References getMachOSection().

◆ getMachOSection() [2/2]

MCSectionMachO * MCContext::getMachOSection ( StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K,
const char * BeginSymName = nullptr )

◆ getMainFileName()

const std::string & llvm::MCContext::getMainFileName ( ) const
inline

Get the main file name for use in error messages and debug info.

This can be set to ensure we've got the correct file name after preprocessing or for -save-temps.

Definition at line 700 of file MCContext.h.

Referenced by setGenDwarfRootFile().

◆ getMCDwarfDirs()

const SmallVectorImpl< std::string > & llvm::MCContext::getMCDwarfDirs ( unsigned CUID = 0)
inline

Definition at line 731 of file MCContext.h.

References llvm::MCDwarfLineTable::getMCDwarfDirs(), and getMCDwarfLineTable().

Referenced by EmitGenDwarfInfo().

◆ getMCDwarfFiles()

const SmallVectorImpl< MCDwarfFile > & llvm::MCContext::getMCDwarfFiles ( unsigned CUID = 0)
inline

Definition at line 727 of file MCContext.h.

References llvm::MCDwarfLineTable::getMCDwarfFiles(), and getMCDwarfLineTable().

Referenced by EmitGenDwarfInfo().

◆ getMCDwarfLineTable() [1/2]

◆ getMCDwarfLineTable() [2/2]

const MCDwarfLineTable & llvm::MCContext::getMCDwarfLineTable ( unsigned CUID) const
inline

Definition at line 721 of file MCContext.h.

References assert(), and I.

◆ getMCDwarfLineTables()

const std::map< unsigned, MCDwarfLineTable > & llvm::MCContext::getMCDwarfLineTables ( ) const
inline

Definition at line 713 of file MCContext.h.

Referenced by llvm::MCDwarfLineTable::emit().

◆ getMCGenDwarfLabelEntries()

const std::vector< MCGenDwarfLabelEntry > & llvm::MCContext::getMCGenDwarfLabelEntries ( ) const
inline

Definition at line 799 of file MCContext.h.

Referenced by EmitGenDwarfInfo().

◆ getMCPseudoProbeTable()

MCPseudoProbeTable & llvm::MCContext::getMCPseudoProbeTable ( )
inline

Definition at line 859 of file MCContext.h.

Referenced by llvm::MCPseudoProbeTable::emit().

◆ getObjectFileInfo()

◆ getObjectFileType()

Environment llvm::MCContext::getObjectFileType ( ) const
inline

Definition at line 392 of file MCContext.h.

Referenced by cloneSymbol().

◆ getOrCreateFrameAllocSymbol()

MCSymbol * MCContext::getOrCreateFrameAllocSymbol ( const Twine & FuncName,
unsigned Idx )

Gets a symbol that will be defined to the final stack offset of a local variable after codegen.

Parameters
Idx- The index of a local variable passed to @llvm.localescape.

Definition at line 254 of file MCContext.cpp.

References getOrCreateSymbol().

◆ getOrCreateLSDASymbol()

MCSymbol * MCContext::getOrCreateLSDASymbol ( const Twine & FuncName)

Definition at line 265 of file MCContext.cpp.

References getOrCreateSymbol().

◆ getOrCreateParentFrameOffsetSymbol()

MCSymbol * MCContext::getOrCreateParentFrameOffsetSymbol ( const Twine & FuncName)

Definition at line 260 of file MCContext.cpp.

References getOrCreateSymbol().

Referenced by recoverFramePointer().

◆ getOrCreateSymbol()

MCSymbol * MCContext::getOrCreateSymbol ( const Twine & Name)

Lookup the symbol inside with the specified Name.

If it exists, return it. If not, create a forward reference and return it.

Parameters
Name- The symbol name, which must be unique across all symbols.

Definition at line 203 of file MCContext.cpp.

References assert(), llvm::StringRef::empty(), and llvm::StringRef::starts_with().

Referenced by llvm::MipsTargetLowering::AdjustInstrPostInstrSelection(), createBlockSymbol(), llvm::AMDGPUTargetELFStreamer::EmitAMDGPUSymbolType(), EmitCamlGlobal(), llvm::MCStreamer::emitCFILabelDirective(), llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::TargetLoweringObjectFileELF::emitPersonalityValue(), llvm::MCDwarfLineTable::endCurrentSeqAndEmitLineStreamLabel(), llvm::RecordStreamer::flushSymverDirectives(), llvm::TargetLoweringObjectFileELF::getCFIPersonalitySymbol(), getCOFFSection(), llvm::MachineBasicBlock::getEHContSymbol(), getELFSection(), llvm::TargetLoweringObjectFileXCOFF::getFunctionEntryPointSymbol(), llvm::PPCFunctionInfo::getGlobalEPSymbol(), llvm::PPCFunctionInfo::getLocalEPSymbol(), llvm::MCResourceInfo::getMaxAGPRSymbol(), llvm::MCResourceInfo::getMaxNamedBarrierSymbol(), llvm::MCResourceInfo::getMaxSGPRSymbol(), llvm::MCResourceInfo::getMaxVGPRSymbol(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), getOrCreateFrameAllocSymbol(), getOrCreateLSDASymbol(), getOrCreateParentFrameOffsetSymbol(), llvm::PPCFunctionInfo::getPICOffsetSymbol(), llvm::MCResourceInfo::getSymbol(), llvm::TargetMachine::getSymbol(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::PPCFunctionInfo::getTOCOffsetSymbol(), getWasmSection(), getXCOFFSection(), parseSymbol(), llvm::FaultMaps::serializeToFaultMapSection(), llvm::StackMaps::serializeToStackMapSection(), setSymbolValue(), and smallData().

◆ getRegisterInfo()

◆ getSecureLog()

raw_fd_ostream * llvm::MCContext::getSecureLog ( )
inline

Definition at line 822 of file MCContext.h.

◆ getSecureLogFile()

StringRef llvm::MCContext::getSecureLogFile ( )
inline

Definition at line 821 of file MCContext.h.

◆ getSecureLogUsed()

bool llvm::MCContext::getSecureLogUsed ( )
inline

Definition at line 828 of file MCContext.h.

◆ getSourceManager()

const SourceMgr * llvm::MCContext::getSourceManager ( ) const
inline

Definition at line 401 of file MCContext.h.

Referenced by llvm::MCObjectStreamer::emitFill().

◆ getSPIRVSection()

MCSectionSPIRV * MCContext::getSPIRVSection ( )

Definition at line 918 of file MCContext.cpp.

◆ getSubtargetCopy()

MCSubtargetInfo & MCContext::getSubtargetCopy ( const MCSubtargetInfo & STI)

Definition at line 942 of file MCContext.cpp.

Referenced by llvm::MCTargetAsmParser::copySTI().

◆ getSubtargetInfo()

const MCSubtargetInfo * llvm::MCContext::getSubtargetInfo ( ) const
inline

Definition at line 418 of file MCContext.h.

Referenced by llvm::CSKYConstantPool::emitAll().

◆ getSwift5ReflectionSegmentName()

const StringRef & llvm::MCContext::getSwift5ReflectionSegmentName ( ) const
inline

Definition at line 397 of file MCContext.h.

◆ getSymbols()

const SymbolTable & llvm::MCContext::getSymbols ( ) const
inline

getSymbols - Get a reference for the symbol table for clients that want to, for example, iterate over all symbols.

'const' because we still want any modifications to the table itself to use the MCContext APIs.

Definition at line 518 of file MCContext.h.

◆ getTargetOptions()

const MCTargetOptions * llvm::MCContext::getTargetOptions ( ) const
inline

Definition at line 420 of file MCContext.h.

◆ getTargetTriple()

const Triple & llvm::MCContext::getTargetTriple ( ) const
inline

◆ getWasmSection() [1/3]

MCSectionWasm * MCContext::getWasmSection ( const Twine & Section,
SectionKind K,
unsigned Flags,
const MCSymbolWasm * Group,
unsigned UniqueID )

◆ getWasmSection() [2/3]

◆ getWasmSection() [3/3]

◆ getXCOFFSection()

◆ hadError()

bool llvm::MCContext::hadError ( )
inline

Definition at line 843 of file MCContext.h.

◆ hasXCOFFSection()

bool MCContext::hasXCOFFSection ( StringRef Section,
XCOFF::CsectProperties CsectProp ) const

Definition at line 863 of file MCContext.cpp.

References llvm::XCOFF::CsectProperties::MappingClass.

◆ initInlineSourceManager()

void MCContext::initInlineSourceManager ( )

Definition at line 128 of file MCContext.cpp.

◆ isDwarfMD5UsageConsistent()

bool llvm::MCContext::isDwarfMD5UsageConsistent ( unsigned CUID) const
inline

Reports whether MD5 checksum usage is consistent (all-or-none).

Definition at line 750 of file MCContext.h.

References getMCDwarfLineTable(), and llvm::MCDwarfLineTable::isMD5UsageConsistent().

◆ isELF()

bool llvm::MCContext::isELF ( ) const
inline

Definition at line 393 of file MCContext.h.

References IsELF.

◆ isELFGenericMergeableSection()

bool MCContext::isELFGenericMergeableSection ( StringRef Name)

Definition at line 702 of file MCContext.cpp.

References isELFImplicitMergeableSectionNamePrefix().

Referenced by recordELFMergeableSectionInfo().

◆ isELFImplicitMergeableSectionNamePrefix()

bool MCContext::isELFImplicitMergeableSectionNamePrefix ( StringRef Name)

Definition at line 697 of file MCContext.cpp.

Referenced by isELFGenericMergeableSection().

◆ isMachO()

bool llvm::MCContext::isMachO ( ) const
inline

Definition at line 394 of file MCContext.h.

References IsMachO.

◆ isValidDwarfFileNumber()

bool MCContext::isValidDwarfFileNumber ( unsigned FileNumber,
unsigned CUID = 0 )

isValidDwarfFileNumber - takes a dwarf file number and returns true if it currently is assigned and false otherwise.

Definition at line 1050 of file MCContext.cpp.

References getDwarfVersion(), llvm::MCDwarfLineTable::getMCDwarfFiles(), and getMCDwarfLineTable().

◆ isXCOFF()

bool llvm::MCContext::isXCOFF ( ) const
inline

Definition at line 395 of file MCContext.h.

References IsXCOFF.

◆ lookupMacro()

MCAsmMacro * llvm::MCContext::lookupMacro ( StringRef Name)
inline

Definition at line 848 of file MCContext.h.

References I.

◆ lookupSymbol()

MCSymbol * MCContext::lookupSymbol ( const Twine & Name) const

Get the symbol for Name, or null.

Definition at line 464 of file MCContext.cpp.

Referenced by llvm::MCParserUtils::parseAssignmentExpression().

◆ operator=()

MCContext & llvm::MCContext::operator= ( const MCContext & )
delete

References LLVM_ABI, and MCContext().

◆ parseSymbol()

MCSymbol * MCContext::parseSymbol ( const Twine & Name)

◆ recordELFMergeableSectionInfo()

void MCContext::recordELFMergeableSectionInfo ( StringRef SectionName,
unsigned Flags,
unsigned UniqueID,
unsigned EntrySize )

◆ registerInlineAsmLabel()

void MCContext::registerInlineAsmLabel ( MCSymbol * Sym)

registerInlineAsmLabel - Records that the name is a label referenced in inline assembly.

Definition at line 476 of file MCContext.cpp.

References llvm::MCSymbol::getName().

Referenced by EmitInlineAsmStr().

◆ remapDebugPath()

void MCContext::remapDebugPath ( SmallVectorImpl< char > & Path)

Remap one path in-place as per the debug prefix map.

Definition at line 951 of file MCContext.cpp.

References llvm::sys::path::replace_path_prefix(), and llvm::reverse().

Referenced by RemapDebugPaths().

◆ RemapDebugPaths()

void MCContext::RemapDebugPaths ( )

Definition at line 957 of file MCContext.cpp.

References P, and remapDebugPath().

Referenced by llvm::MCObjectStreamer::finishImpl().

◆ reportError()

void MCContext::reportError ( SMLoc L,
const Twine & Msg )

Definition at line 1122 of file MCContext.cpp.

References D(), llvm::SourceMgr::DK_Error, and llvm::SourceMgr::GetMessage().

Referenced by ARM64EmitUnwindInfo(), ARMEmitUnwindInfo(), checkARM64Instructions(), checkARMInstructions(), llvm::MCStreamer::checkCVLocSection(), llvm::ELFObjectWriter::checkRelocation(), llvm::MCStreamer::emitCFIStartProc(), llvm::MCStreamer::emitCVInlineSiteIdDirective(), llvm::SystemZHLASMAsmStreamer::emitHLASMValueImpl(), llvm::MCStreamer::emitLabel(), llvm::MCObjectStreamer::emitRelocDirective(), llvm::MCELFStreamer::emitSymbolAttribute(), EmitUnwindInfo(), llvm::MCObjectStreamer::emitValueImpl(), llvm::MCELFStreamer::emitWeakReference(), llvm::MCStreamer::emitWinCFIAllocStack(), llvm::MCStreamer::emitWinCFIBeginEpilogue(), llvm::MCStreamer::emitWinCFIEndChained(), llvm::MCStreamer::emitWinCFIEndEpilogue(), llvm::MCStreamer::emitWinCFIEndProc(), llvm::MCStreamer::emitWinCFIFuncletOrFuncEnd(), llvm::MCStreamer::emitWinCFIPushFrame(), llvm::MCStreamer::emitWinCFISaveReg(), llvm::MCStreamer::emitWinCFISaveXMM(), llvm::MCStreamer::emitWinCFISetFrame(), llvm::MCStreamer::emitWinCFIStartProc(), llvm::MCStreamer::emitWinCFIUnwindV2Start(), llvm::MCStreamer::emitWinCFIUnwindVersion(), llvm::MCStreamer::emitWinEHHandler(), llvm::MCStreamer::emitWinEHHandlerData(), llvm::MCStreamer::EnsureValidWinFrameInfo(), llvm::RISCVAsmBackend::evaluateFixup(), llvm::MCStreamer::finish(), getCOFFSection(), llvm::X86RegisterInfo::getReservedRegs(), llvm::MCAssembler::layout(), llvm::MachObjectWriter::recordRelocation(), llvm::MCAssembler::reportError(), reportWarning(), llvm::AVRTargetObjectFile::SelectSectionForGlobal(), llvm::MCStreamer::switchSection(), and llvm::MachObjectWriter::writeObject().

◆ reportWarning()

void MCContext::reportWarning ( SMLoc L,
const Twine & Msg )

◆ reset()

void MCContext::reset ( )

reset - return object to right after construction state to prepare to process a new module

Definition at line 137 of file MCContext.cpp.

References defaultDiagHandler(), and DWARF2_FLAG_IS_STMT.

Referenced by ~MCContext().

◆ setCompilationDir()

void llvm::MCContext::setCompilationDir ( StringRef S)
inline

Set the compilation directory for DW_AT_comp_dir.

Definition at line 685 of file MCContext.h.

References llvm::StringRef::str().

◆ setCurrentDwarfLoc()

void llvm::MCContext::setCurrentDwarfLoc ( unsigned FileNum,
unsigned Line,
unsigned Column,
unsigned Flags,
unsigned Isa,
unsigned Discriminator )
inline

Saves the information from the currently parsed dwarf .loc directive and sets DwarfLocSeen.

When the next instruction is assembled an entry in the line number table with this information and the address of the instruction will be created.

Definition at line 758 of file MCContext.h.

Referenced by llvm::MCStreamer::emitDwarfLocDirective().

◆ setDiagnosticHandler()

void llvm::MCContext::setDiagnosticHandler ( DiagHandlerTy DiagHandler)
inline

Definition at line 406 of file MCContext.h.

Referenced by initializeRecordStreamer().

◆ setDwarfCompileUnitID()

void llvm::MCContext::setDwarfCompileUnitID ( unsigned CUIndex)
inline

Definition at line 737 of file MCContext.h.

◆ setDwarfDebugFlags()

void llvm::MCContext::setDwarfDebugFlags ( StringRef S)
inline

Definition at line 807 of file MCContext.h.

◆ setDwarfDebugProducer()

void llvm::MCContext::setDwarfDebugProducer ( StringRef S)
inline

Definition at line 810 of file MCContext.h.

◆ setDwarfFormat()

void llvm::MCContext::setDwarfFormat ( dwarf::DwarfFormat f)
inline

Definition at line 813 of file MCContext.h.

◆ setDwarfVersion()

void llvm::MCContext::setDwarfVersion ( uint16_t v)
inline

Definition at line 816 of file MCContext.h.

◆ setGenDwarfFileNumber()

void llvm::MCContext::setGenDwarfFileNumber ( unsigned FileNumber)
inline

Definition at line 781 of file MCContext.h.

◆ setGenDwarfForAssembly()

void llvm::MCContext::setGenDwarfForAssembly ( bool Value)
inline

Definition at line 776 of file MCContext.h.

◆ setGenDwarfRootFile()

◆ setMainFileName()

void llvm::MCContext::setMainFileName ( StringRef S)
inline

Set the main file name and override the default.

Definition at line 703 of file MCContext.h.

◆ setMCLineTableRootFile()

void llvm::MCContext::setMCLineTableRootFile ( unsigned CUID,
StringRef CompilationDir,
StringRef Filename,
std::optional< MD5::MD5Result > Checksum,
std::optional< StringRef > Source )
inline

Specifies the "root" file and directory of the compilation unit.

These are "file 0" and "directory 0" in DWARF v5.

Definition at line 741 of file MCContext.h.

References getMCDwarfLineTable(), and llvm::MCDwarfLineTable::setRootFile().

Referenced by llvm::MCStreamer::emitDwarfFile0Directive(), and setGenDwarfRootFile().

◆ setObjectFileInfo()

void llvm::MCContext::setObjectFileInfo ( const MCObjectFileInfo * Mofi)
inline

Definition at line 410 of file MCContext.h.

Referenced by initializeRecordStreamer().

◆ setSecureLog()

void llvm::MCContext::setSecureLog ( std::unique_ptr< raw_fd_ostream > Value)
inline

Definition at line 824 of file MCContext.h.

◆ setSecureLogUsed()

void llvm::MCContext::setSecureLogUsed ( bool Value)
inline

Definition at line 829 of file MCContext.h.

◆ setSymbolValue()

void MCContext::setSymbolValue ( MCStreamer & Streamer,
const Twine & Sym,
uint64_t Val )

Set value for a symbol.

Definition at line 470 of file MCContext.cpp.

References llvm::MCConstantExpr::create(), llvm::MCStreamer::emitAssignment(), and getOrCreateSymbol().

◆ setUseNamesOnTempLabels()

void llvm::MCContext::setUseNamesOnTempLabels ( bool Value)
inline

Definition at line 424 of file MCContext.h.

Referenced by MCContext().

◆ undefineMacro()

void llvm::MCContext::undefineMacro ( StringRef Name)
inline

Definition at line 857 of file MCContext.h.


The documentation for this class was generated from the following files: