blob: d1c4b59e55915ec8818507a159dc8c90c7658757 [file] [log] [blame]
Chris Lattnera76eab42010-11-14 19:40:38 +00001//===-- PPCInstPrinter.cpp - Convert PPC MCInst to assembly syntax --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This class prints an PPC MCInst to a .s file.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattnera76eab42010-11-14 19:40:38 +000014#include "PPCInstPrinter.h"
Hal Finkelfeea6532013-03-26 20:08:20 +000015#include "MCTargetDesc/PPCMCTargetDesc.h"
Evan Cheng11424442011-07-26 00:24:13 +000016#include "MCTargetDesc/PPCPredicates.h"
Chris Lattner7a5c57e2010-11-14 20:02:39 +000017#include "llvm/MC/MCExpr.h"
Chris Lattnera76eab42010-11-14 19:40:38 +000018#include "llvm/MC/MCInst.h"
Craig Topperdab9e352012-04-02 07:01:04 +000019#include "llvm/MC/MCInstrInfo.h"
Pete Cooper3de83e42015-05-15 21:58:42 +000020#include "llvm/MC/MCRegisterInfo.h"
21#include "llvm/MC/MCSubtargetInfo.h"
Hal Finkel7c8ae532014-07-25 17:47:22 +000022#include "llvm/MC/MCSymbol.h"
Hal Finkelc6a24392013-11-11 14:58:40 +000023#include "llvm/Support/CommandLine.h"
Chris Lattnera76eab42010-11-14 19:40:38 +000024#include "llvm/Support/raw_ostream.h"
Bill Schmidt8d86fe72013-08-30 15:18:11 +000025#include "llvm/Target/TargetOpcodes.h"
Chris Lattnera76eab42010-11-14 19:40:38 +000026using namespace llvm;
27
Chandler Carruth84e68b22014-04-22 02:41:26 +000028#define DEBUG_TYPE "asm-printer"
29
Hal Finkelc6a24392013-11-11 14:58:40 +000030// FIXME: Once the integrated assembler supports full register names, tie this
31// to the verbose-asm setting.
32static cl::opt<bool>
33FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false),
34 cl::desc("Use full register names when printing assembly"));
35
Hal Finkel7c5cb062015-04-23 18:30:38 +000036#define PRINT_ALIAS_INSTR
Chris Lattnera76eab42010-11-14 19:40:38 +000037#include "PPCGenAsmWriter.inc"
38
Rafael Espindolad6860522011-06-02 02:34:55 +000039void PPCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
Hal Finkelc93a9a22015-02-25 01:06:45 +000040 const char *RegName = getRegisterName(RegNo);
41 if (RegName[0] == 'q' /* QPX */) {
42 // The system toolchain on the BG/Q does not understand QPX register names
43 // in .cfi_* directives, so print the name of the floating-point
44 // subregister instead.
45 std::string RN(RegName);
46
47 RN[0] = 'f';
48 OS << RN;
49
50 return;
51 }
52
53 OS << RegName;
Rafael Espindola08600bc2011-05-30 20:20:15 +000054}
Chris Lattnera76eab42010-11-14 19:40:38 +000055
Owen Andersona0c3b972011-09-15 23:38:46 +000056void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
Akira Hatanakab46d0232015-03-27 20:36:02 +000057 StringRef Annot, const MCSubtargetInfo &STI) {
Chris Lattner219cc3d2010-11-14 21:39:51 +000058 // Check for slwi/srwi mnemonics.
59 if (MI->getOpcode() == PPC::RLWINM) {
60 unsigned char SH = MI->getOperand(2).getImm();
61 unsigned char MB = MI->getOperand(3).getImm();
62 unsigned char ME = MI->getOperand(4).getImm();
63 bool useSubstituteMnemonic = false;
64 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
65 O << "\tslwi "; useSubstituteMnemonic = true;
66 }
67 if (SH <= 31 && MB == (32-SH) && ME == 31) {
68 O << "\tsrwi "; useSubstituteMnemonic = true;
69 SH = 32-SH;
70 }
71 if (useSubstituteMnemonic) {
72 printOperand(MI, 0, O);
73 O << ", ";
74 printOperand(MI, 1, O);
75 O << ", " << (unsigned int)SH;
Owen Andersona0c3b972011-09-15 23:38:46 +000076
Owen Andersonbcc3fad2011-09-21 17:58:45 +000077 printAnnotation(O, Annot);
Chris Lattner219cc3d2010-11-14 21:39:51 +000078 return;
79 }
80 }
81
82 if ((MI->getOpcode() == PPC::OR || MI->getOpcode() == PPC::OR8) &&
83 MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) {
84 O << "\tmr ";
85 printOperand(MI, 0, O);
86 O << ", ";
87 printOperand(MI, 1, O);
Owen Andersonbcc3fad2011-09-21 17:58:45 +000088 printAnnotation(O, Annot);
Chris Lattner219cc3d2010-11-14 21:39:51 +000089 return;
90 }
91
92 if (MI->getOpcode() == PPC::RLDICR) {
93 unsigned char SH = MI->getOperand(2).getImm();
94 unsigned char ME = MI->getOperand(3).getImm();
95 // rldicr RA, RS, SH, 63-SH == sldi RA, RS, SH
96 if (63-SH == ME) {
97 O << "\tsldi ";
98 printOperand(MI, 0, O);
99 O << ", ";
100 printOperand(MI, 1, O);
101 O << ", " << (unsigned int)SH;
Owen Andersonbcc3fad2011-09-21 17:58:45 +0000102 printAnnotation(O, Annot);
Chris Lattner219cc3d2010-11-14 21:39:51 +0000103 return;
104 }
105 }
Hal Finkelfefcfff2015-04-23 22:47:57 +0000106
107 // dcbt[st] is printed manually here because:
108 // 1. The assembly syntax is different between embedded and server targets
109 // 2. We must print the short mnemonics for TH == 0 because the
110 // embedded/server syntax default will not be stable across assemblers
111 // The syntax for dcbt is:
112 // dcbt ra, rb, th [server]
113 // dcbt th, ra, rb [embedded]
114 // where th can be omitted when it is 0. dcbtst is the same.
115 if (MI->getOpcode() == PPC::DCBT || MI->getOpcode() == PPC::DCBTST) {
116 unsigned char TH = MI->getOperand(0).getImm();
117 O << "\tdcbt";
118 if (MI->getOpcode() == PPC::DCBTST)
119 O << "st";
120 if (TH == 16)
121 O << "t";
122 O << " ";
123
Michael Kupersteindb0712f2015-05-26 10:47:10 +0000124 bool IsBookE = STI.getFeatureBits()[PPC::FeatureBookE];
Hal Finkelfefcfff2015-04-23 22:47:57 +0000125 if (IsBookE && TH != 0 && TH != 16)
126 O << (unsigned int) TH << ", ";
127
128 printOperand(MI, 1, O);
129 O << ", ";
130 printOperand(MI, 2, O);
131
132 if (!IsBookE && TH != 0 && TH != 16)
133 O << ", " << (unsigned int) TH;
134
135 printAnnotation(O, Annot);
136 return;
137 }
Hal Finkel277736e2016-09-02 23:41:54 +0000138
139 if (MI->getOpcode() == PPC::DCBF) {
140 unsigned char L = MI->getOperand(0).getImm();
141 if (!L || L == 1 || L == 3) {
142 O << "\tdcbf";
143 if (L == 1 || L == 3)
144 O << "l";
145 if (L == 3)
146 O << "p";
147 O << " ";
148
149 printOperand(MI, 1, O);
150 O << ", ";
151 printOperand(MI, 2, O);
152
153 printAnnotation(O, Annot);
154 return;
155 }
156 }
Chris Lattner219cc3d2010-11-14 21:39:51 +0000157
Hal Finkel7c5cb062015-04-23 18:30:38 +0000158 if (!printAliasInstr(MI, O))
159 printInstruction(MI, O);
Owen Andersonbcc3fad2011-09-21 17:58:45 +0000160 printAnnotation(O, Annot);
Chris Lattnera76eab42010-11-14 19:40:38 +0000161}
162
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000163
164void PPCInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNo,
165 raw_ostream &O,
166 const char *Modifier) {
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000167 unsigned Code = MI->getOperand(OpNo).getImm();
Hal Finkel460e94d2012-06-22 23:10:08 +0000168
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000169 if (StringRef(Modifier) == "cc") {
170 switch ((PPC::Predicate)Code) {
Ulrich Weigand86247b62013-06-24 16:52:04 +0000171 case PPC::PRED_LT_MINUS:
172 case PPC::PRED_LT_PLUS:
173 case PPC::PRED_LT:
174 O << "lt";
175 return;
176 case PPC::PRED_LE_MINUS:
177 case PPC::PRED_LE_PLUS:
178 case PPC::PRED_LE:
179 O << "le";
180 return;
181 case PPC::PRED_EQ_MINUS:
182 case PPC::PRED_EQ_PLUS:
183 case PPC::PRED_EQ:
184 O << "eq";
185 return;
186 case PPC::PRED_GE_MINUS:
187 case PPC::PRED_GE_PLUS:
188 case PPC::PRED_GE:
189 O << "ge";
190 return;
191 case PPC::PRED_GT_MINUS:
192 case PPC::PRED_GT_PLUS:
193 case PPC::PRED_GT:
194 O << "gt";
195 return;
196 case PPC::PRED_NE_MINUS:
197 case PPC::PRED_NE_PLUS:
198 case PPC::PRED_NE:
199 O << "ne";
200 return;
201 case PPC::PRED_UN_MINUS:
202 case PPC::PRED_UN_PLUS:
203 case PPC::PRED_UN:
204 O << "un";
205 return;
206 case PPC::PRED_NU_MINUS:
207 case PPC::PRED_NU_PLUS:
208 case PPC::PRED_NU:
209 O << "nu";
210 return;
Hal Finkel940ab932014-02-28 00:27:01 +0000211 case PPC::PRED_BIT_SET:
212 case PPC::PRED_BIT_UNSET:
213 llvm_unreachable("Invalid use of bit predicate code");
Ulrich Weigand86247b62013-06-24 16:52:04 +0000214 }
Benjamin Kramer3912d782013-06-24 17:03:25 +0000215 llvm_unreachable("Invalid predicate code");
Ulrich Weigand86247b62013-06-24 16:52:04 +0000216 }
217
218 if (StringRef(Modifier) == "pm") {
219 switch ((PPC::Predicate)Code) {
220 case PPC::PRED_LT:
221 case PPC::PRED_LE:
222 case PPC::PRED_EQ:
223 case PPC::PRED_GE:
224 case PPC::PRED_GT:
225 case PPC::PRED_NE:
226 case PPC::PRED_UN:
227 case PPC::PRED_NU:
228 return;
229 case PPC::PRED_LT_MINUS:
230 case PPC::PRED_LE_MINUS:
231 case PPC::PRED_EQ_MINUS:
232 case PPC::PRED_GE_MINUS:
233 case PPC::PRED_GT_MINUS:
234 case PPC::PRED_NE_MINUS:
235 case PPC::PRED_UN_MINUS:
236 case PPC::PRED_NU_MINUS:
237 O << "-";
238 return;
239 case PPC::PRED_LT_PLUS:
240 case PPC::PRED_LE_PLUS:
241 case PPC::PRED_EQ_PLUS:
242 case PPC::PRED_GE_PLUS:
243 case PPC::PRED_GT_PLUS:
244 case PPC::PRED_NE_PLUS:
245 case PPC::PRED_UN_PLUS:
246 case PPC::PRED_NU_PLUS:
247 O << "+";
248 return;
Hal Finkel940ab932014-02-28 00:27:01 +0000249 case PPC::PRED_BIT_SET:
250 case PPC::PRED_BIT_UNSET:
251 llvm_unreachable("Invalid use of bit predicate code");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000252 }
Benjamin Kramer3912d782013-06-24 17:03:25 +0000253 llvm_unreachable("Invalid predicate code");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000254 }
255
256 assert(StringRef(Modifier) == "reg" &&
Ulrich Weigand86247b62013-06-24 16:52:04 +0000257 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000258 printOperand(MI, OpNo+1, O);
259}
260
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000261void PPCInstPrinter::printU1ImmOperand(const MCInst *MI, unsigned OpNo,
262 raw_ostream &O) {
263 unsigned int Value = MI->getOperand(OpNo).getImm();
264 assert(Value <= 1 && "Invalid u1imm argument!");
265 O << (unsigned int)Value;
266}
267
Hal Finkel27774d92014-03-13 07:58:58 +0000268void PPCInstPrinter::printU2ImmOperand(const MCInst *MI, unsigned OpNo,
269 raw_ostream &O) {
270 unsigned int Value = MI->getOperand(OpNo).getImm();
271 assert(Value <= 3 && "Invalid u2imm argument!");
272 O << (unsigned int)Value;
273}
274
Kit Barton535e69d2015-03-25 19:36:23 +0000275void PPCInstPrinter::printU3ImmOperand(const MCInst *MI, unsigned OpNo,
276 raw_ostream &O) {
277 unsigned int Value = MI->getOperand(OpNo).getImm();
278 assert(Value <= 8 && "Invalid u3imm argument!");
279 O << (unsigned int)Value;
280}
281
Joerg Sonnenberger9e9623c2014-07-29 22:21:57 +0000282void PPCInstPrinter::printU4ImmOperand(const MCInst *MI, unsigned OpNo,
283 raw_ostream &O) {
284 unsigned int Value = MI->getOperand(OpNo).getImm();
285 assert(Value <= 15 && "Invalid u4imm argument!");
286 O << (unsigned int)Value;
287}
288
Chris Lattner94881432010-11-14 20:11:21 +0000289void PPCInstPrinter::printS5ImmOperand(const MCInst *MI, unsigned OpNo,
290 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000291 int Value = MI->getOperand(OpNo).getImm();
Richard Smith228e6d42012-08-24 23:29:28 +0000292 Value = SignExtend32<5>(Value);
Chris Lattner94881432010-11-14 20:11:21 +0000293 O << (int)Value;
294}
295
296void PPCInstPrinter::printU5ImmOperand(const MCInst *MI, unsigned OpNo,
297 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000298 unsigned int Value = MI->getOperand(OpNo).getImm();
Chris Lattner94881432010-11-14 20:11:21 +0000299 assert(Value <= 31 && "Invalid u5imm argument!");
300 O << (unsigned int)Value;
301}
302
303void PPCInstPrinter::printU6ImmOperand(const MCInst *MI, unsigned OpNo,
304 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000305 unsigned int Value = MI->getOperand(OpNo).getImm();
Chris Lattner94881432010-11-14 20:11:21 +0000306 assert(Value <= 63 && "Invalid u6imm argument!");
307 O << (unsigned int)Value;
308}
309
Chuang-Yu Cheng80722712016-03-28 08:34:28 +0000310void PPCInstPrinter::printU7ImmOperand(const MCInst *MI, unsigned OpNo,
311 raw_ostream &O) {
312 unsigned int Value = MI->getOperand(OpNo).getImm();
313 assert(Value <= 127 && "Invalid u7imm argument!");
314 O << (unsigned int)Value;
315}
316
317void PPCInstPrinter::printU8ImmOperand(const MCInst *MI, unsigned OpNo,
318 raw_ostream &O) {
319 unsigned int Value = MI->getOperand(OpNo).getImm();
320 assert(Value <= 255 && "Invalid u8imm argument!");
321 O << (unsigned int)Value;
322}
323
Bill Schmidte26236e2015-05-22 16:44:10 +0000324void PPCInstPrinter::printU10ImmOperand(const MCInst *MI, unsigned OpNo,
325 raw_ostream &O) {
326 unsigned short Value = MI->getOperand(OpNo).getImm();
327 assert(Value <= 1023 && "Invalid u10imm argument!");
328 O << (unsigned short)Value;
329}
330
Hal Finkelc93a9a22015-02-25 01:06:45 +0000331void PPCInstPrinter::printU12ImmOperand(const MCInst *MI, unsigned OpNo,
332 raw_ostream &O) {
333 unsigned short Value = MI->getOperand(OpNo).getImm();
334 assert(Value <= 4095 && "Invalid u12imm argument!");
335 O << (unsigned short)Value;
336}
337
Chris Lattner94881432010-11-14 20:11:21 +0000338void PPCInstPrinter::printS16ImmOperand(const MCInst *MI, unsigned OpNo,
339 raw_ostream &O) {
Ulrich Weigand41789de2013-05-23 22:26:41 +0000340 if (MI->getOperand(OpNo).isImm())
341 O << (short)MI->getOperand(OpNo).getImm();
342 else
343 printOperand(MI, OpNo, O);
Chris Lattner94881432010-11-14 20:11:21 +0000344}
345
346void PPCInstPrinter::printU16ImmOperand(const MCInst *MI, unsigned OpNo,
347 raw_ostream &O) {
Ulrich Weigandfd3ad692013-06-26 13:49:15 +0000348 if (MI->getOperand(OpNo).isImm())
349 O << (unsigned short)MI->getOperand(OpNo).getImm();
350 else
351 printOperand(MI, OpNo, O);
Chris Lattner94881432010-11-14 20:11:21 +0000352}
353
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000354void PPCInstPrinter::printBranchOperand(const MCInst *MI, unsigned OpNo,
355 raw_ostream &O) {
356 if (!MI->getOperand(OpNo).isImm())
357 return printOperand(MI, OpNo, O);
358
359 // Branches can take an immediate operand. This is used by the branch
Ulrich Weigandb9d5d072013-05-03 19:53:04 +0000360 // selection pass to print .+8, an eight byte displacement from the PC.
361 O << ".+";
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000362 printAbsBranchOperand(MI, OpNo, O);
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000363}
364
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000365void PPCInstPrinter::printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
366 raw_ostream &O) {
367 if (!MI->getOperand(OpNo).isImm())
368 return printOperand(MI, OpNo, O);
369
Alexey Samsonov9ca48702014-09-02 17:38:34 +0000370 O << SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000371}
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000372
373
Chris Lattner0dcd8002010-11-14 20:22:56 +0000374void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo,
375 raw_ostream &O) {
376 unsigned CCReg = MI->getOperand(OpNo).getReg();
377 unsigned RegNo;
378 switch (CCReg) {
Craig Toppere55c5562012-02-07 02:50:20 +0000379 default: llvm_unreachable("Unknown CR register");
Chris Lattner0dcd8002010-11-14 20:22:56 +0000380 case PPC::CR0: RegNo = 0; break;
381 case PPC::CR1: RegNo = 1; break;
382 case PPC::CR2: RegNo = 2; break;
383 case PPC::CR3: RegNo = 3; break;
384 case PPC::CR4: RegNo = 4; break;
385 case PPC::CR5: RegNo = 5; break;
386 case PPC::CR6: RegNo = 6; break;
387 case PPC::CR7: RegNo = 7; break;
388 }
389 O << (0x80 >> RegNo);
390}
391
392void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
393 raw_ostream &O) {
Ulrich Weigand41789de2013-05-23 22:26:41 +0000394 printS16ImmOperand(MI, OpNo, O);
Chris Lattner0dcd8002010-11-14 20:22:56 +0000395 O << '(';
Chris Lattnerfd56ee22010-11-15 03:51:13 +0000396 if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
Chris Lattner0dcd8002010-11-14 20:22:56 +0000397 O << "0";
398 else
399 printOperand(MI, OpNo+1, O);
400 O << ')';
401}
402
Chris Lattner0dcd8002010-11-14 20:22:56 +0000403void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
404 raw_ostream &O) {
405 // When used as the base register, r0 reads constant zero rather than
406 // the value contained in the register. For this reason, the darwin
407 // assembler requires that we print r0 as 0 (no r) when used as the base.
408 if (MI->getOperand(OpNo).getReg() == PPC::R0)
409 O << "0";
410 else
411 printOperand(MI, OpNo, O);
412 O << ", ";
413 printOperand(MI, OpNo+1, O);
414}
415
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000416void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
417 raw_ostream &O) {
Hal Finkel7c8ae532014-07-25 17:47:22 +0000418 // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
419 // come at the _end_ of the expression.
420 const MCOperand &Op = MI->getOperand(OpNo);
421 const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*Op.getExpr());
422 O << refExp.getSymbol().getName();
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000423 O << '(';
424 printOperand(MI, OpNo+1, O);
425 O << ')';
Hal Finkel7c8ae532014-07-25 17:47:22 +0000426 if (refExp.getKind() != MCSymbolRefExpr::VK_None)
427 O << '@' << MCSymbolRefExpr::getVariantKindName(refExp.getKind());
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000428}
Chris Lattner0dcd8002010-11-14 20:22:56 +0000429
Chris Lattner94881432010-11-14 20:11:21 +0000430
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000431/// stripRegisterPrefix - This method strips the character prefix from a
432/// register name so that only the number is left. Used by for linux asm.
Benjamin Krameraef5bd02010-11-25 16:42:51 +0000433static const char *stripRegisterPrefix(const char *RegName) {
Hal Finkelc6a24392013-11-11 14:58:40 +0000434 if (FullRegNames)
435 return RegName;
436
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000437 switch (RegName[0]) {
438 case 'r':
439 case 'f':
Hal Finkelc93a9a22015-02-25 01:06:45 +0000440 case 'q': // for QPX
Hal Finkel27774d92014-03-13 07:58:58 +0000441 case 'v':
442 if (RegName[1] == 's')
443 return RegName + 2;
444 return RegName + 1;
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000445 case 'c': if (RegName[1] == 'r') return RegName + 2;
446 }
447
448 return RegName;
449}
450
451void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
452 raw_ostream &O) {
453 const MCOperand &Op = MI->getOperand(OpNo);
454 if (Op.isReg()) {
455 const char *RegName = getRegisterName(Op.getReg());
456 // The linux and AIX assembler does not take register prefixes.
457 if (!isDarwinSyntax())
458 RegName = stripRegisterPrefix(RegName);
459
460 O << RegName;
461 return;
462 }
463
464 if (Op.isImm()) {
465 O << Op.getImm();
466 return;
467 }
468
469 assert(Op.isExpr() && "unknown operand kind in printOperand");
Matt Arsenault8b643552015-06-09 00:31:39 +0000470 Op.getExpr()->print(O, &MAI);
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000471}
Chris Lattnercfb62872010-11-14 21:54:34 +0000472