35 std::unique_ptr<MCCodeEmitter> CodeEmitter;
36 bool EmitFPOData =
false;
37 bool ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags =
false;
38 bool IndCSPrefix =
false;
39 bool EnableImportCallOptimization =
false;
40 bool SplitChainedAtEndOfBlock =
false;
42 enum ImportCallKind :
unsigned {
43 IMAGE_RETPOLINE_AMD64_IMPORT_BR = 0x02,
44 IMAGE_RETPOLINE_AMD64_IMPORT_CALL = 0x03,
45 IMAGE_RETPOLINE_AMD64_INDIR_BR = 0x04,
46 IMAGE_RETPOLINE_AMD64_INDIR_CALL = 0x05,
47 IMAGE_RETPOLINE_AMD64_INDIR_BR_REX = 0x06,
48 IMAGE_RETPOLINE_AMD64_CFG_BR = 0x08,
49 IMAGE_RETPOLINE_AMD64_CFG_CALL = 0x09,
50 IMAGE_RETPOLINE_AMD64_CFG_BR_REX = 0x0A,
51 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_FIRST = 0x010,
52 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_LAST = 0x01F,
54 struct ImportCallInfo {
59 SectionToImportedFunctionCalls;
69 class StackMapShadowTracker {
74 void count(
const MCInst &Inst,
const MCSubtargetInfo &STI,
75 MCCodeEmitter *CodeEmitter);
78 void reset(
unsigned RequiredSize) {
79 RequiredShadowSize = RequiredSize;
80 CurrentShadowSize = 0;
86 void emitShadowPadding(MCStreamer &OutStreamer,
const MCSubtargetInfo &STI);
88 const MachineFunction *MF =
nullptr;
89 bool InShadow =
false;
96 unsigned RequiredShadowSize = 0, CurrentShadowSize = 0;
99 StackMapShadowTracker SMShadowTracker;
107 void EmitAndCountInstruction(MCInst &Inst);
108 void LowerSTACKMAP(
const MachineInstr &
MI);
109 void LowerPATCHPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
110 void LowerSTATEPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
111 void LowerFAULTING_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
112 void LowerPATCHABLE_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
114 void LowerTlsAddr(X86MCInstLower &MCInstLowering,
const MachineInstr &
MI);
117 void LowerPATCHABLE_FUNCTION_ENTER(
const MachineInstr &
MI,
118 X86MCInstLower &MCIL);
119 void LowerPATCHABLE_RET(
const MachineInstr &
MI, X86MCInstLower &MCIL);
120 void LowerPATCHABLE_TAIL_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
121 void LowerPATCHABLE_EVENT_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
122 void LowerPATCHABLE_TYPED_EVENT_CALL(
const MachineInstr &
MI,
123 X86MCInstLower &MCIL);
125 void LowerFENTRY_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
128 uint32_t MaskKCFIType(uint32_t
Value);
129 void EmitKCFITypePadding(
const MachineFunction &MF,
bool HasType =
true);
130 void LowerKCFI_CHECK(
const MachineInstr &
MI);
133 void LowerASAN_CHECK_MEMACCESS(
const MachineInstr &
MI);
136 void EmitSEHInstruction(
const MachineInstr *
MI);
138 void PrintSymbolOperand(
const MachineOperand &MO, raw_ostream &O)
override;
139 void PrintOperand(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
140 void PrintModifiedOperand(
const MachineInstr *
MI,
unsigned OpNo,
141 raw_ostream &O, StringRef Modifier = {});
142 void PrintPCRelImm(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
143 void PrintLeaMemReference(
const MachineInstr *
MI,
unsigned OpNo,
144 raw_ostream &O, StringRef Modifier = {});
145 void PrintMemReference(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O,
146 StringRef Modifier = {});
147 void PrintIntelMemReference(
const MachineInstr *
MI,
unsigned OpNo,
148 raw_ostream &O, StringRef Modifier = {});
149 const MCSubtargetInfo *getIFuncMCSubtargetInfo()
const override;
150 void emitMachOIFuncStubBody(
Module &M,
const GlobalIFunc &GI,
151 MCSymbol *LazyPointer)
override;
152 void emitMachOIFuncStubHelperBody(
Module &M,
const GlobalIFunc &GI,
153 MCSymbol *LazyPointer)
override;
155 void emitCallInstruction(
const llvm::MCInst &MCI);
156 void maybeEmitNopAfterCallForWindowsEH(
const MachineInstr *
MI);
160 void emitLabelAndRecordForImportCallOptimization(ImportCallKind Kind);
163 X86AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
166 return "X86 Assembly Printer";
171 void emitStartOfAsmFile(
Module &M)
override;
173 void emitEndOfAsmFile(
Module &M)
override;
189 SMShadowTracker.reset(0);
196 void emitFunctionBodyStart()
override;
197 void emitFunctionBodyEnd()
override;
201 return ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags;