LLVM 24.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"
26using namespace llvm;
27
28#define DEBUG_TYPE "asm-printer"
29
30#define PRINT_ALIAS_INSTR
31#include "PPCGenAsmWriter.inc"
32
34 const MCRegisterInfo &MRI, Triple T)
36 CLOpts(PPC_MC::getCLOpts(MAI.getTargetOptions())), TT(T) {}
37
39 const char *RegName = getRegisterName(Reg);
40 OS << RegName;
41}
42
44 StringRef Annot, const MCSubtargetInfo &STI,
45 raw_ostream &O) {
46 // Customize printing of the addis instruction on AIX. When an operand is a
47 // symbol reference, the instruction syntax is changed to look like a load
48 // operation, i.e:
49 // Transform: addis $rD, $rA, $src --> addis $rD, $src($rA).
50 if (TT.isOSAIX() &&
51 (MI->getOpcode() == PPC::ADDIS8 || MI->getOpcode() == PPC::ADDIS) &&
52 MI->getOperand(2).isExpr()) {
53 assert((MI->getOperand(0).isReg() && MI->getOperand(1).isReg()) &&
54 "The first and the second operand of an addis instruction"
55 " should be registers.");
56
57 assert(isa<MCSymbolRefExpr>(MI->getOperand(2).getExpr()) &&
58 "The third operand of an addis instruction should be a symbol "
59 "reference expression if it is an expression at all.");
60
61 O << "\taddis ";
62 printOperand(MI, 0, STI, O);
63 O << ", ";
64 printOperand(MI, 2, STI, O);
65 O << "(";
66 printOperand(MI, 1, STI, O);
67 O << ")";
68 return;
69 }
70
71 // Check if the last operand is an expression with the variant kind
72 // VK_PCREL_OPT. If this is the case then this is a linker optimization
73 // relocation and the .reloc directive needs to be added.
74 unsigned LastOp = MI->getNumOperands() - 1;
75 if (MI->getNumOperands() > 1) {
76 const MCOperand &Operand = MI->getOperand(LastOp);
77 if (Operand.isExpr()) {
78 const MCExpr *Expr = Operand.getExpr();
79 const MCSymbolRefExpr *SymExpr =
80 static_cast<const MCSymbolRefExpr *>(Expr);
81
82 if (SymExpr && getSpecifier(SymExpr) == PPC::S_PCREL_OPT) {
83 const MCSymbol &Symbol = SymExpr->getSymbol();
84 if (MI->getOpcode() == PPC::PLDpc) {
85 printInstruction(MI, Address, STI, O);
86 O << "\n";
87 Symbol.print(O, &MAI);
88 O << ":";
89 return;
90 } else {
91 O << "\t.reloc ";
92 Symbol.print(O, &MAI);
93 O << "-8,R_PPC64_PCREL_OPT,.-(";
94 Symbol.print(O, &MAI);
95 O << "-8)\n";
96 }
97 }
98 }
99 }
100
101 // Check for slwi/srwi mnemonics.
102 if (MI->getOpcode() == PPC::RLWINM) {
103 unsigned char SH = MI->getOperand(2).getImm();
104 unsigned char MB = MI->getOperand(3).getImm();
105 unsigned char ME = MI->getOperand(4).getImm();
106 bool useSubstituteMnemonic = false;
107 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
108 O << "\tslwi "; useSubstituteMnemonic = true;
109 }
110 if (SH <= 31 && MB == (32-SH) && ME == 31) {
111 O << "\tsrwi "; useSubstituteMnemonic = true;
112 SH = 32-SH;
113 }
114 if (useSubstituteMnemonic) {
115 printOperand(MI, 0, STI, O);
116 O << ", ";
117 printOperand(MI, 1, STI, O);
118 O << ", " << (unsigned int)SH;
119
120 printAnnotation(O, Annot);
121 return;
122 }
123 }
124
125 if (MI->getOpcode() == PPC::RLDICR ||
126 MI->getOpcode() == PPC::RLDICR_32) {
127 unsigned char SH = MI->getOperand(2).getImm();
128 unsigned char ME = MI->getOperand(3).getImm();
129 // rldicr RA, RS, SH, 63-SH == sldi RA, RS, SH
130 if (63-SH == ME) {
131 O << "\tsldi ";
132 printOperand(MI, 0, STI, O);
133 O << ", ";
134 printOperand(MI, 1, STI, O);
135 O << ", " << (unsigned int)SH;
136 printAnnotation(O, Annot);
137 return;
138 }
139 }
140
141 // dcbt[st] is printed manually here because:
142 // 1. The assembly syntax is different between embedded and server targets
143 // 2. We must print the short mnemonics for TH == 0 because the
144 // embedded/server syntax default will not be stable across assemblers
145 // The syntax for dcbt is:
146 // dcbt ra, rb, th [server]
147 // dcbt th, ra, rb [embedded]
148 // where th can be omitted when it is 0. dcbtst is the same.
149 // On AIX, only emit the extended mnemonics for dcbt and dcbtst if
150 // the "modern assembler" is available.
151 if ((MI->getOpcode() == PPC::DCBT || MI->getOpcode() == PPC::DCBTST) &&
152 (!TT.isOSAIX() || STI.hasFeature(PPC::FeatureModernAIXAs))) {
153 unsigned char TH = MI->getOperand(0).getImm();
154 O << "\tdcbt";
155 if (MI->getOpcode() == PPC::DCBTST)
156 O << "st";
157 if (TH == 16)
158 O << "t";
159 O << " ";
160
161 bool IsBookE = STI.hasFeature(PPC::FeatureBookE);
162 if (IsBookE && TH != 0 && TH != 16)
163 O << (unsigned int) TH << ", ";
164
165 printOperand(MI, 1, STI, O);
166 O << ", ";
167 printOperand(MI, 2, STI, O);
168
169 if (!IsBookE && TH != 0 && TH != 16)
170 O << ", " << (unsigned int) TH;
171
172 printAnnotation(O, Annot);
173 return;
174 }
175
176 if (MI->getOpcode() == PPC::DCBF) {
177 unsigned char L = MI->getOperand(0).getImm();
178 if (!L || L == 1 || L == 3 || L == 4 || L == 6) {
179 O << "\tdcb";
180 if (L != 6)
181 O << "f";
182 if (L == 1)
183 O << "l";
184 if (L == 3)
185 O << "lp";
186 if (L == 4)
187 O << "ps";
188 if (L == 6)
189 O << "stps";
190 O << " ";
191
192 printOperand(MI, 1, STI, O);
193 O << ", ";
194 printOperand(MI, 2, STI, O);
195
196 printAnnotation(O, Annot);
197 return;
198 }
199 }
200
201 if (!printAliasInstr(MI, Address, STI, O))
202 printInstruction(MI, Address, STI, O);
203 printAnnotation(O, Annot);
204}
205
207 const MCSubtargetInfo &STI,
208 raw_ostream &O, StringRef Modifier) {
209 unsigned Code = MI->getOperand(OpNo).getImm();
210
211 if (Modifier == "cc") {
212 switch ((PPC::Predicate)Code) {
215 case PPC::PRED_LT:
216 O << "lt";
217 return;
220 case PPC::PRED_LE:
221 O << "le";
222 return;
225 case PPC::PRED_EQ:
226 O << "eq";
227 return;
230 case PPC::PRED_GE:
231 O << "ge";
232 return;
235 case PPC::PRED_GT:
236 O << "gt";
237 return;
240 case PPC::PRED_NE:
241 O << "ne";
242 return;
245 case PPC::PRED_UN:
246 O << "un";
247 return;
250 case PPC::PRED_NU:
251 O << "nu";
252 return;
255 llvm_unreachable("Invalid use of bit predicate code");
256 }
257 llvm_unreachable("Invalid predicate code");
258 }
259
260 if (Modifier == "pm") {
261 switch ((PPC::Predicate)Code) {
262 case PPC::PRED_LT:
263 case PPC::PRED_LE:
264 case PPC::PRED_EQ:
265 case PPC::PRED_GE:
266 case PPC::PRED_GT:
267 case PPC::PRED_NE:
268 case PPC::PRED_UN:
269 case PPC::PRED_NU:
270 return;
279 O << "-";
280 return;
289 O << "+";
290 return;
293 llvm_unreachable("Invalid use of bit predicate code");
294 }
295 llvm_unreachable("Invalid predicate code");
296 }
297
298 assert(Modifier == "reg" &&
299 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
300 printOperand(MI, OpNo + 1, STI, O);
301}
302
303void PPCInstPrinter::printATBitsAsHint(const MCInst *MI, unsigned OpNo,
304 const MCSubtargetInfo &STI,
305 raw_ostream &O) {
306 unsigned Code = MI->getOperand(OpNo).getImm();
307 if (Code == 2)
308 O << "-";
309 else if (Code == 3)
310 O << "+";
311}
312
313// Template for unsigned immediate operands with validation.
314// Validates that the value fits within the specified width and prints it.
315template <unsigned Width>
316void PPCInstPrinter::printUImmOperand(const MCInst *MI, unsigned OpNo,
317 const MCSubtargetInfo &STI,
318 raw_ostream &O) {
319 unsigned int Value = MI->getOperand(OpNo).getImm();
320 assert(Value <= ((1ULL << Width) - 1) && "Invalid uimm argument!");
321 O << (unsigned int)Value;
322}
323
324// Template for signed immediate operands with sign extension.
325// Sign-extends the value to the specified width and prints it.
326template <unsigned Width>
327void PPCInstPrinter::printSImmOperand(const MCInst *MI, unsigned OpNo,
328 const MCSubtargetInfo &STI,
329 raw_ostream &O) {
330 int Value = MI->getOperand(OpNo).getImm();
332 O << (int)Value;
333}
334
336 const MCSubtargetInfo &STI,
337 raw_ostream &O) {
338 unsigned int Value = MI->getOperand(OpNo).getImm();
339 assert(Value == 0 && "Operand must be zero");
340 O << (unsigned int)Value;
341}
342
343// Truncating version specifically for BUILD_VECTOR operands that may be
344// sign-extended (e.g., -1 becomes 0xFFFFFFFF). Truncates to 8 bits without
345// validation, unlike the standard printUImmOperand<8> which validates.
347 const MCSubtargetInfo &STI,
348 raw_ostream &O) {
349 unsigned char Value = MI->getOperand(OpNo).getImm();
350 O << (unsigned int)Value;
351}
352
354 const MCSubtargetInfo &STI,
355 raw_ostream &O) {
356 if (MI->getOperand(OpNo).isImm())
357 O << (short)MI->getOperand(OpNo).getImm();
358 else
359 printOperand(MI, OpNo, STI, O);
360}
361
363 const MCSubtargetInfo &STI,
364 raw_ostream &O) {
365 if (MI->getOperand(OpNo).isImm()) {
366 long long Value = MI->getOperand(OpNo).getImm();
367 assert(isInt<32>(Value) && "Invalid s32imm argument!");
368 O << (long long)Value;
369 } else
370 printOperand(MI, OpNo, STI, O);
371}
372
374 const MCSubtargetInfo &STI,
375 raw_ostream &O) {
376 if (MI->getOperand(OpNo).isImm()) {
377 long long Value = MI->getOperand(OpNo).getImm();
378 assert(isInt<32>(Value) && "Invalid s32imm argument!");
379 O << (long long)Value;
380 } else
381 printOperand(MI, OpNo, STI, O);
382}
383
385 const MCSubtargetInfo &STI,
386 raw_ostream &O) {
387 if (MI->getOperand(OpNo).isImm()) {
388 long long Value = MI->getOperand(OpNo).getImm();
389 assert(isInt<34>(Value) && "Invalid s34imm argument!");
390 O << (long long)Value;
391 }
392 else
393 printOperand(MI, OpNo, STI, O);
394}
395
397 const MCSubtargetInfo &STI,
398 raw_ostream &O) {
399 if (MI->getOperand(OpNo).isImm())
400 O << (unsigned short)MI->getOperand(OpNo).getImm();
401 else
402 printOperand(MI, OpNo, STI, O);
403}
404
406 unsigned OpNo,
407 const MCSubtargetInfo &STI,
408 raw_ostream &O) {
409 if (!MI->getOperand(OpNo).isImm())
410 return printOperand(MI, OpNo, STI, O);
411 int32_t Imm = SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
413 uint64_t Target = Address + Imm;
414 if (!TT.isPPC64())
415 Target &= 0xffffffff;
416 O << formatHex(Target);
417 } else {
418 // Branches can take an immediate operand. This is used by the branch
419 // selection pass to print, for example `.+8` (for ELF) or `$+8` (for AIX)
420 // to express an eight byte displacement from the program counter.
421 if (!TT.isOSAIX())
422 O << ".";
423 else
424 O << "$";
425
426 if (Imm >= 0)
427 O << "+";
428 O << Imm;
429 }
430}
431
433 const MCSubtargetInfo &STI,
434 raw_ostream &O) {
435 if (!MI->getOperand(OpNo).isImm())
436 return printOperand(MI, OpNo, STI, O);
437
438 uint64_t Imm = static_cast<uint64_t>(MI->getOperand(OpNo).getImm()) << 2;
439 if (!TT.isPPC64())
440 Imm = static_cast<uint32_t>(Imm);
441 O << formatHex(Imm);
442}
443
444void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo,
445 const MCSubtargetInfo &STI, raw_ostream &O) {
446 MCRegister CCReg = MI->getOperand(OpNo).getReg();
447 unsigned RegNo;
448 switch (CCReg.id()) {
449 default: llvm_unreachable("Unknown CR register");
450 case PPC::CR0: RegNo = 0; break;
451 case PPC::CR1: RegNo = 1; break;
452 case PPC::CR2: RegNo = 2; break;
453 case PPC::CR3: RegNo = 3; break;
454 case PPC::CR4: RegNo = 4; break;
455 case PPC::CR5: RegNo = 5; break;
456 case PPC::CR6: RegNo = 6; break;
457 case PPC::CR7: RegNo = 7; break;
458 }
459 O << (0x80 >> RegNo);
460}
461
462void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
463 const MCSubtargetInfo &STI,
464 raw_ostream &O) {
465 printS16ImmOperand(MI, OpNo, STI, O);
466 O << '(';
467 if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
468 O << "0";
469 else
470 printOperand(MI, OpNo + 1, STI, O);
471 O << ')';
472}
473
475 const MCSubtargetInfo &STI,
476 raw_ostream &O) {
477 O << MI->getOperand(OpNo).getImm();
478 O << '(';
479 printOperand(MI, OpNo + 1, STI, O);
480 O << ')';
481}
482
484 const MCSubtargetInfo &STI,
485 raw_ostream &O) {
486 printS34ImmOperand(MI, OpNo, STI, O);
487 O << '(';
488 printImmZeroOperand(MI, OpNo + 1, STI, O);
489 O << ')';
490}
491
492void PPCInstPrinter::printMemRegImm34(const MCInst *MI, unsigned OpNo,
493 const MCSubtargetInfo &STI,
494 raw_ostream &O) {
495 printS34ImmOperand(MI, OpNo, STI, O);
496 O << '(';
497 printOperand(MI, OpNo + 1, STI, O);
498 O << ')';
499}
500
501void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
502 const MCSubtargetInfo &STI,
503 raw_ostream &O) {
504 // When used as the base register, r0 reads constant zero rather than
505 // the value contained in the register. For this reason, the darwin
506 // assembler requires that we print r0 as 0 (no r) when used as the base.
507 if (MI->getOperand(OpNo).getReg() == PPC::R0)
508 O << "0";
509 else
510 printOperand(MI, OpNo, STI, O);
511 O << ", ";
512 printOperand(MI, OpNo + 1, STI, O);
513}
514
515void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
516 const MCSubtargetInfo &STI, raw_ostream &O) {
517 // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
518 // come at the _end_ of the expression.
519 const MCOperand &Op = MI->getOperand(OpNo);
520 const MCSymbolRefExpr *RefExp = nullptr;
521 const MCExpr *Rhs = nullptr;
522 if (const MCBinaryExpr *BinExpr = dyn_cast<MCBinaryExpr>(Op.getExpr())) {
523 RefExp = cast<MCSymbolRefExpr>(BinExpr->getLHS());
524 Rhs = BinExpr->getRHS();
525 } else
526 RefExp = cast<MCSymbolRefExpr>(Op.getExpr());
527
528 O << RefExp->getSymbol().getName();
529 // The variant kind VK_NOTOC needs to be handled as a special case
530 // because we do not want the assembly to print out the @notoc at the
531 // end like __tls_get_addr(x@tlsgd)@notoc. Instead we want it to look
532 // like __tls_get_addr@notoc(x@tlsgd).
533 if (getSpecifier(RefExp) == PPC::S_NOTOC)
534 O << '@' << MAI.getSpecifierName(RefExp->getKind());
535 O << '(';
536 printOperand(MI, OpNo + 1, STI, O);
537 O << ')';
538 if (getSpecifier(RefExp) != PPC::S_None &&
539 getSpecifier(RefExp) != PPC::S_NOTOC)
540 O << '@' << MAI.getSpecifierName(RefExp->getKind());
541 if (Rhs) {
542 SmallString<0> Buf;
543 raw_svector_ostream Tmp(Buf);
544 MAI.printExpr(Tmp, *Rhs);
545 if (isdigit(Buf[0]))
546 O << '+';
547 O << Buf;
548 }
549}
550
551/// showRegistersWithPercentPrefix - Check if this register name should be
552/// printed with a percentage symbol as prefix.
553bool PPCInstPrinter::showRegistersWithPercentPrefix(const char *RegName) const {
554 if ((!CLOpts.reg_with_percent_prefix && !MAI.useFullRegisterNames()) ||
555 TT.getOS() == Triple::AIX)
556 return false;
557
558 switch (RegName[0]) {
559 default:
560 return false;
561 case 'r':
562 case 'f':
563 case 'q':
564 case 'v':
565 case 'c':
566 return true;
567 }
568}
569
570/// getVerboseConditionalRegName - This method expands the condition register
571/// when requested explicitly or targetting Darwin.
572const char *
573PPCInstPrinter::getVerboseConditionRegName(MCRegister Reg,
574 unsigned RegEncoding) const {
575 if (!CLOpts.asm_full_reg_names && !MAI.useFullRegisterNames())
576 return nullptr;
577 if (Reg < PPC::CR0EQ || Reg > PPC::CR7UN)
578 return nullptr;
579 const char *CRBits[] = {
580 "lt", "gt", "eq", "un",
581 "4*cr1+lt", "4*cr1+gt", "4*cr1+eq", "4*cr1+un",
582 "4*cr2+lt", "4*cr2+gt", "4*cr2+eq", "4*cr2+un",
583 "4*cr3+lt", "4*cr3+gt", "4*cr3+eq", "4*cr3+un",
584 "4*cr4+lt", "4*cr4+gt", "4*cr4+eq", "4*cr4+un",
585 "4*cr5+lt", "4*cr5+gt", "4*cr5+eq", "4*cr5+un",
586 "4*cr6+lt", "4*cr6+gt", "4*cr6+eq", "4*cr6+un",
587 "4*cr7+lt", "4*cr7+gt", "4*cr7+eq", "4*cr7+un"
588 };
589 return CRBits[RegEncoding];
590}
591
592// showRegistersWithPrefix - This method determines whether registers
593// should be number-only or include the prefix.
594bool PPCInstPrinter::showRegistersWithPrefix() const {
595 return CLOpts.reg_with_percent_prefix || CLOpts.asm_full_reg_names ||
596 MAI.useFullRegisterNames();
597}
598
599void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
600 const MCSubtargetInfo &STI, raw_ostream &O) {
601 const MCOperand &Op = MI->getOperand(OpNo);
602 if (Op.isReg()) {
603 MCRegister Reg = Op.getReg();
604 if (!CLOpts.vsr_nums_as_vr)
605 Reg = PPC::getRegNumForOperand(MII.get(MI->getOpcode()), Reg, OpNo);
606
607 const char *RegName;
608 RegName = getVerboseConditionRegName(Reg, MRI.getEncodingValue(Reg));
609 if (RegName == nullptr)
611 if (showRegistersWithPercentPrefix(RegName))
612 O << "%";
613 if (!showRegistersWithPrefix())
615
616 O << RegName;
617 return;
618 }
619
620 if (Op.isImm()) {
621 O << Op.getImm();
622 return;
623 }
624
625 assert(Op.isExpr() && "unknown operand kind in printOperand");
626 MAI.printExpr(O, *Op.getExpr());
627}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t Imm
IRTranslator LLVM IR MI
#define RegName(no)
Register Reg
#define T
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
bool useFullRegisterNames() const
Definition MCAsmInfo.h:611
Binary assembler expressions.
Definition MCExpr.h:298
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.
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
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
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
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:226
VariantKind getKind() const
Definition MCExpr.h:231
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)
PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI, Triple T)
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:28
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
OSType getOS() const
Get the parsed operating system type of this triple.
Definition Triple.h:526
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.
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:166
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)