blob: 5214303ec82a1fe3cc3fe5a3e362655543a802db [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 }
Chris Lattner219cc3d2010-11-14 21:39:51 +0000138
Bill Schmidt8d86fe72013-08-30 15:18:11 +0000139 // For fast-isel, a COPY_TO_REGCLASS may survive this long. This is
140 // used when converting a 32-bit float to a 64-bit float as part of
141 // conversion to an integer (see PPCFastISel.cpp:SelectFPToI()),
142 // as otherwise we have problems with incorrect register classes
143 // in machine instruction verification. For now, just avoid trying
144 // to print it as such an instruction has no effect (a 32-bit float
145 // in a register is already in 64-bit form, just with lower
146 // precision). FIXME: Is there a better solution?
147 if (MI->getOpcode() == TargetOpcode::COPY_TO_REGCLASS)
148 return;
Hal Finkel7c5cb062015-04-23 18:30:38 +0000149
150 if (!printAliasInstr(MI, O))
151 printInstruction(MI, O);
Owen Andersonbcc3fad2011-09-21 17:58:45 +0000152 printAnnotation(O, Annot);
Chris Lattnera76eab42010-11-14 19:40:38 +0000153}
154
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000155
156void PPCInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNo,
157 raw_ostream &O,
158 const char *Modifier) {
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000159 unsigned Code = MI->getOperand(OpNo).getImm();
Hal Finkel460e94d2012-06-22 23:10:08 +0000160
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000161 if (StringRef(Modifier) == "cc") {
162 switch ((PPC::Predicate)Code) {
Ulrich Weigand86247b62013-06-24 16:52:04 +0000163 case PPC::PRED_LT_MINUS:
164 case PPC::PRED_LT_PLUS:
165 case PPC::PRED_LT:
166 O << "lt";
167 return;
168 case PPC::PRED_LE_MINUS:
169 case PPC::PRED_LE_PLUS:
170 case PPC::PRED_LE:
171 O << "le";
172 return;
173 case PPC::PRED_EQ_MINUS:
174 case PPC::PRED_EQ_PLUS:
175 case PPC::PRED_EQ:
176 O << "eq";
177 return;
178 case PPC::PRED_GE_MINUS:
179 case PPC::PRED_GE_PLUS:
180 case PPC::PRED_GE:
181 O << "ge";
182 return;
183 case PPC::PRED_GT_MINUS:
184 case PPC::PRED_GT_PLUS:
185 case PPC::PRED_GT:
186 O << "gt";
187 return;
188 case PPC::PRED_NE_MINUS:
189 case PPC::PRED_NE_PLUS:
190 case PPC::PRED_NE:
191 O << "ne";
192 return;
193 case PPC::PRED_UN_MINUS:
194 case PPC::PRED_UN_PLUS:
195 case PPC::PRED_UN:
196 O << "un";
197 return;
198 case PPC::PRED_NU_MINUS:
199 case PPC::PRED_NU_PLUS:
200 case PPC::PRED_NU:
201 O << "nu";
202 return;
Hal Finkel940ab932014-02-28 00:27:01 +0000203 case PPC::PRED_BIT_SET:
204 case PPC::PRED_BIT_UNSET:
205 llvm_unreachable("Invalid use of bit predicate code");
Ulrich Weigand86247b62013-06-24 16:52:04 +0000206 }
Benjamin Kramer3912d782013-06-24 17:03:25 +0000207 llvm_unreachable("Invalid predicate code");
Ulrich Weigand86247b62013-06-24 16:52:04 +0000208 }
209
210 if (StringRef(Modifier) == "pm") {
211 switch ((PPC::Predicate)Code) {
212 case PPC::PRED_LT:
213 case PPC::PRED_LE:
214 case PPC::PRED_EQ:
215 case PPC::PRED_GE:
216 case PPC::PRED_GT:
217 case PPC::PRED_NE:
218 case PPC::PRED_UN:
219 case PPC::PRED_NU:
220 return;
221 case PPC::PRED_LT_MINUS:
222 case PPC::PRED_LE_MINUS:
223 case PPC::PRED_EQ_MINUS:
224 case PPC::PRED_GE_MINUS:
225 case PPC::PRED_GT_MINUS:
226 case PPC::PRED_NE_MINUS:
227 case PPC::PRED_UN_MINUS:
228 case PPC::PRED_NU_MINUS:
229 O << "-";
230 return;
231 case PPC::PRED_LT_PLUS:
232 case PPC::PRED_LE_PLUS:
233 case PPC::PRED_EQ_PLUS:
234 case PPC::PRED_GE_PLUS:
235 case PPC::PRED_GT_PLUS:
236 case PPC::PRED_NE_PLUS:
237 case PPC::PRED_UN_PLUS:
238 case PPC::PRED_NU_PLUS:
239 O << "+";
240 return;
Hal Finkel940ab932014-02-28 00:27:01 +0000241 case PPC::PRED_BIT_SET:
242 case PPC::PRED_BIT_UNSET:
243 llvm_unreachable("Invalid use of bit predicate code");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000244 }
Benjamin Kramer3912d782013-06-24 17:03:25 +0000245 llvm_unreachable("Invalid predicate code");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000246 }
247
248 assert(StringRef(Modifier) == "reg" &&
Ulrich Weigand86247b62013-06-24 16:52:04 +0000249 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000250 printOperand(MI, OpNo+1, O);
251}
252
Nemanja Ivanovice8effe12015-03-04 20:44:33 +0000253void PPCInstPrinter::printU1ImmOperand(const MCInst *MI, unsigned OpNo,
254 raw_ostream &O) {
255 unsigned int Value = MI->getOperand(OpNo).getImm();
256 assert(Value <= 1 && "Invalid u1imm argument!");
257 O << (unsigned int)Value;
258}
259
Hal Finkel27774d92014-03-13 07:58:58 +0000260void PPCInstPrinter::printU2ImmOperand(const MCInst *MI, unsigned OpNo,
261 raw_ostream &O) {
262 unsigned int Value = MI->getOperand(OpNo).getImm();
263 assert(Value <= 3 && "Invalid u2imm argument!");
264 O << (unsigned int)Value;
265}
266
Kit Barton535e69d2015-03-25 19:36:23 +0000267void PPCInstPrinter::printU3ImmOperand(const MCInst *MI, unsigned OpNo,
268 raw_ostream &O) {
269 unsigned int Value = MI->getOperand(OpNo).getImm();
270 assert(Value <= 8 && "Invalid u3imm argument!");
271 O << (unsigned int)Value;
272}
273
Joerg Sonnenberger9e9623c2014-07-29 22:21:57 +0000274void PPCInstPrinter::printU4ImmOperand(const MCInst *MI, unsigned OpNo,
275 raw_ostream &O) {
276 unsigned int Value = MI->getOperand(OpNo).getImm();
277 assert(Value <= 15 && "Invalid u4imm argument!");
278 O << (unsigned int)Value;
279}
280
Chris Lattner94881432010-11-14 20:11:21 +0000281void PPCInstPrinter::printS5ImmOperand(const MCInst *MI, unsigned OpNo,
282 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000283 int Value = MI->getOperand(OpNo).getImm();
Richard Smith228e6d42012-08-24 23:29:28 +0000284 Value = SignExtend32<5>(Value);
Chris Lattner94881432010-11-14 20:11:21 +0000285 O << (int)Value;
286}
287
288void PPCInstPrinter::printU5ImmOperand(const MCInst *MI, unsigned OpNo,
289 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000290 unsigned int Value = MI->getOperand(OpNo).getImm();
Chris Lattner94881432010-11-14 20:11:21 +0000291 assert(Value <= 31 && "Invalid u5imm argument!");
292 O << (unsigned int)Value;
293}
294
295void PPCInstPrinter::printU6ImmOperand(const MCInst *MI, unsigned OpNo,
296 raw_ostream &O) {
Adhemerval Zanellafe3f7932012-10-08 18:59:53 +0000297 unsigned int Value = MI->getOperand(OpNo).getImm();
Chris Lattner94881432010-11-14 20:11:21 +0000298 assert(Value <= 63 && "Invalid u6imm argument!");
299 O << (unsigned int)Value;
300}
301
Chuang-Yu Cheng80722712016-03-28 08:34:28 +0000302void PPCInstPrinter::printU7ImmOperand(const MCInst *MI, unsigned OpNo,
303 raw_ostream &O) {
304 unsigned int Value = MI->getOperand(OpNo).getImm();
305 assert(Value <= 127 && "Invalid u7imm argument!");
306 O << (unsigned int)Value;
307}
308
309void PPCInstPrinter::printU8ImmOperand(const MCInst *MI, unsigned OpNo,
310 raw_ostream &O) {
311 unsigned int Value = MI->getOperand(OpNo).getImm();
312 assert(Value <= 255 && "Invalid u8imm argument!");
313 O << (unsigned int)Value;
314}
315
Bill Schmidte26236e2015-05-22 16:44:10 +0000316void PPCInstPrinter::printU10ImmOperand(const MCInst *MI, unsigned OpNo,
317 raw_ostream &O) {
318 unsigned short Value = MI->getOperand(OpNo).getImm();
319 assert(Value <= 1023 && "Invalid u10imm argument!");
320 O << (unsigned short)Value;
321}
322
Hal Finkelc93a9a22015-02-25 01:06:45 +0000323void PPCInstPrinter::printU12ImmOperand(const MCInst *MI, unsigned OpNo,
324 raw_ostream &O) {
325 unsigned short Value = MI->getOperand(OpNo).getImm();
326 assert(Value <= 4095 && "Invalid u12imm argument!");
327 O << (unsigned short)Value;
328}
329
Chris Lattner94881432010-11-14 20:11:21 +0000330void PPCInstPrinter::printS16ImmOperand(const MCInst *MI, unsigned OpNo,
331 raw_ostream &O) {
Ulrich Weigand41789de2013-05-23 22:26:41 +0000332 if (MI->getOperand(OpNo).isImm())
333 O << (short)MI->getOperand(OpNo).getImm();
334 else
335 printOperand(MI, OpNo, O);
Chris Lattner94881432010-11-14 20:11:21 +0000336}
337
338void PPCInstPrinter::printU16ImmOperand(const MCInst *MI, unsigned OpNo,
339 raw_ostream &O) {
Ulrich Weigandfd3ad692013-06-26 13:49:15 +0000340 if (MI->getOperand(OpNo).isImm())
341 O << (unsigned short)MI->getOperand(OpNo).getImm();
342 else
343 printOperand(MI, OpNo, O);
Chris Lattner94881432010-11-14 20:11:21 +0000344}
345
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000346void PPCInstPrinter::printBranchOperand(const MCInst *MI, unsigned OpNo,
347 raw_ostream &O) {
348 if (!MI->getOperand(OpNo).isImm())
349 return printOperand(MI, OpNo, O);
350
351 // Branches can take an immediate operand. This is used by the branch
Ulrich Weigandb9d5d072013-05-03 19:53:04 +0000352 // selection pass to print .+8, an eight byte displacement from the PC.
353 O << ".+";
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000354 printAbsBranchOperand(MI, OpNo, O);
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000355}
356
Ulrich Weigandb6a30d12013-06-24 11:03:33 +0000357void PPCInstPrinter::printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
358 raw_ostream &O) {
359 if (!MI->getOperand(OpNo).isImm())
360 return printOperand(MI, OpNo, O);
361
Alexey Samsonov9ca48702014-09-02 17:38:34 +0000362 O << SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
Chris Lattnerf2cb69c2010-11-14 21:51:37 +0000363}
Chris Lattner3dc9bb22010-11-14 21:20:46 +0000364
365
Chris Lattner0dcd8002010-11-14 20:22:56 +0000366void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo,
367 raw_ostream &O) {
368 unsigned CCReg = MI->getOperand(OpNo).getReg();
369 unsigned RegNo;
370 switch (CCReg) {
Craig Toppere55c5562012-02-07 02:50:20 +0000371 default: llvm_unreachable("Unknown CR register");
Chris Lattner0dcd8002010-11-14 20:22:56 +0000372 case PPC::CR0: RegNo = 0; break;
373 case PPC::CR1: RegNo = 1; break;
374 case PPC::CR2: RegNo = 2; break;
375 case PPC::CR3: RegNo = 3; break;
376 case PPC::CR4: RegNo = 4; break;
377 case PPC::CR5: RegNo = 5; break;
378 case PPC::CR6: RegNo = 6; break;
379 case PPC::CR7: RegNo = 7; break;
380 }
381 O << (0x80 >> RegNo);
382}
383
384void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
385 raw_ostream &O) {
Ulrich Weigand41789de2013-05-23 22:26:41 +0000386 printS16ImmOperand(MI, OpNo, O);
Chris Lattner0dcd8002010-11-14 20:22:56 +0000387 O << '(';
Chris Lattnerfd56ee22010-11-15 03:51:13 +0000388 if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
Chris Lattner0dcd8002010-11-14 20:22:56 +0000389 O << "0";
390 else
391 printOperand(MI, OpNo+1, O);
392 O << ')';
393}
394
Chris Lattner0dcd8002010-11-14 20:22:56 +0000395void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
396 raw_ostream &O) {
397 // When used as the base register, r0 reads constant zero rather than
398 // the value contained in the register. For this reason, the darwin
399 // assembler requires that we print r0 as 0 (no r) when used as the base.
400 if (MI->getOperand(OpNo).getReg() == PPC::R0)
401 O << "0";
402 else
403 printOperand(MI, OpNo, O);
404 O << ", ";
405 printOperand(MI, OpNo+1, O);
406}
407
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000408void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
409 raw_ostream &O) {
Hal Finkel7c8ae532014-07-25 17:47:22 +0000410 // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
411 // come at the _end_ of the expression.
412 const MCOperand &Op = MI->getOperand(OpNo);
413 const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*Op.getExpr());
414 O << refExp.getSymbol().getName();
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000415 O << '(';
416 printOperand(MI, OpNo+1, O);
417 O << ')';
Hal Finkel7c8ae532014-07-25 17:47:22 +0000418 if (refExp.getKind() != MCSymbolRefExpr::VK_None)
419 O << '@' << MCSymbolRefExpr::getVariantKindName(refExp.getKind());
Ulrich Weigand5143bab2013-07-02 21:31:04 +0000420}
Chris Lattner0dcd8002010-11-14 20:22:56 +0000421
Chris Lattner94881432010-11-14 20:11:21 +0000422
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000423/// stripRegisterPrefix - This method strips the character prefix from a
424/// register name so that only the number is left. Used by for linux asm.
Benjamin Krameraef5bd02010-11-25 16:42:51 +0000425static const char *stripRegisterPrefix(const char *RegName) {
Hal Finkelc6a24392013-11-11 14:58:40 +0000426 if (FullRegNames)
427 return RegName;
428
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000429 switch (RegName[0]) {
430 case 'r':
431 case 'f':
Hal Finkelc93a9a22015-02-25 01:06:45 +0000432 case 'q': // for QPX
Hal Finkel27774d92014-03-13 07:58:58 +0000433 case 'v':
434 if (RegName[1] == 's')
435 return RegName + 2;
436 return RegName + 1;
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000437 case 'c': if (RegName[1] == 'r') return RegName + 2;
438 }
439
440 return RegName;
441}
442
443void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
444 raw_ostream &O) {
445 const MCOperand &Op = MI->getOperand(OpNo);
446 if (Op.isReg()) {
447 const char *RegName = getRegisterName(Op.getReg());
448 // The linux and AIX assembler does not take register prefixes.
449 if (!isDarwinSyntax())
450 RegName = stripRegisterPrefix(RegName);
451
452 O << RegName;
453 return;
454 }
455
456 if (Op.isImm()) {
457 O << Op.getImm();
458 return;
459 }
460
461 assert(Op.isExpr() && "unknown operand kind in printOperand");
Matt Arsenault8b643552015-06-09 00:31:39 +0000462 Op.getExpr()->print(O, &MAI);
Chris Lattner7a5c57e2010-11-14 20:02:39 +0000463}
Chris Lattnercfb62872010-11-14 21:54:34 +0000464