78 for (
const unsigned char C : Data.
bytes()) {
90 :
Context(Ctx), CurrentWinFrameInfo(nullptr),
91 UseAssemblerInfoForParsing(
false) {
92 SectionStack.
push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
98 DwarfFrameInfos.clear();
99 CurrentWinFrameInfo =
nullptr;
100 WinFrameInfos.clear();
101 SymbolOrdering.
clear();
102 SectionStack.
clear();
103 SectionStack.
push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
117 for (
auto &FI : DwarfFrameInfos)
118 FI.CompactUnwindEncoding =
125 assert(1 <= Size && Size <= 8 &&
"Invalid size");
130 for (
unsigned i = 0; i !=
Size; ++i) {
131 unsigned index = isLittleEndian ? i : (Size - i - 1);
132 buf[i] = uint8_t(Value >> (index * 8));
160 bool IsSectionRelative) {
161 assert((!IsSectionRelative || Size == 4) &&
162 "SectionRelative value requires 4-bytes");
164 if (!IsSectionRelative)
232 unsigned Column,
unsigned Flags,
234 unsigned Discriminator,
251 return !DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End;
257 ".cfi_startproc and .cfi_endproc " 261 return &DwarfFrameInfos.back();
276 unsigned IAFunc,
unsigned IAFile,
277 unsigned IALine,
unsigned IACol,
279 if (
getContext().getCVContext().getCVFunctionInfo(IAFunc) ==
nullptr) {
281 ".cv_func_id or .cv_inline_site_id");
286 FunctionId, IAFunc, IAFile, IALine, IACol);
290 unsigned Line,
unsigned Column,
291 bool PrologueEnd,
bool IsStmt,
300 Loc,
"function id not introduced by .cv_func_id or .cv_inline_site_id");
310 "all .cv_loc directives for a function must be in the same section");
321 unsigned SourceFileId,
322 unsigned SourceLineNum,
327 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
344 SymbolOrdering[
Symbol] = 1 + SymbolOrdering.
size();
372 Loc,
"starting new .cfi frame before finishing the previous one");
388 DwarfFrameInfos.push_back(Frame);
488 CurFrame->
Lsda = Sym;
607 Loc,
".seh_* directives are not supported on this target");
610 if (!CurrentWinFrameInfo || CurrentWinFrameInfo->
End) {
612 Loc,
".seh_ directive must appear within an active frame");
615 return CurrentWinFrameInfo;
622 Loc,
".seh_* directives are not supported on this target");
623 if (CurrentWinFrameInfo && !CurrentWinFrameInfo->
End)
625 Loc,
"Starting a function before ending the previous one!");
629 WinFrameInfos.emplace_back(
630 llvm::make_unique<WinEH::FrameInfo>(Symbol, StartProc));
631 CurrentWinFrameInfo = WinFrameInfos.back().get();
643 CurFrame->
End = Label;
664 WinFrameInfos.emplace_back(llvm::make_unique<WinEH::FrameInfo>(
665 CurFrame->
Function, StartProc, CurFrame));
666 CurrentWinFrameInfo = WinFrameInfos.back().get();
676 Loc,
"End of a chained region outside a chained region!");
680 CurFrame->
End = Label;
691 Loc,
"Chained unwind areas can't have handlers!");
693 if (!Except && !Unwind)
720 const auto *TextSecCOFF = cast<MCSectionCOFF>(TextSec);
721 auto *MainCFISecCOFF = cast<MCSectionCOFF>(MainCFISec);
722 unsigned UniqueID = TextSecCOFF->getOrAssignWinCFISectionID(NextWinCFIID);
728 KeySym = TextSecCOFF->getCOMDATSymbol();
735 (MainCFISecCOFF->getSectionName() +
"$" +
736 TextSecCOFF->getSectionName().split(
'$').second)
750 getContext().getObjectFileInfo()->getPDataSection(),
756 getContext().getObjectFileInfo()->getXDataSection(),
780 Loc,
"frame register and offset can be set at most once");
785 Loc,
"frame offset must be less than or equal to 240");
801 "stack allocation size must be non-zero");
804 Loc,
"stack allocation size is not a multiple of 8");
820 Loc,
"register save offset is not 8 byte aligned");
850 Loc,
"If present, PushMachFrame must be the first UOP");
886 "it (target backend is likely missing an AsmStreamer " 899 if ((!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End) ||
900 (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) {
924 InstPrinter.
printInst(&Inst, OS,
"", STI);
1030 unsigned MaxBytesToEmit) {}
1032 unsigned MaxBytesToEmit) {}
1041 assert(Section &&
"Cannot switch to a null section!");
1043 SectionStack.
back().second = curSection;
1049 if (Sym && !Sym->isInSection())
1081 }
else if (Target.
isTvOS()) {
virtual void EmitBundleUnlock()
Ends a bundle-locked group.
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag)
Note in the output the specified Flag.
const MCAsmInfo * getAsmInfo() const
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
virtual void EmitBundleAlignMode(unsigned AlignPow2)
Set the bundle alignment mode from now on in the section.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Instances of this class represent a uniqued identifier for a section in the current translation unit...
bool doesSetDirectiveSuppressReloc() const
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
MCStreamer(MCContext &Ctx)
bool usesWindowsCFI() const
virtual void EmitCFISameValue(int64_t Register)
virtual void EmitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion)
This implements the CodeView '.cv_def_range' assembler directive.
virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding)
virtual void EmitWinCFIPushReg(unsigned Register, SMLoc Loc=SMLoc())
virtual void EmitSLEB128Value(const MCExpr *Value)
virtual void EmitCFIGnuArgsSize(int64_t Size)
void EmitRawText(const Twine &String)
If this file is backed by a assembly streamer, this dumps the specified string in the output ...
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void EmitSLEB128IntValue(int64_t Value)
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
bool isVariable() const
isVariable - Check if this is a variable symbol.
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc)
Emit some number of copies of Value until the byte offset Offset is reached.
virtual void emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee)
Emit an ELF .symver directive.
virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI)=0
Print the specified MCInst to the specified raw_ostream.
virtual void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0)
Emit a thread local bss (.tbss) symbol.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void redefineIfPossible()
Prepare this symbol to be redefined.
virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc=SMLoc())
virtual void EndCOFFSymbolDef()
Marks the end of the symbol definition.
virtual ~MCTargetStreamer()
MCSection * Section
The section of the first .cv_loc directive used for this function, or null if none has been seen yet...
virtual void EmitULEB128Value(const MCExpr *Value)
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename, MD5::MD5Result *Checksum, Optional< StringRef > Source, unsigned CUID=0)
Specify the "root" file of the compilation, using the ".file 0" extension.
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol)
Emit an weak reference from Alias to Symbol.
void push_back(const T &Elt)
static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg, unsigned Offset)
virtual void EmitWinCFISaveXMM(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Target specific streamer interface.
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
virtual void reset()
State management.
unsigned CurrentCfaRegister
virtual void EmitWindowsUnwindTables()
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol)
Start emitting COFF symbol definition.
virtual void EmitDTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
bool isWatchOS() const
Is this an Apple watchOS triple.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
A raw_ostream that writes to an SmallVector or SmallString.
virtual void EmitCFIRegister(int64_t Register1, int64_t Register2)
virtual void emitExplicitComments()
Emit added explicit comments.
virtual void emitValue(const MCExpr *Value)
virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo)
Emit the absolute difference between two symbols encoded with ULEB128.
virtual void EmitCFIDefCfaOffset(int64_t Offset)
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
StringRef getPrivateGlobalPrefix() const
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
COFF::SymbolStorageClass StorageClass
virtual void EmitCOFFSymbolStorageClass(int StorageClass)
Emit the storage class of the symbol.
std::vector< Instruction > Instructions
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Emit the expression Value into the output as a native integer of the given Size bytes.
virtual void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset)
Emits a COFF image relative relocation.
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
virtual void addExplicitComment(const Twine &T)
Add explicit comment T.
virtual void EmitCFISections(bool EH, bool Debug)
virtual void EmitGPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=GenericSectionID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym...
std::vector< MCCFIInstruction > Instructions
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can't be restored anymore.
virtual void EmitCFIRememberState()
MCContext & getContext() const
virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding)
virtual void EmitGPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
void AssignFragment(MCSymbol *Symbol, MCFragment *Fragment)
Sets the symbol's section.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
virtual void EmitWinCFIEndProc(SMLoc Loc=SMLoc())
virtual void EmitCFIEscape(StringRef Values)
virtual void EmitCOFFSymbolType(int Type)
Emit the type of the symbol.
virtual Expected< unsigned > tryEmitDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, MD5::MD5Result *Checksum=nullptr, Optional< StringRef > Source=None, unsigned CUID=0)
Associate a filename with a specified logical file number.
Base class for the full range of assembler expressions which are needed for parsing.
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc())
Represent a reference to a symbol from inside an expression.
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
iterator_range< const unsigned char * > bytes() const
virtual uint32_t generateCompactUnwindEncoding(ArrayRef< MCCFIInstruction >) const
Generate the compact unwind encoding for the CFI instructions.
Tagged union holding either a T or a Error.
virtual void emitLabel(MCSymbol *Symbol)
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame)
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
MCSymbol * getEndSymbol(MCContext &Ctx)
virtual void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc)
This implements the CodeView '.cv_loc' assembler directive.
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual void EmitWinCFIStartChained(SMLoc Loc=SMLoc())
Context object for machine code objects.
virtual bool EmitCVFileDirective(unsigned FileNo, StringRef Filename, ArrayRef< uint8_t > Checksum, unsigned ChecksumKind)
Associate a filename with a specified logical file number, and also specify that file's checksum info...
static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
virtual void EmitTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (64-bit TP relative) value.
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
virtual void EmitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
const MCExpr * getExpr() const
virtual void EmitCFIRestoreState()
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Instances of this class represent a single low-level machine instruction.
virtual void EmitCFIRestore(int64_t Register)
const char * getData8bitsDirective() const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
This class is intended to be used as a base class for asm properties and features specific to the tar...
virtual void EmitBundleLock(bool AlignToEnd)
The following instructions are a bundle-locked group.
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment)
Emit a local common (.lcomm) symbol.
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register)
.cfi_same_value Current value of Register is the same as in the previous frame.
virtual raw_ostream & GetCommentOS()
Return a raw_ostream that comments can be written to.
void EmitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
static MCCFIInstruction createNegateRAState(MCSymbol *L)
.cfi_negate_ra_state AArch64 negate RA state.
Streaming machine code generation interface.
virtual void EmitWinCFIFuncletOrFuncEnd(SMLoc Loc=SMLoc())
This is used on platforms, such as Windows on ARM64, that require function or funclet sizes to be emi...
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
const FrameInfo * ChainedParent
MCTargetStreamer * getTargetStreamer()
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
The instances of the Type class are immutable: once they are created, they are never changed...
virtual void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView '.cv_linetable' assembler directive.
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code)
MCSection * getAssociatedPDataSection(const MCSection *TextSec)
Get the .pdata section used for the given section.
virtual void EmitSyntaxDirective()
virtual void EmitCFIDefCfaRegister(int64_t Register)
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
const MCObjectFileInfo * getObjectFileInfo() const
void reportError(SMLoc L, const Twine &Msg)
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register...
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register)
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
virtual void EmitRawTextImpl(StringRef String)
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the ...
virtual void EmitWinEHHandlerData(SMLoc Loc=SMLoc())
unsigned getNumOperands() const
virtual void EmitCFIUndefined(int64_t Register)
virtual void EmitCFINegateRAState()
unsigned PersonalityEncoding
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off)
void Finish()
Finish emission of machine code.
virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol)
virtual void EmitWinCFIEndChained(SMLoc Loc=SMLoc())
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
Binary assembler expressions.
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const =0
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
virtual void EmitCOFFSafeSEH(MCSymbol const *Symbol)
virtual void EmitWinCFISetFrame(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
void generateCompactUnwindEncodings(MCAsmBackend *MAB)
MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
static MCSection * getWinCFISection(MCContext &Context, unsigned *NextWinCFIID, MCSection *MainCFISec, const MCSection *TextSec)
virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc=SMLoc())
const std::vector< MCCFIInstruction > & getInitialFrameState() const
static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg, unsigned Offset)
virtual void EmitTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (32-bit TP relative) value.
const MCSymbol * PrologEnd
virtual void InitSections(bool NoExecStack)
Create the default sections and set the initial one.
virtual void EmitCFIReturnColumn(int64_t Register)
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
BlockVerifier::State From
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)
Emit the absolute difference between two symbols.
virtual void EmitCOFFSymbolIndex(MCSymbol const *Symbol)
Emits the symbol table index of a Symbol into the current section.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
virtual void EmitCFIOffset(int64_t Register, int64_t Offset)
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MCFragment * getFragment(bool SetUsed=true) const
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
const MCSection * TextSection
virtual void EmitWinCFIEndProlog(SMLoc Loc=SMLoc())
static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size)
virtual void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
const MCOperand & getOperand(unsigned i) const
virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc=SMLoc())
virtual void EmitVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Specify the Mach-O minimum deployment target version.
Promote Memory to Register
virtual void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
This implements the CodeView '.cv_inline_linetable' assembler directive.
MCSymbol * getBeginSymbol()
const Triple & getTargetTriple() const
virtual void prettyPrintAsm(MCInstPrinter &InstPrinter, raw_ostream &OS, const MCInst &Inst, const MCSubtargetInfo &STI)
StringRef str()
Return a StringRef for the vector contents.
virtual void ChangeSection(MCSection *, const MCExpr *)
Update streamer for a new active section.
void setVariableValue(const MCExpr *Value)
bool hasUnfinishedDwarfFrameInfo()
virtual void changeSection(const MCSection *CurSection, MCSection *Section, const MCExpr *SubSection, raw_ostream &OS)
Update streamer for a new active section.
const MCSymbol * Function
Target - Wrapper for Target specific information.
MCSection * getCurrentSectionOnly() const
void visitUsedExpr(const MCExpr &Expr)
bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc)
Returns true if the the .cv_loc directive is in the right section.
MCTargetStreamer(MCStreamer &S)
virtual MCSymbol * EmitCFILabel()
When emitting an object file, create and emit a real label.
bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Represents a version number in the form major[.minor[.subminor[.build]]].
virtual void EmitThumbFunc(MCSymbol *Func)
Note in the output that the specified Func is a Thumb mode function (ARM target only).
const MCSymbol * FuncletOrFuncEnd
virtual void EmitWinCFISaveReg(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void EmitCFISignalFrame()
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset)
const MCSymbol * Personality
bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
Records the function id of an inlined call site.
bool hasCOFFAssociativeComdats() const
virtual void EmitFileDirective(StringRef Filename)
Switch to a new logical file.
virtual void EmitDTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
Generic base class for all target subtargets.
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
References to labels and assigned expressions.
bool isLittleEndian() const
True if the target is little endian.
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, MD5::MD5Result *Checksum, Optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset)
MCSymbol * endSection(MCSection *Section)
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.
CodeViewContext & getCVContext()
WinEH::FrameInfo * EnsureValidWinFrameInfo(SMLoc Loc)
Retreive the current frame info if one is available and it is not yet closed.
virtual void emitRawBytes(StringRef Data)
Emit the bytes in Data into the output.
Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, MD5::MD5Result *Checksum, Optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
MCSymbol * getLabel() const
MCSection * getTextSection() const
virtual void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
Emits a COFF section relative relocation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual void FinishImpl()
Streamer specific finalization.
virtual bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol, SMLoc Loc)
Introduces an inline call site id for use with .cv_loc.
bool isTvOS() const
Is this an Apple tvOS triple.
LLVM Value Representation.
Generic interface to target specific assembler backends.
static cl::opt< bool, true > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag))
virtual bool EmitCVFuncIdDirective(unsigned FunctionId)
Introduces a function id for use with .cv_loc.
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
virtual void EmitCFIBKeyFrame()
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
This class implements an extremely fast bulk output stream that can only output to a stream...
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
StringRef - Represent a constant reference to a string, i.e.
Target specific expression.
void EmitULEB128IntValue(uint64_t Value)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Information describing a function or inlined call site introduced by .cv_func_id or ...
virtual void visitUsedSymbol(const MCSymbol &Sym)
virtual void emitDwarfFileDirective(StringRef Directive)
Represents a location in source code.
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals)
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
const MCSymbol * ExceptionHandler
void EmitVersionForTarget(const Triple &Target, const VersionTuple &SDKVersion)
void setTargetStreamer(MCTargetStreamer *TS)
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
virtual void EmitCOFFSectionIndex(MCSymbol const *Symbol)
Emits a COFF section index.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment)
void setLabel(MCSymbol *Label)
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue)
Set the DescValue for the Symbol.
void EmitCFIStartProc(bool IsSimple, SMLoc Loc=SMLoc())
virtual void EmitCFIWindowSave()
MCSection * getAssociatedXDataSection(const MCSection *TextSec)
Get the .xdata section used for the given section.
Holds state from .cv_file and .cv_loc directives for later emission.