LLVM 23.0.0git
PPCInstPrinter.cpp
Go to the documentation of this file.
1//===-- PPCInstPrinter.cpp - Convert PPC MCInst to assembly syntax --------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This class prints an PPC MCInst to a .s file.
10//
11//===----------------------------------------------------------------------===//
12
16#include "PPCMCAsmInfo.h"
17#include "llvm/MC/MCAsmInfo.h"
18#include "llvm/MC/MCExpr.h"
19#include "llvm/MC/MCInst.h"
20#include "llvm/MC/MCInstrInfo.h"
23#include "llvm/MC/MCSymbol.h"
27using namespace llvm;
28
29#define DEBUG_TYPE "asm-printer"
30
31// FIXME: Once the integrated assembler supports full register names, tie this
32// to the verbose-asm setting.
33static cl::opt<bool>
34FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false),
35 cl::desc("Use full register names when printing assembly"));
36
37// Useful for testing purposes. Prints vs{31-63} as v{0-31} respectively.
38static cl::opt<bool>
39ShowVSRNumsAsVR("ppc-vsr-nums-as-vr", cl::Hidden, cl::init(false),
40 cl::desc("Prints full register names with vs{31-63} as v{0-31}"));
41
42// Prints full register names with percent symbol.
43static cl::opt<bool>
44FullRegNamesWithPercent("ppc-reg-with-percent-prefix", cl::Hidden,
45 cl::init(false),
46 cl::desc("Prints full register names with percent"));
47
48#define PRINT_ALIAS_INSTR
49#include "PPCGenAsmWriter.inc"
50
52 const char *RegName = getRegisterName(Reg);
53 OS << RegName;
54}
55
57 StringRef Annot, const MCSubtargetInfo &STI,
58 raw_ostream &O) {
59 // Customize printing of the addis instruction on AIX. When an operand is a
60 // symbol reference, the instruction syntax is changed to look like a load
61 // operation, i.e:
62 // Transform: addis $rD, $rA, $src --> addis $rD, $src($rA).
63 if (TT.isOSAIX() &&
64 (MI->getOpcode() == PPC::ADDIS8 || MI->getOpcode() == PPC::ADDIS) &&
65 MI->getOperand(2).isExpr()) {
66 assert((MI->getOperand(0).isReg() && MI->getOperand(1).isReg()) &&
67 "The first and the second operand of an addis instruction"
68 " should be registers.");
69
70 assert(isa<MCSymbolRefExpr>(MI->getOperand(2).getExpr()) &&
71 "The third operand of an addis instruction should be a symbol "
72 "reference expression if it is an expression at all.");
73
74 O << "\taddis ";
75 printOperand(MI, 0, STI, O);
76 O << ", ";
77 printOperand(MI, 2, STI, O);
78 O << "(";
79 printOperand(MI, 1, STI, O);
80 O << ")";
81 return;
82 }
83
84 // Check if the last operand is an expression with the variant kind
85 // VK_PCREL_OPT. If this is the case then this is a linker optimization
86 // relocation and the .reloc directive needs to be added.
87 unsigned LastOp = MI->getNumOperands() - 1;
88 if (MI->getNumOperands() > 1) {
89 const MCOperand &Operand = MI->getOperand(LastOp);
90 if (Operand.isExpr()) {
91 const MCExpr *Expr = Operand.getExpr();
92 const MCSymbolRefExpr *SymExpr =
93 static_cast<const MCSymbolRefExpr *>(Expr);
94
95 if (SymExpr && getSpecifier(SymExpr) == PPC::S_PCREL_OPT) {
96 const MCSymbol &Symbol = SymExpr->getSymbol();
97 if (MI->getOpcode() == PPC::PLDpc) {
98 printInstruction(MI, Address, STI, O);
99 O << "\n";
100 Symbol.print(O, &MAI);
101 O << ":";
102 return;
103 } else {
104 O << "\t.reloc ";
105 Symbol.print(O, &MAI);
106 O << "-8,R_PPC64_PCREL_OPT,.-(";
107 Symbol.print(O, &MAI);
108 O << "-8)\n";
109 }
110 }
111 }
112 }
113
114 // Check for slwi/srwi mnemonics.
115 if (MI->getOpcode() == PPC::RLWINM) {
116 unsigned char SH = MI->getOperand(2).getImm();
117 unsigned char MB = MI->getOperand(3).getImm();
118 unsigned char ME = MI->getOperand(4).getImm();
119 bool useSubstituteMnemonic = false;
120 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
121 O << "\tslwi "; useSubstituteMnemonic = true;
122 }
123 if (SH <= 31 && MB == (32-SH) && ME == 31) {
124 O << "\tsrwi "; useSubstituteMnemonic = true;
125 SH = 32-SH;
126 }
127 if (useSubstituteMnemonic) {
128 printOperand(MI, 0, STI, O);
129 O << ", ";
130 printOperand(MI, 1, STI, O);
131 O << ", " << (unsigned int)SH;
132
133 printAnnotation(O, Annot);
134 return;
135 }
136 }
137
138 if (MI->getOpcode() == PPC::RLDICR ||
139 MI->getOpcode() == PPC::RLDICR_32) {
140 unsigned char SH = MI->getOperand(2).getImm();
141 unsigned char ME = MI->getOperand(3).getImm();
142 // rldicr RA, RS, SH, 63-SH == sldi RA, RS, SH
143 if (63-SH == ME) {
144 O << "\tsldi ";
145 printOperand(MI, 0, STI, O);
146 O << ", ";
147 printOperand(MI, 1, STI, O);
148 O << ", " << (unsigned int)SH;
149 printAnnotation(O, Annot);
150 return;
151 }
152 }
153
154 // dcbt[st] is printed manually here because:
155 // 1. The assembly syntax is different between embedded and server targets
156 // 2. We must print the short mnemonics for TH == 0 because the
157 // embedded/server syntax default will not be stable across assemblers
158 // The syntax for dcbt is:
159 // dcbt ra, rb, th [server]
160 // dcbt th, ra, rb [embedded]
161 // where th can be omitted when it is 0. dcbtst is the same.
162 // On AIX, only emit the extended mnemonics for dcbt and dcbtst if
163 // the "modern assembler" is available.
164 if ((MI->getOpcode() == PPC::DCBT || MI->getOpcode() == PPC::DCBTST) &&
165 (!TT.isOSAIX() || STI.hasFeature(PPC::FeatureModernAIXAs))) {
166 unsigned char TH = MI->getOperand(0).getImm();
167 O << "\tdcbt";
168 if (MI->getOpcode() == PPC::DCBTST)
169 O << "st";
170 if (TH == 16)
171 O << "t";
172 O << " ";
173
174 bool IsBookE = STI.hasFeature(PPC::FeatureBookE);
175 if (IsBookE && TH != 0 && TH != 16)
176 O << (unsigned int) TH << ", ";
177
178 printOperand(MI, 1, STI, O);
179 O << ", ";
180 printOperand(MI, 2, STI, O);
181
182 if (!IsBookE && TH != 0 && TH != 16)
183 O << ", " << (unsigned int) TH;
184
185 printAnnotation(O, Annot);
186 return;
187 }
188
189 if (MI->getOpcode() == PPC::DCBF) {
190 unsigned char L = MI->getOperand(0).getImm();
191 if (!L || L == 1 || L == 3 || L == 4 || L == 6) {
192 O << "\tdcb";
193 if (L != 6)
194 O << "f";
195 if (L == 1)
196 O << "l";
197 if (L == 3)
198 O << "lp";
199 if (L == 4)
200 O << "ps";
201 if (L == 6)
202 O << "stps";
203 O << " ";
204
205 printOperand(MI, 1, STI, O);
206 O << ", ";
207 printOperand(MI, 2, STI, O);
208
209 printAnnotation(O, Annot);
210 return;
211 }
212 }
213
214 if (!printAliasInstr(MI, Address, STI, O))
215 printInstruction(MI, Address, STI, O);
216 printAnnotation(O, Annot);
217}
218
220 const MCSubtargetInfo &STI,
221 raw_ostream &O, StringRef Modifier) {
222 unsigned Code = MI->getOperand(OpNo).getImm();
223
224 if (Modifier == "cc") {
225 switch ((PPC::Predicate)Code) {
228 case PPC::PRED_LT:
229 O << "lt";
230 return;
233 case PPC::PRED_LE:
234 O << "le";
235 return;
238 case PPC::PRED_EQ:
239 O << "eq";
240 return;
243 case PPC::PRED_GE:
244 O << "ge";
245 return;
248 case PPC::PRED_GT:
249 O << "gt";
250 return;
253 case PPC::PRED_NE:
254 O << "ne";
255 return;
258 case PPC::PRED_UN:
259 O << "un";
260 return;
263 case PPC::PRED_NU:
264 O << "nu";
265 return;
268 llvm_unreachable("Invalid use of bit predicate code");
269 }
270 llvm_unreachable("Invalid predicate code");
271 }
272
273 if (Modifier == "pm") {
274 switch ((PPC::Predicate)Code) {
275 case PPC::PRED_LT:
276 case PPC::PRED_LE:
277 case PPC::PRED_EQ:
278 case PPC::PRED_GE:
279 case PPC::PRED_GT:
280 case PPC::PRED_NE:
281 case PPC::PRED_UN:
282 case PPC::PRED_NU:
283 return;
292 O << "-";
293 return;
302 O << "+";
303 return;
306 llvm_unreachable("Invalid use of bit predicate code");
307 }
308 llvm_unreachable("Invalid predicate code");
309 }
310
311 assert(Modifier == "reg" &&
312 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
313 printOperand(MI, OpNo + 1, STI, O);
314}
315
316void PPCInstPrinter::printATBitsAsHint(const MCInst *MI, unsigned OpNo,
317 const MCSubtargetInfo &STI,
318 raw_ostream &O) {
319 unsigned Code = MI->getOperand(OpNo).getImm();
320 if (Code == 2)
321 O << "-";
322 else if (Code == 3)
323 O << "+";
324}
325
326// Template for unsigned immediate operands with validation.
327// Validates that the value fits within the specified width and prints it.
328template <unsigned Width>
329void PPCInstPrinter::printUImmOperand(const MCInst *MI, unsigned OpNo,
330 const MCSubtargetInfo &STI,
331 raw_ostream &O) {
332 unsigned int Value = MI->getOperand(OpNo).getImm();
333 assert(Value <= ((1ULL << Width) - 1) && "Invalid uimm argument!");
334 O << (unsigned int)Value;
335}
336
337// Template for signed immediate operands with sign extension.
338// Sign-extends the value to the specified width and prints it.
339template <unsigned Width>
340void PPCInstPrinter::printSImmOperand(const MCInst *MI, unsigned OpNo,
341 const MCSubtargetInfo &STI,
342 raw_ostream &O) {
343 int Value = MI->getOperand(OpNo).getImm();
345 O << (int)Value;
346}
347
349 const MCSubtargetInfo &STI,
350 raw_ostream &O) {
351 unsigned int Value = MI->getOperand(OpNo).getImm();
352 assert(Value == 0 && "Operand must be zero");
353 O << (unsigned int)Value;
354}
355
356// Truncating version specifically for BUILD_VECTOR operands that may be
357// sign-extended (e.g., -1 becomes 0xFFFFFFFF). Truncates to 8 bits without
358// validation, unlike the standard printUImmOperand<8> which validates.
360 const MCSubtargetInfo &STI,
361 raw_ostream &O) {
362 unsigned char Value = MI->getOperand(OpNo).getImm();
363 O << (unsigned int)Value;
364}
365
367 const MCSubtargetInfo &STI,
368 raw_ostream &O) {
369 if (MI->getOperand(OpNo).isImm())
370 O << (short)MI->getOperand(OpNo).getImm();
371 else
372 printOperand(MI, OpNo, STI, O);
373}
374
376 const MCSubtargetInfo &STI,
377 raw_ostream &O) {
378 if (MI->getOperand(OpNo).isImm()) {
379 long long Value = MI->getOperand(OpNo).getImm();
380 assert(isInt<32>(Value) && "Invalid s32imm argument!");
381 O << (long long)Value;
382 } else
383 printOperand(MI, OpNo, STI, O);
384}
385
387 const MCSubtargetInfo &STI,
388 raw_ostream &O) {
389 if (MI->getOperand(OpNo).isImm()) {
390 long long Value = MI->getOperand(OpNo).getImm();
391 assert(isInt<32>(Value) && "Invalid s32imm argument!");
392 O << (long long)Value;
393 } else
394 printOperand(MI, OpNo, STI, O);
395}
396
398 const MCSubtargetInfo &STI,
399 raw_ostream &O) {
400 if (MI->getOperand(OpNo).isImm()) {
401 long long Value = MI->getOperand(OpNo).getImm();
402 assert(isInt<34>(Value) && "Invalid s34imm argument!");
403 O << (long long)Value;
404 }
405 else
406 printOperand(MI, OpNo, STI, O);
407}
408
410 const MCSubtargetInfo &STI,
411 raw_ostream &O) {
412 if (MI->getOperand(OpNo).isImm())
413 O << (unsigned short)MI->getOperand(OpNo).getImm();
414 else
415 printOperand(MI, OpNo, STI, O);
416}
417
419 unsigned OpNo,
420 const MCSubtargetInfo &STI,
421 raw_ostream &O) {
422 if (!MI->getOperand(OpNo).isImm())
423 return printOperand(MI, OpNo, STI, O);
424 int32_t Imm = SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
426 uint64_t Target = Address + Imm;
427 if (!TT.isPPC64())
428 Target &= 0xffffffff;
429 O << formatHex(Target);
430 } else {
431 // Branches can take an immediate operand. This is used by the branch
432 // selection pass to print, for example `.+8` (for ELF) or `$+8` (for AIX)
433 // to express an eight byte displacement from the program counter.
434 if (!TT.isOSAIX())
435 O << ".";
436 else
437 O << "$";
438
439 if (Imm >= 0)
440 O << "+";
441 O << Imm;
442 }
443}
444
446 const MCSubtargetInfo &STI,
447 raw_ostream &O) {
448 if (!MI->getOperand(OpNo).isImm())
449 return printOperand(MI, OpNo, STI, O);
450
451 uint64_t Imm = static_cast<uint64_t>(MI->getOperand(OpNo).getImm()) << 2;
452 if (!TT.isPPC64())
453 Imm = static_cast<uint32_t>(Imm);
454 O << formatHex(Imm);
455}
456
457void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo,
458 const MCSubtargetInfo &STI, raw_ostream &O) {
459 MCRegister CCReg = MI->getOperand(OpNo).getReg();
460 unsigned RegNo;
461 switch (CCReg.id()) {
462 default: llvm_unreachable("Unknown CR register");
463 case PPC::CR0: RegNo = 0; break;
464 case PPC::CR1: RegNo = 1; break;
465 case PPC::CR2: RegNo = 2; break;
466 case PPC::CR3: RegNo = 3; break;
467 case PPC::CR4: RegNo = 4; break;
468 case PPC::CR5: RegNo = 5; break;
469 case PPC::CR6: RegNo = 6; break;
470 case PPC::CR7: RegNo = 7; break;
471 }
472 O << (0x80 >> RegNo);
473}
474
475void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
476 const MCSubtargetInfo &STI,
477 raw_ostream &O) {
478 printS16ImmOperand(MI, OpNo, STI, O);
479 O << '(';
480 if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
481 O << "0";
482 else
483 printOperand(MI, OpNo + 1, STI, O);
484 O << ')';
485}
486
488 const MCSubtargetInfo &STI,
489 raw_ostream &O) {
490 O << MI->getOperand(OpNo).getImm();
491 O << '(';
492 printOperand(MI, OpNo + 1, STI, O);
493 O << ')';
494}
495
497 const MCSubtargetInfo &STI,
498 raw_ostream &O) {
499 printS34ImmOperand(MI, OpNo, STI, O);
500 O << '(';
501 printImmZeroOperand(MI, OpNo + 1, STI, O);
502 O << ')';
503}
504
505void PPCInstPrinter::printMemRegImm34(const MCInst *MI, unsigned OpNo,
506 const MCSubtargetInfo &STI,
507 raw_ostream &O) {
508 printS34ImmOperand(MI, OpNo, STI, O);
509 O << '(';
510 printOperand(MI, OpNo + 1, STI, O);
511 O << ')';
512}
513
514void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
515 const MCSubtargetInfo &STI,
516 raw_ostream &O) {
517 // When used as the base register, r0 reads constant zero rather than
518 // the value contained in the register. For this reason, the darwin
519 // assembler requires that we print r0 as 0 (no r) when used as the base.
520 if (MI->getOperand(OpNo).getReg() == PPC::R0)
521 O << "0";
522 else
523 printOperand(MI, OpNo, STI, O);
524 O << ", ";
525 printOperand(MI, OpNo + 1, STI, O);
526}
527
528void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
529 const MCSubtargetInfo &STI, raw_ostream &O) {
530 // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
531 // come at the _end_ of the expression.
532 const MCOperand &Op = MI->getOperand(OpNo);
533 const MCSymbolRefExpr *RefExp = nullptr;
534 const MCExpr *Rhs = nullptr;
535 if (const MCBinaryExpr *BinExpr = dyn_cast<MCBinaryExpr>(Op.getExpr())) {
536 RefExp = cast<MCSymbolRefExpr>(BinExpr->getLHS());
537 Rhs = BinExpr->getRHS();
538 } else
539 RefExp = cast<MCSymbolRefExpr>(Op.getExpr());
540
541 O << RefExp->getSymbol().getName();
542 // The variant kind VK_NOTOC needs to be handled as a special case
543 // because we do not want the assembly to print out the @notoc at the
544 // end like __tls_get_addr(x@tlsgd)@notoc. Instead we want it to look
545 // like __tls_get_addr@notoc(x@tlsgd).
546 if (getSpecifier(RefExp) == PPC::S_NOTOC)
547 O << '@' << MAI.getSpecifierName(RefExp->getKind());
548 O << '(';
549 printOperand(MI, OpNo + 1, STI, O);
550 O << ')';
551 if (getSpecifier(RefExp) != PPC::S_None &&
552 getSpecifier(RefExp) != PPC::S_NOTOC)
553 O << '@' << MAI.getSpecifierName(RefExp->getKind());
554 if (Rhs) {
555 SmallString<0> Buf;
556 raw_svector_ostream Tmp(Buf);
557 MAI.printExpr(Tmp, *Rhs);
558 if (isdigit(Buf[0]))
559 O << '+';
560 O << Buf;
561 }
562}
563
564/// showRegistersWithPercentPrefix - Check if this register name should be
565/// printed with a percentage symbol as prefix.
566bool PPCInstPrinter::showRegistersWithPercentPrefix(const char *RegName) const {
568 TT.getOS() == Triple::AIX)
569 return false;
570
571 switch (RegName[0]) {
572 default:
573 return false;
574 case 'r':
575 case 'f':
576 case 'q':
577 case 'v':
578 case 'c':
579 return true;
580 }
581}
582
583/// getVerboseConditionalRegName - This method expands the condition register
584/// when requested explicitly or targetting Darwin.
585const char *
586PPCInstPrinter::getVerboseConditionRegName(MCRegister Reg,
587 unsigned RegEncoding) const {
588 if (!FullRegNames && !MAI.useFullRegisterNames())
589 return nullptr;
590 if (Reg < PPC::CR0EQ || Reg > PPC::CR7UN)
591 return nullptr;
592 const char *CRBits[] = {
593 "lt", "gt", "eq", "un",
594 "4*cr1+lt", "4*cr1+gt", "4*cr1+eq", "4*cr1+un",
595 "4*cr2+lt", "4*cr2+gt", "4*cr2+eq", "4*cr2+un",
596 "4*cr3+lt", "4*cr3+gt", "4*cr3+eq", "4*cr3+un",
597 "4*cr4+lt", "4*cr4+gt", "4*cr4+eq", "4*cr4+un",
598 "4*cr5+lt", "4*cr5+gt", "4*cr5+eq", "4*cr5+un",
599 "4*cr6+lt", "4*cr6+gt", "4*cr6+eq", "4*cr6+un",
600 "4*cr7+lt", "4*cr7+gt", "4*cr7+eq", "4*cr7+un"
601 };
602 return CRBits[RegEncoding];
603}
604
605// showRegistersWithPrefix - This method determines whether registers
606// should be number-only or include the prefix.
607bool PPCInstPrinter::showRegistersWithPrefix() const {
608 return FullRegNamesWithPercent || FullRegNames || MAI.useFullRegisterNames();
609}
610
611void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
612 const MCSubtargetInfo &STI, raw_ostream &O) {
613 const MCOperand &Op = MI->getOperand(OpNo);
614 if (Op.isReg()) {
615 MCRegister Reg = Op.getReg();
616 if (!ShowVSRNumsAsVR)
617 Reg = PPC::getRegNumForOperand(MII.get(MI->getOpcode()), Reg, OpNo);
618
619 const char *RegName;
620 RegName = getVerboseConditionRegName(Reg, MRI.getEncodingValue(Reg));
621 if (RegName == nullptr)
623 if (showRegistersWithPercentPrefix(RegName))
624 O << "%";
625 if (!showRegistersWithPrefix())
627
628 O << RegName;
629 return;
630 }
631
632 if (Op.isImm()) {
633 O << Op.getImm();
634 return;
635 }
636
637 assert(Op.isExpr() && "unknown operand kind in printOperand");
638 MAI.printExpr(O, *Op.getExpr());
639}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
IRTranslator LLVM IR MI
#define RegName(no)
Register Reg
static cl::opt< bool > ShowVSRNumsAsVR("ppc-vsr-nums-as-vr", cl::Hidden, cl::init(false), cl::desc("Prints full register names with vs{31-63} as v{0-31}"))
static cl::opt< bool > FullRegNamesWithPercent("ppc-reg-with-percent-prefix", cl::Hidden, cl::init(false), cl::desc("Prints full register names with percent"))
static cl::opt< bool > FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false), cl::desc("Use full register names when printing assembly"))
bool useFullRegisterNames() const
Definition MCAsmInfo.h:592
Binary assembler expressions.
Definition MCExpr.h:299
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
format_object< int64_t > formatHex(int64_t Value) const
const MCInstrInfo & MII
const MCRegisterInfo & MRI
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
const MCAsmInfo & MAI
bool PrintBranchImmAsAddress
If true, a branch immediate (e.g.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Instances of this class represent operands of the MCInst class.
Definition MCInst.h:40
const MCExpr * getExpr() const
Definition MCInst.h:118
bool isExpr() const
Definition MCInst.h:69
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
constexpr unsigned id() const
Definition MCRegister.h:82
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
const MCSymbol & getSymbol() const
Definition MCExpr.h:227
VariantKind getKind() const
Definition MCExpr.h:232
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
void printMemRegImm34PCRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printcrbitm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printS32ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
bool printAliasInstr(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &OS)
void printMemRegReg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printPredicateOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printS34ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printS16ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printNegS32ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
void printMemRegImm34(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
void printU16ImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printSImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printMemRegImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printImmZeroOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printUImmOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printATBitsAsHint(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printTLSCall(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printU8ImmOperandTrunc(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printMemRegImmHash(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
OSType getOS() const
Get the parsed operating system type of this triple.
Definition Triple.h:444
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
const char * stripRegisterPrefix(const char *RegName)
stripRegisterPrefix - This method strips the character prefix from a register name so that only the n...
MCRegister getRegNumForOperand(const MCInstrDesc &Desc, MCRegister Reg, unsigned OpNo)
getRegNumForOperand - some operands use different numbering schemes for the same registers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:165
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
DWARFExpression::Operation Op
constexpr int32_t SignExtend32(uint32_t X)
Sign-extend the number in the bottom B bits of X to a 32-bit integer.
Definition MathExtras.h:554
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
static uint16_t getSpecifier(const MCSymbolRefExpr *SRE)