Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 1 | //===-- SPUAsmPrinter.cpp - Print machine instrs to Cell SPU assembly -------=// |
| 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 file contains a printer that converts from our internal representation |
| 11 | // of machine-dependent LLVM code to Cell SPU assembly language. This printer |
| 12 | // is the output mechanism used by `llc'. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #define DEBUG_TYPE "asmprinter" |
| 17 | #include "SPU.h" |
| 18 | #include "SPUTargetMachine.h" |
| 19 | #include "llvm/Constants.h" |
| 20 | #include "llvm/DerivedTypes.h" |
| 21 | #include "llvm/Module.h" |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/AsmPrinter.h" |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 23 | #include "llvm/CodeGen/MachineModuleInfo.h" |
Chris Lattner | 6c2f9e1 | 2009-08-19 05:49:37 +0000 | [diff] [blame] | 24 | #include "llvm/MC/MCStreamer.h" |
Chris Lattner | af76e59 | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MCAsmInfo.h" |
Chris Lattner | 325d3dc | 2009-09-13 17:14:04 +0000 | [diff] [blame] | 26 | #include "llvm/MC/MCSymbol.h" |
Chris Lattner | f014412 | 2009-07-28 03:13:23 +0000 | [diff] [blame] | 27 | #include "llvm/Target/TargetLoweringObjectFile.h" |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 28 | #include "llvm/Target/TargetInstrInfo.h" |
| 29 | #include "llvm/Target/TargetOptions.h" |
Chris Lattner | f014412 | 2009-07-28 03:13:23 +0000 | [diff] [blame] | 30 | #include "llvm/Target/TargetRegisterInfo.h" |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 31 | #include "llvm/Target/TargetRegistry.h" |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 32 | #include "llvm/ADT/StringExtras.h" |
Chris Lattner | 6c2f9e1 | 2009-08-19 05:49:37 +0000 | [diff] [blame] | 33 | #include "llvm/Support/ErrorHandling.h" |
| 34 | #include "llvm/Support/FormattedStream.h" |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 35 | using namespace llvm; |
| 36 | |
| 37 | namespace { |
Nick Lewycky | 6726b6d | 2009-10-25 06:33:48 +0000 | [diff] [blame] | 38 | class SPUAsmPrinter : public AsmPrinter { |
Bill Wendling | 57f0db8 | 2009-02-24 08:30:20 +0000 | [diff] [blame] | 39 | public: |
David Greene | 7184781 | 2009-07-14 20:18:05 +0000 | [diff] [blame] | 40 | explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, |
Chris Lattner | 56591ab | 2010-02-02 23:37:42 +0000 | [diff] [blame^] | 41 | MCContext &Ctx, MCStreamer &Streamer, |
| 42 | const MCAsmInfo *T) : |
| 43 | AsmPrinter(O, TM, Ctx, Streamer, T) {} |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 44 | |
| 45 | virtual const char *getPassName() const { |
| 46 | return "STI CBEA SPU Assembly Printer"; |
| 47 | } |
| 48 | |
| 49 | SPUTargetMachine &getTM() { |
| 50 | return static_cast<SPUTargetMachine&>(TM); |
| 51 | } |
| 52 | |
| 53 | /// printInstruction - This method is automatically generated by tablegen |
Chris Lattner | 05af261 | 2009-09-13 20:08:00 +0000 | [diff] [blame] | 54 | /// from the instruction set description. |
Chris Lattner | 41aefdc | 2009-08-08 01:32:19 +0000 | [diff] [blame] | 55 | void printInstruction(const MachineInstr *MI); |
Chris Lattner | d95148f | 2009-09-13 20:19:22 +0000 | [diff] [blame] | 56 | static const char *getRegisterName(unsigned RegNo); |
Chris Lattner | 05af261 | 2009-09-13 20:08:00 +0000 | [diff] [blame] | 57 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 58 | |
Chris Lattner | 745ec06 | 2010-01-28 01:48:52 +0000 | [diff] [blame] | 59 | void EmitInstruction(const MachineInstr *MI) { |
| 60 | printInstruction(MI); |
| 61 | } |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 62 | void printOp(const MachineOperand &MO); |
| 63 | |
| 64 | /// printRegister - Print register according to target requirements. |
| 65 | /// |
| 66 | void printRegister(const MachineOperand &MO, bool R0AsZero) { |
| 67 | unsigned RegNo = MO.getReg(); |
| 68 | assert(TargetRegisterInfo::isPhysicalRegister(RegNo) && |
| 69 | "Not physreg??"); |
Chris Lattner | 762ccea | 2009-09-13 20:31:40 +0000 | [diff] [blame] | 70 | O << getRegisterName(RegNo); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | void printOperand(const MachineInstr *MI, unsigned OpNo) { |
| 74 | const MachineOperand &MO = MI->getOperand(OpNo); |
| 75 | if (MO.isReg()) { |
Chris Lattner | 762ccea | 2009-09-13 20:31:40 +0000 | [diff] [blame] | 76 | O << getRegisterName(MO.getReg()); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 77 | } else if (MO.isImm()) { |
| 78 | O << MO.getImm(); |
| 79 | } else { |
| 80 | printOp(MO); |
| 81 | } |
| 82 | } |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 83 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 84 | bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
| 85 | unsigned AsmVariant, const char *ExtraCode); |
| 86 | bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, |
| 87 | unsigned AsmVariant, const char *ExtraCode); |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 88 | |
| 89 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 90 | void |
| 91 | printS7ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 92 | { |
| 93 | int value = MI->getOperand(OpNo).getImm(); |
| 94 | value = (value << (32 - 7)) >> (32 - 7); |
| 95 | |
| 96 | assert((value >= -(1 << 8) && value <= (1 << 7) - 1) |
| 97 | && "Invalid s7 argument"); |
| 98 | O << value; |
| 99 | } |
| 100 | |
| 101 | void |
| 102 | printU7ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 103 | { |
| 104 | unsigned int value = MI->getOperand(OpNo).getImm(); |
| 105 | assert(value < (1 << 8) && "Invalid u7 argument"); |
| 106 | O << value; |
| 107 | } |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 108 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 109 | void |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 110 | printShufAddr(const MachineInstr *MI, unsigned OpNo) |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 111 | { |
| 112 | char value = MI->getOperand(OpNo).getImm(); |
| 113 | O << (int) value; |
| 114 | O << "("; |
| 115 | printOperand(MI, OpNo+1); |
| 116 | O << ")"; |
| 117 | } |
| 118 | |
| 119 | void |
| 120 | printS16ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 121 | { |
| 122 | O << (short) MI->getOperand(OpNo).getImm(); |
| 123 | } |
| 124 | |
| 125 | void |
| 126 | printU16ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 127 | { |
| 128 | O << (unsigned short)MI->getOperand(OpNo).getImm(); |
| 129 | } |
| 130 | |
| 131 | void |
| 132 | printU32ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 133 | { |
| 134 | O << (unsigned)MI->getOperand(OpNo).getImm(); |
| 135 | } |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 136 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 137 | void |
| 138 | printMemRegReg(const MachineInstr *MI, unsigned OpNo) { |
| 139 | // When used as the base register, r0 reads constant zero rather than |
| 140 | // the value contained in the register. For this reason, the darwin |
| 141 | // assembler requires that we print r0 as 0 (no r) when used as the base. |
| 142 | const MachineOperand &MO = MI->getOperand(OpNo); |
Chris Lattner | 762ccea | 2009-09-13 20:31:40 +0000 | [diff] [blame] | 143 | O << getRegisterName(MO.getReg()) << ", "; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 144 | printOperand(MI, OpNo+1); |
| 145 | } |
| 146 | |
| 147 | void |
| 148 | printU18ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 149 | { |
| 150 | unsigned int value = MI->getOperand(OpNo).getImm(); |
| 151 | assert(value <= (1 << 19) - 1 && "Invalid u18 argument"); |
| 152 | O << value; |
| 153 | } |
| 154 | |
| 155 | void |
| 156 | printS10ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 157 | { |
| 158 | short value = (short) (((int) MI->getOperand(OpNo).getImm() << 16) |
| 159 | >> 16); |
| 160 | assert((value >= -(1 << 9) && value <= (1 << 9) - 1) |
| 161 | && "Invalid s10 argument"); |
| 162 | O << value; |
| 163 | } |
| 164 | |
| 165 | void |
| 166 | printU10ImmOperand(const MachineInstr *MI, unsigned OpNo) |
| 167 | { |
| 168 | short value = (short) (((int) MI->getOperand(OpNo).getImm() << 16) |
| 169 | >> 16); |
| 170 | assert((value <= (1 << 10) - 1) && "Invalid u10 argument"); |
| 171 | O << value; |
| 172 | } |
| 173 | |
| 174 | void |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 175 | printDFormAddr(const MachineInstr *MI, unsigned OpNo) |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 176 | { |
Chris Lattner | 0f2d995 | 2009-01-21 18:38:18 +0000 | [diff] [blame] | 177 | assert(MI->getOperand(OpNo).isImm() && |
| 178 | "printDFormAddr first operand is not immediate"); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 179 | int64_t value = int64_t(MI->getOperand(OpNo).getImm()); |
Scott Michel | 4379efc | 2008-11-20 05:01:09 +0000 | [diff] [blame] | 180 | int16_t value16 = int16_t(value); |
| 181 | assert((value16 >= -(1 << (9+4)) && value16 <= (1 << (9+4)) - 1) |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 182 | && "Invalid dform s10 offset argument"); |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 183 | O << (value16 & ~0xf) << "("; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 184 | printOperand(MI, OpNo+1); |
| 185 | O << ")"; |
| 186 | } |
| 187 | |
| 188 | void |
| 189 | printAddr256K(const MachineInstr *MI, unsigned OpNo) |
| 190 | { |
| 191 | /* Note: operand 1 is an offset or symbol name. */ |
| 192 | if (MI->getOperand(OpNo).isImm()) { |
| 193 | printS16ImmOperand(MI, OpNo); |
| 194 | } else { |
| 195 | printOp(MI->getOperand(OpNo)); |
| 196 | if (MI->getOperand(OpNo+1).isImm()) { |
| 197 | int displ = int(MI->getOperand(OpNo+1).getImm()); |
| 198 | if (displ > 0) |
| 199 | O << "+" << displ; |
| 200 | else if (displ < 0) |
| 201 | O << displ; |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | void printCallOperand(const MachineInstr *MI, unsigned OpNo) { |
| 207 | printOp(MI->getOperand(OpNo)); |
| 208 | } |
| 209 | |
| 210 | void printPCRelativeOperand(const MachineInstr *MI, unsigned OpNo) { |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 211 | // Used to generate a ".-<target>", but it turns out that the assembler |
| 212 | // really wants the target. |
| 213 | // |
| 214 | // N.B.: This operand is used for call targets. Branch hints are another |
| 215 | // animal entirely. |
| 216 | printOp(MI->getOperand(OpNo)); |
| 217 | } |
| 218 | |
| 219 | void printHBROperand(const MachineInstr *MI, unsigned OpNo) { |
| 220 | // HBR operands are generated in front of branches, hence, the |
| 221 | // program counter plus the target. |
| 222 | O << ".+"; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 223 | printOp(MI->getOperand(OpNo)); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | void printSymbolHi(const MachineInstr *MI, unsigned OpNo) { |
| 227 | if (MI->getOperand(OpNo).isImm()) { |
| 228 | printS16ImmOperand(MI, OpNo); |
| 229 | } else { |
| 230 | printOp(MI->getOperand(OpNo)); |
| 231 | O << "@h"; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | void printSymbolLo(const MachineInstr *MI, unsigned OpNo) { |
| 236 | if (MI->getOperand(OpNo).isImm()) { |
| 237 | printS16ImmOperand(MI, OpNo); |
| 238 | } else { |
| 239 | printOp(MI->getOperand(OpNo)); |
| 240 | O << "@l"; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | /// Print local store address |
| 245 | void printSymbolLSA(const MachineInstr *MI, unsigned OpNo) { |
| 246 | printOp(MI->getOperand(OpNo)); |
| 247 | } |
| 248 | |
| 249 | void printROTHNeg7Imm(const MachineInstr *MI, unsigned OpNo) { |
| 250 | if (MI->getOperand(OpNo).isImm()) { |
| 251 | int value = (int) MI->getOperand(OpNo).getImm(); |
| 252 | assert((value >= 0 && value < 16) |
| 253 | && "Invalid negated immediate rotate 7-bit argument"); |
| 254 | O << -value; |
| 255 | } else { |
Torok Edwin | c23197a | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 256 | llvm_unreachable("Invalid/non-immediate rotate amount in printRotateNeg7Imm"); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 257 | } |
| 258 | } |
| 259 | |
| 260 | void printROTNeg7Imm(const MachineInstr *MI, unsigned OpNo) { |
| 261 | if (MI->getOperand(OpNo).isImm()) { |
| 262 | int value = (int) MI->getOperand(OpNo).getImm(); |
Scott Michel | 104de43 | 2008-11-24 17:11:17 +0000 | [diff] [blame] | 263 | assert((value >= 0 && value <= 32) |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 264 | && "Invalid negated immediate rotate 7-bit argument"); |
| 265 | O << -value; |
| 266 | } else { |
Torok Edwin | c23197a | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 267 | llvm_unreachable("Invalid/non-immediate rotate amount in printRotateNeg7Imm"); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 268 | } |
| 269 | } |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 270 | }; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 271 | } // end of anonymous namespace |
| 272 | |
| 273 | // Include the auto-generated portion of the assembly writer |
| 274 | #include "SPUGenAsmWriter.inc" |
| 275 | |
| 276 | void SPUAsmPrinter::printOp(const MachineOperand &MO) { |
| 277 | switch (MO.getType()) { |
| 278 | case MachineOperand::MO_Immediate: |
Torok Edwin | dac237e | 2009-07-08 20:53:28 +0000 | [diff] [blame] | 279 | llvm_report_error("printOp() does not handle immediate values"); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 280 | return; |
| 281 | |
| 282 | case MachineOperand::MO_MachineBasicBlock: |
Chris Lattner | f71cb01 | 2010-01-26 04:55:51 +0000 | [diff] [blame] | 283 | O << *MO.getMBB()->getSymbol(OutContext); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 284 | return; |
| 285 | case MachineOperand::MO_JumpTableIndex: |
Chris Lattner | 33adcfb | 2009-08-22 21:43:10 +0000 | [diff] [blame] | 286 | O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 287 | << '_' << MO.getIndex(); |
| 288 | return; |
| 289 | case MachineOperand::MO_ConstantPoolIndex: |
Chris Lattner | 33adcfb | 2009-08-22 21:43:10 +0000 | [diff] [blame] | 290 | O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 291 | << '_' << MO.getIndex(); |
| 292 | return; |
| 293 | case MachineOperand::MO_ExternalSymbol: |
| 294 | // Computing the address of an external symbol, not calling it. |
| 295 | if (TM.getRelocationModel() != Reloc::Static) { |
Chris Lattner | 1216441 | 2010-01-16 00:21:18 +0000 | [diff] [blame] | 296 | O << "L" << MAI->getGlobalPrefix() << MO.getSymbolName() |
| 297 | << "$non_lazy_ptr"; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 298 | return; |
| 299 | } |
Chris Lattner | 10b318b | 2010-01-17 21:43:43 +0000 | [diff] [blame] | 300 | O << *GetExternalSymbolSymbol(MO.getSymbolName()); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 301 | return; |
Chris Lattner | 1216441 | 2010-01-16 00:21:18 +0000 | [diff] [blame] | 302 | case MachineOperand::MO_GlobalAddress: |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 303 | // External or weakly linked global variables need non-lazily-resolved |
| 304 | // stubs |
| 305 | if (TM.getRelocationModel() != Reloc::Static) { |
Chris Lattner | 1216441 | 2010-01-16 00:21:18 +0000 | [diff] [blame] | 306 | GlobalValue *GV = MO.getGlobal(); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 307 | if (((GV->isDeclaration() || GV->hasWeakLinkage() || |
| 308 | GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) { |
Chris Lattner | 10b318b | 2010-01-17 21:43:43 +0000 | [diff] [blame] | 309 | O << *GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr"); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 310 | return; |
| 311 | } |
| 312 | } |
Chris Lattner | 10b318b | 2010-01-17 21:43:43 +0000 | [diff] [blame] | 313 | O << *GetGlobalValueSymbol(MO.getGlobal()); |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 314 | return; |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 315 | default: |
| 316 | O << "<unknown operand type: " << MO.getType() << ">"; |
| 317 | return; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /// PrintAsmOperand - Print out an operand for an inline asm expression. |
| 322 | /// |
| 323 | bool SPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 324 | unsigned AsmVariant, |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 325 | const char *ExtraCode) { |
| 326 | // Does this asm operand have a single letter operand modifier? |
| 327 | if (ExtraCode && ExtraCode[0]) { |
| 328 | if (ExtraCode[1] != 0) return true; // Unknown modifier. |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 329 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 330 | switch (ExtraCode[0]) { |
| 331 | default: return true; // Unknown modifier. |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 332 | case 'L': // Write second word of DImode reference. |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 333 | // Verify that this operand has two consecutive registers. |
| 334 | if (!MI->getOperand(OpNo).isReg() || |
| 335 | OpNo+1 == MI->getNumOperands() || |
| 336 | !MI->getOperand(OpNo+1).isReg()) |
| 337 | return true; |
| 338 | ++OpNo; // Return the high-part. |
| 339 | break; |
| 340 | } |
| 341 | } |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 342 | |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 343 | printOperand(MI, OpNo); |
| 344 | return false; |
| 345 | } |
| 346 | |
| 347 | bool SPUAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, |
| 348 | unsigned OpNo, |
Scott Michel | 9de57a9 | 2009-01-26 22:33:37 +0000 | [diff] [blame] | 349 | unsigned AsmVariant, |
Scott Michel | 73655bc | 2008-11-08 18:59:02 +0000 | [diff] [blame] | 350 | const char *ExtraCode) { |
| 351 | if (ExtraCode && ExtraCode[0]) |
| 352 | return true; // Unknown modifier. |
| 353 | printMemRegReg(MI, OpNo); |
| 354 | return false; |
| 355 | } |
| 356 | |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 357 | // Force static initialization. |
| 358 | extern "C" void LLVMInitializeCellSPUAsmPrinter() { |
Chris Lattner | 08acebc | 2010-01-28 01:50:22 +0000 | [diff] [blame] | 359 | RegisterAsmPrinter<SPUAsmPrinter> X(TheCellSPUTarget); |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 360 | } |