36 std::unique_ptr<MCCodeEmitter> CodeEmitter;
37 bool EmitFPOData =
false;
38 bool ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags =
false;
39 bool IndCSPrefix =
false;
40 bool EnableImportCallOptimization =
false;
41 bool SplitChainedAtEndOfBlock =
false;
43 enum ImportCallKind :
unsigned {
44 IMAGE_RETPOLINE_AMD64_IMPORT_BR = 0x02,
45 IMAGE_RETPOLINE_AMD64_IMPORT_CALL = 0x03,
46 IMAGE_RETPOLINE_AMD64_INDIR_BR = 0x04,
47 IMAGE_RETPOLINE_AMD64_INDIR_CALL = 0x05,
48 IMAGE_RETPOLINE_AMD64_INDIR_BR_REX = 0x06,
49 IMAGE_RETPOLINE_AMD64_CFG_BR = 0x08,
50 IMAGE_RETPOLINE_AMD64_CFG_CALL = 0x09,
51 IMAGE_RETPOLINE_AMD64_CFG_BR_REX = 0x0A,
52 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_FIRST = 0x010,
53 IMAGE_RETPOLINE_AMD64_SWITCHTABLE_LAST = 0x01F,
55 struct ImportCallInfo {
59 MapVector<MCSection *, std::vector<ImportCallInfo>>
60 SectionToImportedFunctionCalls;
70 class StackMapShadowTracker {
72 void startFunction(MachineFunction &MF) {
75 void count(
const MCInst &Inst,
const MCSubtargetInfo &STI,
76 MCCodeEmitter *CodeEmitter);
79 void reset(
unsigned RequiredSize) {
80 RequiredShadowSize = RequiredSize;
81 CurrentShadowSize = 0;
87 void emitShadowPadding(MCStreamer &OutStreamer,
const MCSubtargetInfo &STI);
90 bool InShadow =
false;
97 unsigned RequiredShadowSize = 0, CurrentShadowSize = 0;
100 StackMapShadowTracker SMShadowTracker;
108 void EmitAndCountInstruction(MCInst &Inst);
109 void LowerSTACKMAP(
const MachineInstr &
MI);
110 void LowerPATCHPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
111 void LowerSTATEPOINT(
const MachineInstr &
MI, X86MCInstLower &MCIL);
112 void LowerFAULTING_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
113 void LowerPATCHABLE_OP(
const MachineInstr &
MI, X86MCInstLower &MCIL);
115 void LowerTlsAddr(X86MCInstLower &MCInstLowering,
const MachineInstr &
MI);
118 void LowerPATCHABLE_FUNCTION_ENTER(
const MachineInstr &
MI,
119 X86MCInstLower &MCIL);
120 void LowerPATCHABLE_RET(
const MachineInstr &
MI, X86MCInstLower &MCIL);
121 void LowerPATCHABLE_TAIL_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
122 void LowerPATCHABLE_EVENT_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
123 void LowerPATCHABLE_TYPED_EVENT_CALL(
const MachineInstr &
MI,
124 X86MCInstLower &MCIL);
126 void LowerFENTRY_CALL(
const MachineInstr &
MI, X86MCInstLower &MCIL);
129 uint32_t MaskKCFIType(uint32_t
Value);
130 void EmitKCFITypePadding(
const MachineFunction &MF,
bool HasType =
true);
131 void LowerKCFI_CHECK(
const MachineInstr &
MI);
134 void LowerASAN_CHECK_MEMACCESS(
const MachineInstr &
MI);
137 void EmitSEHInstruction(
const MachineInstr *
MI);
139 void PrintSymbolOperand(
const MachineOperand &MO, raw_ostream &O)
override;
140 void PrintOperand(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
141 void PrintModifiedOperand(
const MachineInstr *
MI,
unsigned OpNo,
142 raw_ostream &O, StringRef Modifier = {});
143 void PrintPCRelImm(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O);
144 void PrintLeaMemReference(
const MachineInstr *
MI,
unsigned OpNo,
145 raw_ostream &O, StringRef Modifier = {});
146 void PrintMemReference(
const MachineInstr *
MI,
unsigned OpNo, raw_ostream &O,
147 StringRef Modifier = {});
148 void PrintIntelMemReference(
const MachineInstr *
MI,
unsigned OpNo,
149 raw_ostream &O, StringRef Modifier = {});
150 const MCSubtargetInfo *getIFuncMCSubtargetInfo()
const override;
151 void emitMachOIFuncStubBody(
Module &M,
const GlobalIFunc &GI,
152 MCSymbol *LazyPointer)
override;
153 void emitMachOIFuncStubHelperBody(
Module &M,
const GlobalIFunc &GI,
154 MCSymbol *LazyPointer)
override;
156 void emitCallInstruction(
const llvm::MCInst &MCI);
157 void maybeEmitNopAfterCallForWindowsEH(
const MachineInstr *
MI);
161 void emitLabelAndRecordForImportCallOptimization(ImportCallKind Kind);
164 X86AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer>
Streamer);
167 return "X86 Assembly Printer";
172 void emitStartOfAsmFile(
Module &M)
override;
174 void emitEndOfAsmFile(
Module &M)
override;
190 SMShadowTracker.reset(0);
197 void emitFunctionBodyStart()
override;
198 void emitFunctionBodyEnd()
override;
202 return ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags;