1 //===- AArch64AsmPrinter.cpp - AArch64 LLVM assembly writer ---------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains a printer that converts from our internal representation
10 // of machine-dependent LLVM code to the AArch64 assembly language.
12 //===----------------------------------------------------------------------===//
15 #include "AArch64MCInstLower.h"
16 #include "AArch64MachineFunctionInfo.h"
17 #include "AArch64RegisterInfo.h"
18 #include "AArch64Subtarget.h"
19 #include "AArch64TargetObjectFile.h"
20 #include "MCTargetDesc/AArch64AddressingModes.h"
21 #include "MCTargetDesc/AArch64InstPrinter.h"
22 #include "MCTargetDesc/AArch64MCExpr.h"
23 #include "MCTargetDesc/AArch64MCTargetDesc.h"
24 #include "MCTargetDesc/AArch64TargetStreamer.h"
25 #include "TargetInfo/AArch64TargetInfo.h"
26 #include "Utils/AArch64BaseInfo.h"
27 #include "llvm/ADT/SmallString.h"
28 #include "llvm/ADT/SmallVector.h"
29 #include "llvm/ADT/StringRef.h"
30 #include "llvm/ADT/Triple.h"
31 #include "llvm/ADT/Twine.h"
32 #include "llvm/BinaryFormat/COFF.h"
33 #include "llvm/BinaryFormat/ELF.h"
34 #include "llvm/CodeGen/AsmPrinter.h"
35 #include "llvm/CodeGen/MachineBasicBlock.h"
36 #include "llvm/CodeGen/MachineFunction.h"
37 #include "llvm/CodeGen/MachineInstr.h"
38 #include "llvm/CodeGen/MachineJumpTableInfo.h"
39 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
40 #include "llvm/CodeGen/MachineOperand.h"
41 #include "llvm/CodeGen/StackMaps.h"
42 #include "llvm/CodeGen/TargetRegisterInfo.h"
43 #include "llvm/IR/DataLayout.h"
44 #include "llvm/IR/DebugInfoMetadata.h"
45 #include "llvm/MC/MCAsmInfo.h"
46 #include "llvm/MC/MCContext.h"
47 #include "llvm/MC/MCInst.h"
48 #include "llvm/MC/MCInstBuilder.h"
49 #include "llvm/MC/MCSectionELF.h"
50 #include "llvm/MC/MCStreamer.h"
51 #include "llvm/MC/MCSymbol.h"
52 #include "llvm/Support/Casting.h"
53 #include "llvm/Support/ErrorHandling.h"
54 #include "llvm/Support/TargetRegistry.h"
55 #include "llvm/Support/raw_ostream.h"
56 #include "llvm/Target/TargetMachine.h"
65 #define DEBUG_TYPE "asm-printer"
69 class AArch64AsmPrinter
: public AsmPrinter
{
70 AArch64MCInstLower MCInstLowering
;
72 const AArch64Subtarget
*STI
;
75 AArch64AsmPrinter(TargetMachine
&TM
, std::unique_ptr
<MCStreamer
> Streamer
)
76 : AsmPrinter(TM
, std::move(Streamer
)), MCInstLowering(OutContext
, *this),
79 StringRef
getPassName() const override
{ return "AArch64 Assembly Printer"; }
81 /// Wrapper for MCInstLowering.lowerOperand() for the
82 /// tblgen'erated pseudo lowering.
83 bool lowerOperand(const MachineOperand
&MO
, MCOperand
&MCOp
) const {
84 return MCInstLowering
.lowerOperand(MO
, MCOp
);
87 void EmitJumpTableInfo() override
;
88 void emitJumpTableEntry(const MachineJumpTableInfo
*MJTI
,
89 const MachineBasicBlock
*MBB
, unsigned JTI
);
91 void LowerJumpTableDestSmall(MCStreamer
&OutStreamer
, const MachineInstr
&MI
);
93 void LowerSTACKMAP(MCStreamer
&OutStreamer
, StackMaps
&SM
,
94 const MachineInstr
&MI
);
95 void LowerPATCHPOINT(MCStreamer
&OutStreamer
, StackMaps
&SM
,
96 const MachineInstr
&MI
);
98 void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr
&MI
);
99 void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr
&MI
);
100 void LowerPATCHABLE_TAIL_CALL(const MachineInstr
&MI
);
102 std::map
<std::pair
<unsigned, uint32_t>, MCSymbol
*> HwasanMemaccessSymbols
;
103 void LowerHWASAN_CHECK_MEMACCESS(const MachineInstr
&MI
);
104 void EmitHwasanMemaccessSymbols(Module
&M
);
106 void EmitSled(const MachineInstr
&MI
, SledKind Kind
);
108 /// tblgen'erated driver function for lowering simple MI->MC
109 /// pseudo instructions.
110 bool emitPseudoExpansionLowering(MCStreamer
&OutStreamer
,
111 const MachineInstr
*MI
);
113 void EmitInstruction(const MachineInstr
*MI
) override
;
115 void getAnalysisUsage(AnalysisUsage
&AU
) const override
{
116 AsmPrinter::getAnalysisUsage(AU
);
117 AU
.setPreservesAll();
120 bool runOnMachineFunction(MachineFunction
&MF
) override
{
121 AArch64FI
= MF
.getInfo
<AArch64FunctionInfo
>();
122 STI
= static_cast<const AArch64Subtarget
*>(&MF
.getSubtarget());
124 SetupMachineFunction(MF
);
126 if (STI
->isTargetCOFF()) {
127 bool Internal
= MF
.getFunction().hasInternalLinkage();
128 COFF::SymbolStorageClass Scl
= Internal
? COFF::IMAGE_SYM_CLASS_STATIC
129 : COFF::IMAGE_SYM_CLASS_EXTERNAL
;
131 COFF::IMAGE_SYM_DTYPE_FUNCTION
<< COFF::SCT_COMPLEX_TYPE_SHIFT
;
133 OutStreamer
->BeginCOFFSymbolDef(CurrentFnSym
);
134 OutStreamer
->EmitCOFFSymbolStorageClass(Scl
);
135 OutStreamer
->EmitCOFFSymbolType(Type
);
136 OutStreamer
->EndCOFFSymbolDef();
139 // Emit the rest of the function body.
142 // Emit the XRay table for this function.
145 // We didn't modify anything.
150 void printOperand(const MachineInstr
*MI
, unsigned OpNum
, raw_ostream
&O
);
151 bool printAsmMRegister(const MachineOperand
&MO
, char Mode
, raw_ostream
&O
);
152 bool printAsmRegInClass(const MachineOperand
&MO
,
153 const TargetRegisterClass
*RC
, bool isVector
,
156 bool PrintAsmOperand(const MachineInstr
*MI
, unsigned OpNum
,
157 const char *ExtraCode
, raw_ostream
&O
) override
;
158 bool PrintAsmMemoryOperand(const MachineInstr
*MI
, unsigned OpNum
,
159 const char *ExtraCode
, raw_ostream
&O
) override
;
161 void PrintDebugValueComment(const MachineInstr
*MI
, raw_ostream
&OS
);
163 void EmitFunctionBodyEnd() override
;
165 MCSymbol
*GetCPISymbol(unsigned CPID
) const override
;
166 void EmitEndOfAsmFile(Module
&M
) override
;
168 AArch64FunctionInfo
*AArch64FI
= nullptr;
170 /// Emit the LOHs contained in AArch64FI.
173 /// Emit instruction to set float register to zero.
174 void EmitFMov0(const MachineInstr
&MI
);
176 using MInstToMCSymbol
= std::map
<const MachineInstr
*, MCSymbol
*>;
178 MInstToMCSymbol LOHInstToLabel
;
181 } // end anonymous namespace
183 void AArch64AsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr
&MI
)
185 EmitSled(MI
, SledKind::FUNCTION_ENTER
);
188 void AArch64AsmPrinter::LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr
&MI
)
190 EmitSled(MI
, SledKind::FUNCTION_EXIT
);
193 void AArch64AsmPrinter::LowerPATCHABLE_TAIL_CALL(const MachineInstr
&MI
)
195 EmitSled(MI
, SledKind::TAIL_CALL
);
198 void AArch64AsmPrinter::EmitSled(const MachineInstr
&MI
, SledKind Kind
)
200 static const int8_t NoopsInSledCount
= 7;
201 // We want to emit the following pattern:
206 // ; 7 NOP instructions (28 bytes)
209 // We need the 28 bytes (7 instructions) because at runtime, we'd be patching
210 // over the full 32 bytes (8 instructions) with the following pattern:
212 // STP X0, X30, [SP, #-16]! ; push X0 and the link register to the stack
213 // LDR W0, #12 ; W0 := function ID
214 // LDR X16,#12 ; X16 := addr of __xray_FunctionEntry or __xray_FunctionExit
215 // BLR X16 ; call the tracing trampoline
216 // ;DATA: 32 bits of function ID
217 // ;DATA: lower 32 bits of the address of the trampoline
218 // ;DATA: higher 32 bits of the address of the trampoline
219 // LDP X0, X30, [SP], #16 ; pop X0 and the link register from the stack
221 OutStreamer
->EmitCodeAlignment(4);
222 auto CurSled
= OutContext
.createTempSymbol("xray_sled_", true);
223 OutStreamer
->EmitLabel(CurSled
);
224 auto Target
= OutContext
.createTempSymbol();
226 // Emit "B #32" instruction, which jumps over the next 28 bytes.
227 // The operand has to be the number of 4-byte instructions to jump over,
228 // including the current instruction.
229 EmitToStreamer(*OutStreamer
, MCInstBuilder(AArch64::B
).addImm(8));
231 for (int8_t I
= 0; I
< NoopsInSledCount
; I
++)
232 EmitToStreamer(*OutStreamer
, MCInstBuilder(AArch64::HINT
).addImm(0));
234 OutStreamer
->EmitLabel(Target
);
235 recordSled(CurSled
, MI
, Kind
);
238 void AArch64AsmPrinter::LowerHWASAN_CHECK_MEMACCESS(const MachineInstr
&MI
) {
239 unsigned Reg
= MI
.getOperand(0).getReg();
240 uint32_t AccessInfo
= MI
.getOperand(1).getImm();
241 MCSymbol
*&Sym
= HwasanMemaccessSymbols
[{Reg
, AccessInfo
}];
243 // FIXME: Make this work on non-ELF.
244 if (!TM
.getTargetTriple().isOSBinFormatELF())
245 report_fatal_error("llvm.hwasan.check.memaccess only supported on ELF");
247 std::string SymName
= "__hwasan_check_x" + utostr(Reg
- AArch64::X0
) + "_" +
249 Sym
= OutContext
.getOrCreateSymbol(SymName
);
252 EmitToStreamer(*OutStreamer
,
253 MCInstBuilder(AArch64::BL
)
254 .addExpr(MCSymbolRefExpr::create(Sym
, OutContext
)));
257 void AArch64AsmPrinter::EmitHwasanMemaccessSymbols(Module
&M
) {
258 if (HwasanMemaccessSymbols
.empty())
261 const Triple
&TT
= TM
.getTargetTriple();
262 assert(TT
.isOSBinFormatELF());
263 std::unique_ptr
<MCSubtargetInfo
> STI(
264 TM
.getTarget().createMCSubtargetInfo(TT
.str(), "", ""));
266 MCSymbol
*HwasanTagMismatchSym
=
267 OutContext
.getOrCreateSymbol("__hwasan_tag_mismatch");
269 const MCSymbolRefExpr
*HwasanTagMismatchRef
=
270 MCSymbolRefExpr::create(HwasanTagMismatchSym
, OutContext
);
272 for (auto &P
: HwasanMemaccessSymbols
) {
273 unsigned Reg
= P
.first
.first
;
274 uint32_t AccessInfo
= P
.first
.second
;
275 MCSymbol
*Sym
= P
.second
;
277 OutStreamer
->SwitchSection(OutContext
.getELFSection(
278 ".text.hot", ELF::SHT_PROGBITS
,
279 ELF::SHF_EXECINSTR
| ELF::SHF_ALLOC
| ELF::SHF_GROUP
, 0,
282 OutStreamer
->EmitSymbolAttribute(Sym
, MCSA_ELF_TypeFunction
);
283 OutStreamer
->EmitSymbolAttribute(Sym
, MCSA_Weak
);
284 OutStreamer
->EmitSymbolAttribute(Sym
, MCSA_Hidden
);
285 OutStreamer
->EmitLabel(Sym
);
287 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::UBFMXri
)
288 .addReg(AArch64::X16
)
293 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::LDRBBroX
)
294 .addReg(AArch64::W16
)
296 .addReg(AArch64::X16
)
300 OutStreamer
->EmitInstruction(
301 MCInstBuilder(AArch64::SUBSXrs
)
302 .addReg(AArch64::XZR
)
303 .addReg(AArch64::X16
)
305 .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR
, 56)),
307 MCSymbol
*HandlePartialSym
= OutContext
.createTempSymbol();
308 OutStreamer
->EmitInstruction(
309 MCInstBuilder(AArch64::Bcc
)
310 .addImm(AArch64CC::NE
)
311 .addExpr(MCSymbolRefExpr::create(HandlePartialSym
, OutContext
)),
313 MCSymbol
*ReturnSym
= OutContext
.createTempSymbol();
314 OutStreamer
->EmitLabel(ReturnSym
);
315 OutStreamer
->EmitInstruction(
316 MCInstBuilder(AArch64::RET
).addReg(AArch64::LR
), *STI
);
318 OutStreamer
->EmitLabel(HandlePartialSym
);
319 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::SUBSWri
)
320 .addReg(AArch64::WZR
)
321 .addReg(AArch64::W16
)
325 MCSymbol
*HandleMismatchSym
= OutContext
.createTempSymbol();
326 OutStreamer
->EmitInstruction(
327 MCInstBuilder(AArch64::Bcc
)
328 .addImm(AArch64CC::HI
)
329 .addExpr(MCSymbolRefExpr::create(HandleMismatchSym
, OutContext
)),
332 OutStreamer
->EmitInstruction(
333 MCInstBuilder(AArch64::ANDXri
)
334 .addReg(AArch64::X17
)
336 .addImm(AArch64_AM::encodeLogicalImmediate(0xf, 64)),
338 unsigned Size
= 1 << (AccessInfo
& 0xf);
340 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::ADDXri
)
341 .addReg(AArch64::X17
)
342 .addReg(AArch64::X17
)
346 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::SUBSWrs
)
347 .addReg(AArch64::WZR
)
348 .addReg(AArch64::W16
)
349 .addReg(AArch64::W17
)
352 OutStreamer
->EmitInstruction(
353 MCInstBuilder(AArch64::Bcc
)
354 .addImm(AArch64CC::LS
)
355 .addExpr(MCSymbolRefExpr::create(HandleMismatchSym
, OutContext
)),
358 OutStreamer
->EmitInstruction(
359 MCInstBuilder(AArch64::ORRXri
)
360 .addReg(AArch64::X16
)
362 .addImm(AArch64_AM::encodeLogicalImmediate(0xf, 64)),
364 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::LDRBBui
)
365 .addReg(AArch64::W16
)
366 .addReg(AArch64::X16
)
369 OutStreamer
->EmitInstruction(
370 MCInstBuilder(AArch64::SUBSXrs
)
371 .addReg(AArch64::XZR
)
372 .addReg(AArch64::X16
)
374 .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR
, 56)),
376 OutStreamer
->EmitInstruction(
377 MCInstBuilder(AArch64::Bcc
)
378 .addImm(AArch64CC::EQ
)
379 .addExpr(MCSymbolRefExpr::create(ReturnSym
, OutContext
)),
382 OutStreamer
->EmitLabel(HandleMismatchSym
);
383 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::STPXpre
)
390 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::STPXi
)
397 if (Reg
!= AArch64::X0
)
398 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::ORRXrs
)
400 .addReg(AArch64::XZR
)
404 OutStreamer
->EmitInstruction(MCInstBuilder(AArch64::MOVZXi
)
410 // Intentionally load the GOT entry and branch to it, rather than possibly
411 // late binding the function, which may clobber the registers before we have
412 // a chance to save them.
413 OutStreamer
->EmitInstruction(
414 MCInstBuilder(AArch64::ADRP
)
415 .addReg(AArch64::X16
)
416 .addExpr(AArch64MCExpr::create(
417 HwasanTagMismatchRef
,
418 AArch64MCExpr::VariantKind::VK_GOT_PAGE
, OutContext
)),
420 OutStreamer
->EmitInstruction(
421 MCInstBuilder(AArch64::LDRXui
)
422 .addReg(AArch64::X16
)
423 .addReg(AArch64::X16
)
424 .addExpr(AArch64MCExpr::create(
425 HwasanTagMismatchRef
,
426 AArch64MCExpr::VariantKind::VK_GOT_LO12
, OutContext
)),
428 OutStreamer
->EmitInstruction(
429 MCInstBuilder(AArch64::BR
).addReg(AArch64::X16
), *STI
);
433 void AArch64AsmPrinter::EmitEndOfAsmFile(Module
&M
) {
434 EmitHwasanMemaccessSymbols(M
);
436 const Triple
&TT
= TM
.getTargetTriple();
437 if (TT
.isOSBinFormatMachO()) {
438 // Funny Darwin hack: This flag tells the linker that no global symbols
439 // contain code that falls through to other global symbols (e.g. the obvious
440 // implementation of multiple entry points). If this doesn't occur, the
441 // linker can safely perform dead code stripping. Since LLVM never
442 // generates code that does this, it is always safe to set.
443 OutStreamer
->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols
);
448 void AArch64AsmPrinter::EmitLOHs() {
449 SmallVector
<MCSymbol
*, 3> MCArgs
;
451 for (const auto &D
: AArch64FI
->getLOHContainer()) {
452 for (const MachineInstr
*MI
: D
.getArgs()) {
453 MInstToMCSymbol::iterator LabelIt
= LOHInstToLabel
.find(MI
);
454 assert(LabelIt
!= LOHInstToLabel
.end() &&
455 "Label hasn't been inserted for LOH related instruction");
456 MCArgs
.push_back(LabelIt
->second
);
458 OutStreamer
->EmitLOHDirective(D
.getKind(), MCArgs
);
463 void AArch64AsmPrinter::EmitFunctionBodyEnd() {
464 if (!AArch64FI
->getLOHRelated().empty())
468 /// GetCPISymbol - Return the symbol for the specified constant pool entry.
469 MCSymbol
*AArch64AsmPrinter::GetCPISymbol(unsigned CPID
) const {
470 // Darwin uses a linker-private symbol name for constant-pools (to
471 // avoid addends on the relocation?), ELF has no such concept and
472 // uses a normal private symbol.
473 if (!getDataLayout().getLinkerPrivateGlobalPrefix().empty())
474 return OutContext
.getOrCreateSymbol(
475 Twine(getDataLayout().getLinkerPrivateGlobalPrefix()) + "CPI" +
476 Twine(getFunctionNumber()) + "_" + Twine(CPID
));
478 return AsmPrinter::GetCPISymbol(CPID
);
481 void AArch64AsmPrinter::printOperand(const MachineInstr
*MI
, unsigned OpNum
,
483 const MachineOperand
&MO
= MI
->getOperand(OpNum
);
484 switch (MO
.getType()) {
486 llvm_unreachable("<unknown operand type>");
487 case MachineOperand::MO_Register
: {
488 unsigned Reg
= MO
.getReg();
489 assert(TargetRegisterInfo::isPhysicalRegister(Reg
));
490 assert(!MO
.getSubReg() && "Subregs should be eliminated!");
491 O
<< AArch64InstPrinter::getRegisterName(Reg
);
494 case MachineOperand::MO_Immediate
: {
495 int64_t Imm
= MO
.getImm();
499 case MachineOperand::MO_GlobalAddress
: {
500 PrintSymbolOperand(MO
, O
);
503 case MachineOperand::MO_BlockAddress
: {
504 MCSymbol
*Sym
= GetBlockAddressSymbol(MO
.getBlockAddress());
511 bool AArch64AsmPrinter::printAsmMRegister(const MachineOperand
&MO
, char Mode
,
513 unsigned Reg
= MO
.getReg();
516 return true; // Unknown mode.
518 Reg
= getWRegFromXReg(Reg
);
521 Reg
= getXRegFromWReg(Reg
);
525 O
<< AArch64InstPrinter::getRegisterName(Reg
);
529 // Prints the register in MO using class RC using the offset in the
530 // new register class. This should not be used for cross class
532 bool AArch64AsmPrinter::printAsmRegInClass(const MachineOperand
&MO
,
533 const TargetRegisterClass
*RC
,
534 bool isVector
, raw_ostream
&O
) {
535 assert(MO
.isReg() && "Should only get here with a register!");
536 const TargetRegisterInfo
*RI
= STI
->getRegisterInfo();
537 unsigned Reg
= MO
.getReg();
538 unsigned RegToPrint
= RC
->getRegister(RI
->getEncodingValue(Reg
));
539 assert(RI
->regsOverlap(RegToPrint
, Reg
));
540 O
<< AArch64InstPrinter::getRegisterName(
541 RegToPrint
, isVector
? AArch64::vreg
: AArch64::NoRegAltName
);
545 bool AArch64AsmPrinter::PrintAsmOperand(const MachineInstr
*MI
, unsigned OpNum
,
546 const char *ExtraCode
, raw_ostream
&O
) {
547 const MachineOperand
&MO
= MI
->getOperand(OpNum
);
549 // First try the generic code, which knows about modifiers like 'c' and 'n'.
550 if (!AsmPrinter::PrintAsmOperand(MI
, OpNum
, ExtraCode
, O
))
553 // Does this asm operand have a single letter operand modifier?
554 if (ExtraCode
&& ExtraCode
[0]) {
555 if (ExtraCode
[1] != 0)
556 return true; // Unknown modifier.
558 switch (ExtraCode
[0]) {
560 return true; // Unknown modifier.
561 case 'w': // Print W register
562 case 'x': // Print X register
564 return printAsmMRegister(MO
, ExtraCode
[0], O
);
565 if (MO
.isImm() && MO
.getImm() == 0) {
566 unsigned Reg
= ExtraCode
[0] == 'w' ? AArch64::WZR
: AArch64::XZR
;
567 O
<< AArch64InstPrinter::getRegisterName(Reg
);
570 printOperand(MI
, OpNum
, O
);
572 case 'b': // Print B register.
573 case 'h': // Print H register.
574 case 's': // Print S register.
575 case 'd': // Print D register.
576 case 'q': // Print Q register.
578 const TargetRegisterClass
*RC
;
579 switch (ExtraCode
[0]) {
581 RC
= &AArch64::FPR8RegClass
;
584 RC
= &AArch64::FPR16RegClass
;
587 RC
= &AArch64::FPR32RegClass
;
590 RC
= &AArch64::FPR64RegClass
;
593 RC
= &AArch64::FPR128RegClass
;
598 return printAsmRegInClass(MO
, RC
, false /* vector */, O
);
600 printOperand(MI
, OpNum
, O
);
605 // According to ARM, we should emit x and v registers unless we have a
608 unsigned Reg
= MO
.getReg();
610 // If this is a w or x register, print an x register.
611 if (AArch64::GPR32allRegClass
.contains(Reg
) ||
612 AArch64::GPR64allRegClass
.contains(Reg
))
613 return printAsmMRegister(MO
, 'x', O
);
615 // If this is a b, h, s, d, or q register, print it as a v register.
616 return printAsmRegInClass(MO
, &AArch64::FPR128RegClass
, true /* vector */,
620 printOperand(MI
, OpNum
, O
);
624 bool AArch64AsmPrinter::PrintAsmMemoryOperand(const MachineInstr
*MI
,
626 const char *ExtraCode
,
628 if (ExtraCode
&& ExtraCode
[0] && ExtraCode
[0] != 'a')
629 return true; // Unknown modifier.
631 const MachineOperand
&MO
= MI
->getOperand(OpNum
);
632 assert(MO
.isReg() && "unexpected inline asm memory operand");
633 O
<< "[" << AArch64InstPrinter::getRegisterName(MO
.getReg()) << "]";
637 void AArch64AsmPrinter::PrintDebugValueComment(const MachineInstr
*MI
,
639 unsigned NOps
= MI
->getNumOperands();
641 OS
<< '\t' << MAI
->getCommentString() << "DEBUG_VALUE: ";
642 // cast away const; DIetc do not take const operands for some reason.
643 OS
<< cast
<DILocalVariable
>(MI
->getOperand(NOps
- 2).getMetadata())
646 // Frame address. Currently handles register +- offset only.
647 assert(MI
->getOperand(0).isReg() && MI
->getOperand(1).isImm());
649 printOperand(MI
, 0, OS
);
651 printOperand(MI
, 1, OS
);
654 printOperand(MI
, NOps
- 2, OS
);
657 void AArch64AsmPrinter::EmitJumpTableInfo() {
658 const MachineJumpTableInfo
*MJTI
= MF
->getJumpTableInfo();
661 const std::vector
<MachineJumpTableEntry
> &JT
= MJTI
->getJumpTables();
662 if (JT
.empty()) return;
664 const Function
&F
= MF
->getFunction();
665 const TargetLoweringObjectFile
&TLOF
= getObjFileLowering();
666 bool JTInDiffSection
=
667 !STI
->isTargetCOFF() ||
668 !TLOF
.shouldPutJumpTableInFunctionSection(
669 MJTI
->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32
,
671 if (JTInDiffSection
) {
672 // Drop it in the readonly section.
673 MCSection
*ReadOnlySec
= TLOF
.getSectionForJumpTable(F
, TM
);
674 OutStreamer
->SwitchSection(ReadOnlySec
);
677 auto AFI
= MF
->getInfo
<AArch64FunctionInfo
>();
678 for (unsigned JTI
= 0, e
= JT
.size(); JTI
!= e
; ++JTI
) {
679 const std::vector
<MachineBasicBlock
*> &JTBBs
= JT
[JTI
].MBBs
;
681 // If this jump table was deleted, ignore it.
682 if (JTBBs
.empty()) continue;
684 unsigned Size
= AFI
->getJumpTableEntrySize(JTI
);
685 EmitAlignment(Log2_32(Size
));
686 OutStreamer
->EmitLabel(GetJTISymbol(JTI
));
688 for (auto *JTBB
: JTBBs
)
689 emitJumpTableEntry(MJTI
, JTBB
, JTI
);
693 void AArch64AsmPrinter::emitJumpTableEntry(const MachineJumpTableInfo
*MJTI
,
694 const MachineBasicBlock
*MBB
,
696 const MCExpr
*Value
= MCSymbolRefExpr::create(MBB
->getSymbol(), OutContext
);
697 auto AFI
= MF
->getInfo
<AArch64FunctionInfo
>();
698 unsigned Size
= AFI
->getJumpTableEntrySize(JTI
);
702 const TargetLowering
*TLI
= MF
->getSubtarget().getTargetLowering();
703 const MCExpr
*Base
= TLI
->getPICJumpTableRelocBaseExpr(MF
, JTI
, OutContext
);
704 Value
= MCBinaryExpr::createSub(Value
, Base
, OutContext
);
706 // .byte (LBB - LBB) >> 2 (or .hword)
707 const MCSymbol
*BaseSym
= AFI
->getJumpTableEntryPCRelSymbol(JTI
);
708 const MCExpr
*Base
= MCSymbolRefExpr::create(BaseSym
, OutContext
);
709 Value
= MCBinaryExpr::createSub(Value
, Base
, OutContext
);
710 Value
= MCBinaryExpr::createLShr(
711 Value
, MCConstantExpr::create(2, OutContext
), OutContext
);
714 OutStreamer
->EmitValue(Value
, Size
);
717 /// Small jump tables contain an unsigned byte or half, representing the offset
718 /// from the lowest-addressed possible destination to the desired basic
719 /// block. Since all instructions are 4-byte aligned, this is further compressed
720 /// by counting in instructions rather than bytes (i.e. divided by 4). So, to
721 /// materialize the correct destination we need:
723 /// adr xDest, .LBB0_0
724 /// ldrb wScratch, [xTable, xEntry] (with "lsl #1" for ldrh).
725 /// add xDest, xDest, xScratch, lsl #2
726 void AArch64AsmPrinter::LowerJumpTableDestSmall(llvm::MCStreamer
&OutStreamer
,
727 const llvm::MachineInstr
&MI
) {
728 unsigned DestReg
= MI
.getOperand(0).getReg();
729 unsigned ScratchReg
= MI
.getOperand(1).getReg();
730 unsigned ScratchRegW
=
731 STI
->getRegisterInfo()->getSubReg(ScratchReg
, AArch64::sub_32
);
732 unsigned TableReg
= MI
.getOperand(2).getReg();
733 unsigned EntryReg
= MI
.getOperand(3).getReg();
734 int JTIdx
= MI
.getOperand(4).getIndex();
735 bool IsByteEntry
= MI
.getOpcode() == AArch64::JumpTableDest8
;
737 // This has to be first because the compression pass based its reachability
738 // calculations on the start of the JumpTableDest instruction.
740 MF
->getInfo
<AArch64FunctionInfo
>()->getJumpTableEntryPCRelSymbol(JTIdx
);
741 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::ADR
)
743 .addExpr(MCSymbolRefExpr::create(
744 Label
, MF
->getContext())));
746 // Load the number of instruction-steps to offset from the label.
747 unsigned LdrOpcode
= IsByteEntry
? AArch64::LDRBBroX
: AArch64::LDRHHroX
;
748 EmitToStreamer(OutStreamer
, MCInstBuilder(LdrOpcode
)
753 .addImm(IsByteEntry
? 0 : 1));
755 // Multiply the steps by 4 and add to the already materialized base label
757 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::ADDXrs
)
764 void AArch64AsmPrinter::LowerSTACKMAP(MCStreamer
&OutStreamer
, StackMaps
&SM
,
765 const MachineInstr
&MI
) {
766 unsigned NumNOPBytes
= StackMapOpers(&MI
).getNumPatchBytes();
768 SM
.recordStackMap(MI
);
769 assert(NumNOPBytes
% 4 == 0 && "Invalid number of NOP bytes requested!");
771 // Scan ahead to trim the shadow.
772 const MachineBasicBlock
&MBB
= *MI
.getParent();
773 MachineBasicBlock::const_iterator
MII(MI
);
775 while (NumNOPBytes
> 0) {
776 if (MII
== MBB
.end() || MII
->isCall() ||
777 MII
->getOpcode() == AArch64::DBG_VALUE
||
778 MII
->getOpcode() == TargetOpcode::PATCHPOINT
||
779 MII
->getOpcode() == TargetOpcode::STACKMAP
)
786 for (unsigned i
= 0; i
< NumNOPBytes
; i
+= 4)
787 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::HINT
).addImm(0));
790 // Lower a patchpoint of the form:
791 // [<def>], <id>, <numBytes>, <target>, <numArgs>
792 void AArch64AsmPrinter::LowerPATCHPOINT(MCStreamer
&OutStreamer
, StackMaps
&SM
,
793 const MachineInstr
&MI
) {
794 SM
.recordPatchPoint(MI
);
796 PatchPointOpers
Opers(&MI
);
798 int64_t CallTarget
= Opers
.getCallTarget().getImm();
799 unsigned EncodedBytes
= 0;
801 assert((CallTarget
& 0xFFFFFFFFFFFF) == CallTarget
&&
802 "High 16 bits of call target should be zero.");
803 unsigned ScratchReg
= MI
.getOperand(Opers
.getNextScratchIdx()).getReg();
805 // Materialize the jump address:
806 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::MOVZXi
)
808 .addImm((CallTarget
>> 32) & 0xFFFF)
810 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::MOVKXi
)
813 .addImm((CallTarget
>> 16) & 0xFFFF)
815 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::MOVKXi
)
818 .addImm(CallTarget
& 0xFFFF)
820 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::BLR
).addReg(ScratchReg
));
823 unsigned NumBytes
= Opers
.getNumPatchBytes();
824 assert(NumBytes
>= EncodedBytes
&&
825 "Patchpoint can't request size less than the length of a call.");
826 assert((NumBytes
- EncodedBytes
) % 4 == 0 &&
827 "Invalid number of NOP bytes requested!");
828 for (unsigned i
= EncodedBytes
; i
< NumBytes
; i
+= 4)
829 EmitToStreamer(OutStreamer
, MCInstBuilder(AArch64::HINT
).addImm(0));
832 void AArch64AsmPrinter::EmitFMov0(const MachineInstr
&MI
) {
833 unsigned DestReg
= MI
.getOperand(0).getReg();
834 if (STI
->hasZeroCycleZeroingFP() && !STI
->hasZeroCycleZeroingFPWorkaround()) {
835 // Convert H/S/D register to corresponding Q register
836 if (AArch64::H0
<= DestReg
&& DestReg
<= AArch64::H31
)
837 DestReg
= AArch64::Q0
+ (DestReg
- AArch64::H0
);
838 else if (AArch64::S0
<= DestReg
&& DestReg
<= AArch64::S31
)
839 DestReg
= AArch64::Q0
+ (DestReg
- AArch64::S0
);
841 assert(AArch64::D0
<= DestReg
&& DestReg
<= AArch64::D31
);
842 DestReg
= AArch64::Q0
+ (DestReg
- AArch64::D0
);
845 MOVI
.setOpcode(AArch64::MOVIv2d_ns
);
846 MOVI
.addOperand(MCOperand::createReg(DestReg
));
847 MOVI
.addOperand(MCOperand::createImm(0));
848 EmitToStreamer(*OutStreamer
, MOVI
);
851 switch (MI
.getOpcode()) {
852 default: llvm_unreachable("Unexpected opcode");
853 case AArch64::FMOVH0
:
854 FMov
.setOpcode(AArch64::FMOVWHr
);
855 FMov
.addOperand(MCOperand::createReg(DestReg
));
856 FMov
.addOperand(MCOperand::createReg(AArch64::WZR
));
858 case AArch64::FMOVS0
:
859 FMov
.setOpcode(AArch64::FMOVWSr
);
860 FMov
.addOperand(MCOperand::createReg(DestReg
));
861 FMov
.addOperand(MCOperand::createReg(AArch64::WZR
));
863 case AArch64::FMOVD0
:
864 FMov
.setOpcode(AArch64::FMOVXDr
);
865 FMov
.addOperand(MCOperand::createReg(DestReg
));
866 FMov
.addOperand(MCOperand::createReg(AArch64::XZR
));
869 EmitToStreamer(*OutStreamer
, FMov
);
873 // Simple pseudo-instructions have their lowering (with expansion to real
874 // instructions) auto-generated.
875 #include "AArch64GenMCPseudoLowering.inc"
877 void AArch64AsmPrinter::EmitInstruction(const MachineInstr
*MI
) {
878 // Do any auto-generated pseudo lowerings.
879 if (emitPseudoExpansionLowering(*OutStreamer
, MI
))
882 if (AArch64FI
->getLOHRelated().count(MI
)) {
883 // Generate a label for LOH related instruction
884 MCSymbol
*LOHLabel
= createTempSymbol("loh");
885 // Associate the instruction with the label
886 LOHInstToLabel
[MI
] = LOHLabel
;
887 OutStreamer
->EmitLabel(LOHLabel
);
890 AArch64TargetStreamer
*TS
=
891 static_cast<AArch64TargetStreamer
*>(OutStreamer
->getTargetStreamer());
892 // Do any manual lowerings.
893 switch (MI
->getOpcode()) {
896 case AArch64::MOVMCSym
: {
897 unsigned DestReg
= MI
->getOperand(0).getReg();
898 const MachineOperand
&MO_Sym
= MI
->getOperand(1);
899 MachineOperand
Hi_MOSym(MO_Sym
), Lo_MOSym(MO_Sym
);
900 MCOperand Hi_MCSym
, Lo_MCSym
;
902 Hi_MOSym
.setTargetFlags(AArch64II::MO_G1
| AArch64II::MO_S
);
903 Lo_MOSym
.setTargetFlags(AArch64II::MO_G0
| AArch64II::MO_NC
);
905 MCInstLowering
.lowerOperand(Hi_MOSym
, Hi_MCSym
);
906 MCInstLowering
.lowerOperand(Lo_MOSym
, Lo_MCSym
);
909 MovZ
.setOpcode(AArch64::MOVZXi
);
910 MovZ
.addOperand(MCOperand::createReg(DestReg
));
911 MovZ
.addOperand(Hi_MCSym
);
912 MovZ
.addOperand(MCOperand::createImm(16));
913 EmitToStreamer(*OutStreamer
, MovZ
);
916 MovK
.setOpcode(AArch64::MOVKXi
);
917 MovK
.addOperand(MCOperand::createReg(DestReg
));
918 MovK
.addOperand(MCOperand::createReg(DestReg
));
919 MovK
.addOperand(Lo_MCSym
);
920 MovK
.addOperand(MCOperand::createImm(0));
921 EmitToStreamer(*OutStreamer
, MovK
);
924 case AArch64::MOVIv2d_ns
:
925 // If the target has <rdar://problem/16473581>, lower this
926 // instruction to movi.16b instead.
927 if (STI
->hasZeroCycleZeroingFPWorkaround() &&
928 MI
->getOperand(1).getImm() == 0) {
930 TmpInst
.setOpcode(AArch64::MOVIv16b_ns
);
931 TmpInst
.addOperand(MCOperand::createReg(MI
->getOperand(0).getReg()));
932 TmpInst
.addOperand(MCOperand::createImm(MI
->getOperand(1).getImm()));
933 EmitToStreamer(*OutStreamer
, TmpInst
);
938 case AArch64::DBG_VALUE
: {
939 if (isVerbose() && OutStreamer
->hasRawTextSupport()) {
940 SmallString
<128> TmpStr
;
941 raw_svector_ostream
OS(TmpStr
);
942 PrintDebugValueComment(MI
, OS
);
943 OutStreamer
->EmitRawText(StringRef(OS
.str()));
947 case AArch64::EMITBKEY
: {
948 ExceptionHandling ExceptionHandlingType
= MAI
->getExceptionHandlingType();
949 if (ExceptionHandlingType
!= ExceptionHandling::DwarfCFI
&&
950 ExceptionHandlingType
!= ExceptionHandling::ARM
)
953 if (needsCFIMoves() == CFI_M_None
)
956 OutStreamer
->EmitCFIBKeyFrame();
961 // Tail calls use pseudo instructions so they have the proper code-gen
962 // attributes (isCall, isReturn, etc.). We lower them to the real
964 case AArch64::TCRETURNri
:
965 case AArch64::TCRETURNriBTI
:
966 case AArch64::TCRETURNriALL
: {
968 TmpInst
.setOpcode(AArch64::BR
);
969 TmpInst
.addOperand(MCOperand::createReg(MI
->getOperand(0).getReg()));
970 EmitToStreamer(*OutStreamer
, TmpInst
);
973 case AArch64::TCRETURNdi
: {
975 MCInstLowering
.lowerOperand(MI
->getOperand(0), Dest
);
977 TmpInst
.setOpcode(AArch64::B
);
978 TmpInst
.addOperand(Dest
);
979 EmitToStreamer(*OutStreamer
, TmpInst
);
982 case AArch64::TLSDESC_CALLSEQ
: {
984 /// adrp x0, :tlsdesc:var
985 /// ldr x1, [x0, #:tlsdesc_lo12:var]
986 /// add x0, x0, #:tlsdesc_lo12:var
989 /// (TPIDR_EL0 offset now in x0)
990 const MachineOperand
&MO_Sym
= MI
->getOperand(0);
991 MachineOperand
MO_TLSDESC_LO12(MO_Sym
), MO_TLSDESC(MO_Sym
);
992 MCOperand Sym
, SymTLSDescLo12
, SymTLSDesc
;
993 MO_TLSDESC_LO12
.setTargetFlags(AArch64II::MO_TLS
| AArch64II::MO_PAGEOFF
);
994 MO_TLSDESC
.setTargetFlags(AArch64II::MO_TLS
| AArch64II::MO_PAGE
);
995 MCInstLowering
.lowerOperand(MO_Sym
, Sym
);
996 MCInstLowering
.lowerOperand(MO_TLSDESC_LO12
, SymTLSDescLo12
);
997 MCInstLowering
.lowerOperand(MO_TLSDESC
, SymTLSDesc
);
1000 Adrp
.setOpcode(AArch64::ADRP
);
1001 Adrp
.addOperand(MCOperand::createReg(AArch64::X0
));
1002 Adrp
.addOperand(SymTLSDesc
);
1003 EmitToStreamer(*OutStreamer
, Adrp
);
1006 Ldr
.setOpcode(AArch64::LDRXui
);
1007 Ldr
.addOperand(MCOperand::createReg(AArch64::X1
));
1008 Ldr
.addOperand(MCOperand::createReg(AArch64::X0
));
1009 Ldr
.addOperand(SymTLSDescLo12
);
1010 Ldr
.addOperand(MCOperand::createImm(0));
1011 EmitToStreamer(*OutStreamer
, Ldr
);
1014 Add
.setOpcode(AArch64::ADDXri
);
1015 Add
.addOperand(MCOperand::createReg(AArch64::X0
));
1016 Add
.addOperand(MCOperand::createReg(AArch64::X0
));
1017 Add
.addOperand(SymTLSDescLo12
);
1018 Add
.addOperand(MCOperand::createImm(AArch64_AM::getShiftValue(0)));
1019 EmitToStreamer(*OutStreamer
, Add
);
1021 // Emit a relocation-annotation. This expands to no code, but requests
1022 // the following instruction gets an R_AARCH64_TLSDESC_CALL.
1024 TLSDescCall
.setOpcode(AArch64::TLSDESCCALL
);
1025 TLSDescCall
.addOperand(Sym
);
1026 EmitToStreamer(*OutStreamer
, TLSDescCall
);
1029 Blr
.setOpcode(AArch64::BLR
);
1030 Blr
.addOperand(MCOperand::createReg(AArch64::X1
));
1031 EmitToStreamer(*OutStreamer
, Blr
);
1036 case AArch64::JumpTableDest32
: {
1038 // ldrsw xScratch, [xTable, xEntry, lsl #2]
1039 // add xDest, xTable, xScratch
1040 unsigned DestReg
= MI
->getOperand(0).getReg(),
1041 ScratchReg
= MI
->getOperand(1).getReg(),
1042 TableReg
= MI
->getOperand(2).getReg(),
1043 EntryReg
= MI
->getOperand(3).getReg();
1044 EmitToStreamer(*OutStreamer
, MCInstBuilder(AArch64::LDRSWroX
)
1050 EmitToStreamer(*OutStreamer
, MCInstBuilder(AArch64::ADDXrs
)
1057 case AArch64::JumpTableDest16
:
1058 case AArch64::JumpTableDest8
:
1059 LowerJumpTableDestSmall(*OutStreamer
, *MI
);
1062 case AArch64::FMOVH0
:
1063 case AArch64::FMOVS0
:
1064 case AArch64::FMOVD0
:
1068 case TargetOpcode::STACKMAP
:
1069 return LowerSTACKMAP(*OutStreamer
, SM
, *MI
);
1071 case TargetOpcode::PATCHPOINT
:
1072 return LowerPATCHPOINT(*OutStreamer
, SM
, *MI
);
1074 case TargetOpcode::PATCHABLE_FUNCTION_ENTER
:
1075 LowerPATCHABLE_FUNCTION_ENTER(*MI
);
1078 case TargetOpcode::PATCHABLE_FUNCTION_EXIT
:
1079 LowerPATCHABLE_FUNCTION_EXIT(*MI
);
1082 case TargetOpcode::PATCHABLE_TAIL_CALL
:
1083 LowerPATCHABLE_TAIL_CALL(*MI
);
1086 case AArch64::HWASAN_CHECK_MEMACCESS
:
1087 LowerHWASAN_CHECK_MEMACCESS(*MI
);
1090 case AArch64::SEH_StackAlloc
:
1091 TS
->EmitARM64WinCFIAllocStack(MI
->getOperand(0).getImm());
1094 case AArch64::SEH_SaveFPLR
:
1095 TS
->EmitARM64WinCFISaveFPLR(MI
->getOperand(0).getImm());
1098 case AArch64::SEH_SaveFPLR_X
:
1099 assert(MI
->getOperand(0).getImm() < 0 &&
1100 "Pre increment SEH opcode must have a negative offset");
1101 TS
->EmitARM64WinCFISaveFPLRX(-MI
->getOperand(0).getImm());
1104 case AArch64::SEH_SaveReg
:
1105 TS
->EmitARM64WinCFISaveReg(MI
->getOperand(0).getImm(),
1106 MI
->getOperand(1).getImm());
1109 case AArch64::SEH_SaveReg_X
:
1110 assert(MI
->getOperand(1).getImm() < 0 &&
1111 "Pre increment SEH opcode must have a negative offset");
1112 TS
->EmitARM64WinCFISaveRegX(MI
->getOperand(0).getImm(),
1113 -MI
->getOperand(1).getImm());
1116 case AArch64::SEH_SaveRegP
:
1117 assert((MI
->getOperand(1).getImm() - MI
->getOperand(0).getImm() == 1) &&
1118 "Non-consecutive registers not allowed for save_regp");
1119 TS
->EmitARM64WinCFISaveRegP(MI
->getOperand(0).getImm(),
1120 MI
->getOperand(2).getImm());
1123 case AArch64::SEH_SaveRegP_X
:
1124 assert((MI
->getOperand(1).getImm() - MI
->getOperand(0).getImm() == 1) &&
1125 "Non-consecutive registers not allowed for save_regp_x");
1126 assert(MI
->getOperand(2).getImm() < 0 &&
1127 "Pre increment SEH opcode must have a negative offset");
1128 TS
->EmitARM64WinCFISaveRegPX(MI
->getOperand(0).getImm(),
1129 -MI
->getOperand(2).getImm());
1132 case AArch64::SEH_SaveFReg
:
1133 TS
->EmitARM64WinCFISaveFReg(MI
->getOperand(0).getImm(),
1134 MI
->getOperand(1).getImm());
1137 case AArch64::SEH_SaveFReg_X
:
1138 assert(MI
->getOperand(1).getImm() < 0 &&
1139 "Pre increment SEH opcode must have a negative offset");
1140 TS
->EmitARM64WinCFISaveFRegX(MI
->getOperand(0).getImm(),
1141 -MI
->getOperand(1).getImm());
1144 case AArch64::SEH_SaveFRegP
:
1145 assert((MI
->getOperand(1).getImm() - MI
->getOperand(0).getImm() == 1) &&
1146 "Non-consecutive registers not allowed for save_regp");
1147 TS
->EmitARM64WinCFISaveFRegP(MI
->getOperand(0).getImm(),
1148 MI
->getOperand(2).getImm());
1151 case AArch64::SEH_SaveFRegP_X
:
1152 assert((MI
->getOperand(1).getImm() - MI
->getOperand(0).getImm() == 1) &&
1153 "Non-consecutive registers not allowed for save_regp_x");
1154 assert(MI
->getOperand(2).getImm() < 0 &&
1155 "Pre increment SEH opcode must have a negative offset");
1156 TS
->EmitARM64WinCFISaveFRegPX(MI
->getOperand(0).getImm(),
1157 -MI
->getOperand(2).getImm());
1160 case AArch64::SEH_SetFP
:
1161 TS
->EmitARM64WinCFISetFP();
1164 case AArch64::SEH_AddFP
:
1165 TS
->EmitARM64WinCFIAddFP(MI
->getOperand(0).getImm());
1168 case AArch64::SEH_Nop
:
1169 TS
->EmitARM64WinCFINop();
1172 case AArch64::SEH_PrologEnd
:
1173 TS
->EmitARM64WinCFIPrologEnd();
1176 case AArch64::SEH_EpilogStart
:
1177 TS
->EmitARM64WinCFIEpilogStart();
1180 case AArch64::SEH_EpilogEnd
:
1181 TS
->EmitARM64WinCFIEpilogEnd();
1185 // Finally, do the automated lowerings for everything else.
1187 MCInstLowering
.Lower(MI
, TmpInst
);
1188 EmitToStreamer(*OutStreamer
, TmpInst
);
1191 // Force static initialization.
1192 extern "C" void LLVMInitializeAArch64AsmPrinter() {
1193 RegisterAsmPrinter
<AArch64AsmPrinter
> X(getTheAArch64leTarget());
1194 RegisterAsmPrinter
<AArch64AsmPrinter
> Y(getTheAArch64beTarget());
1195 RegisterAsmPrinter
<AArch64AsmPrinter
> Z(getTheARM64Target());