9#ifndef LLVM_LIB_TARGET_X86_X86ASMPRINTER_H
10#define LLVM_LIB_TARGET_X86_X86ASMPRINTER_H
34 std::unique_ptr<MCCodeEmitter> CodeEmitter;
35 bool EmitFPOData =
false;
36 bool ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags =
false;
37 bool IndCSPrefix =
false;
38 bool EnableImportCallOptimization =
false;
40 enum ImportCallKind :
unsigned {
41 IMAGE_RETPOLINE_AMD64_IMPORT_BR = 0x02,
42 IMAGE_RETPOLINE_AMD64_IMPORT_CALL = 0x03,
43 IMAGE_RETPOLINE_AMD64_INDIR_BR = 0x04,
44 IMAGE_RETPOLINE_AMD64_INDIR_CALL = 0x05,
45 IMAGE_RETPOLINE_AMD64_INDIR_BR_REX = 0x06,
46 IMAGE_RETPOLINE_AMD64_CFG_BR = 0x08,
47 IMAGE_RETPOLINE_AMD64_CFG_CALL = 0x09,
48 IMAGE_RETPOLINE_AMD64_CFG_BR_REX = 0x0A,
49 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_FIRST = 0x010,
50 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_LAST = 0x01F,
52 struct ImportCallInfo {
56 DenseMap<MCSection *, std::vector<ImportCallInfo>>
57 SectionToImportedFunctionCalls;
67 class StackMapShadowTracker {
69 void startFunction(MachineFunction &MF) {
72 void count(
const MCInst &Inst,
const MCSubtargetInfo &STI,
73 MCCodeEmitter *CodeEmitter);
76 void reset(
unsigned RequiredSize) {
77 RequiredShadowSize = RequiredSize;
78 CurrentShadowSize = 0;
84 void emitShadowPadding(MCStreamer &OutStreamer,
const MCSubtargetInfo &STI);
86 const MachineFunction *MF =
nullptr;
87 bool InShadow =
false;
94 unsigned RequiredShadowSize = 0, CurrentShadowSize = 0;
97 StackMapShadowTracker SMShadowTracker;
105 void EmitAndCountInstruction(MCInst &Inst);
106 void LowerSTACKMAP(
const MachineInstr &
MI);
107 void LowerPATCHPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
108 void LowerSTATEPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
109 void LowerFAULTING_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
110 void LowerPATCHABLE_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
112 void LowerTlsAddr(X86MCInstLower &MCInstLowering,
const MachineInstr &
MI);
115 void LowerPATCHABLE_FUNCTION_ENTER(
const MachineInstr &
MI,
116 X86MCInstLower &MCIL);
117 void LowerPATCHABLE_RET(
const MachineInstr &
MI, X86MCInstLower &MCIL);
118 void LowerPATCHABLE_TAIL_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
119 void LowerPATCHABLE_EVENT_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
120 void LowerPATCHABLE_TYPED_EVENT_CALL(
const MachineInstr &
MI,
121 X86MCInstLower &MCIL);
123 void LowerFENTRY_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
127 void EmitKCFITypePadding(
const MachineFunction &MF,
bool HasType =
true);
128 void LowerKCFI_CHECK(
const MachineInstr &
MI);
131 void LowerASAN_CHECK_MEMACCESS(
const MachineInstr &
MI);
134 void EmitSEHInstruction(
const MachineInstr *
MI);
136 void PrintSymbolOperand(
const MachineOperand &MO, raw_ostream &O)
override;
137 void PrintOperand(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
138 void PrintModifiedOperand(
const MachineInstr *
MI,
unsigned OpNo,
139 raw_ostream &O, StringRef Modifier = {});
140 void PrintPCRelImm(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
141 void PrintLeaMemReference(
const MachineInstr *
MI,
unsigned OpNo,
142 raw_ostream &O, StringRef Modifier = {});
143 void PrintMemReference(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O,
144 StringRef Modifier = {});
145 void PrintIntelMemReference(
const MachineInstr *
MI,
unsigned OpNo,
146 raw_ostream &O, StringRef Modifier = {});
147 const MCSubtargetInfo *getIFuncMCSubtargetInfo()
const override;
148 void emitMachOIFuncStubBody(
Module &M,
const GlobalIFunc &GI,
149 MCSymbol *LazyPointer)
override;
150 void emitMachOIFuncStubHelperBody(
Module &M,
const GlobalIFunc &GI,
151 MCSymbol *LazyPointer)
override;
154 void maybeEmitNopAfterCallForWindowsEH(
const MachineInstr *
MI);
158 void emitLabelAndRecordForImportCallOptimization(ImportCallKind Kind);
161 X86AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
164 return "X86 Assembly Printer";
169 void emitStartOfAsmFile(
Module &M)
override;
171 void emitEndOfAsmFile(
Module &M)
override;
183 SMShadowTracker.reset(0);
186 return AsmPrinter::doInitialization(M);
190 void emitFunctionBodyStart()
override;
191 void emitFunctionBodyEnd()
override;
195 return ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags;
#define LLVM_LIBRARY_VISIBILITY
Machine Check Debug Module
This class is intended to be used as a driving class for all asm writers.
Instances of this class represent a single low-level machine instruction.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
const X86Subtarget & getSubtarget() const
bool shouldEmitWeakSwiftAsyncExtendedFramePointerFlags() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...