Overhaul Cell SPU's addressing mode internals so that there are now
[oota-llvm.git] / lib / Target / CellSPU / SPUAsmPrinter.cpp
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"
22 #include "llvm/Assembly/Writer.h"
23 #include "llvm/CodeGen/AsmPrinter.h"
24 #include "llvm/CodeGen/DwarfWriter.h"
25 #include "llvm/CodeGen/MachineModuleInfo.h"
26 #include "llvm/CodeGen/MachineFunctionPass.h"
27 #include "llvm/CodeGen/MachineInstr.h"
28 #include "llvm/Support/Mangler.h"
29 #include "llvm/Support/MathExtras.h"
30 #include "llvm/Support/CommandLine.h"
31 #include "llvm/Support/Debug.h"
32 #include "llvm/Support/Compiler.h"
33 #include "llvm/Target/TargetAsmInfo.h"
34 #include "llvm/Target/MRegisterInfo.h"
35 #include "llvm/Target/TargetInstrInfo.h"
36 #include "llvm/Target/TargetOptions.h"
37 #include "llvm/ADT/Statistic.h"
38 #include "llvm/ADT/StringExtras.h"
39 #include <set>
40 using namespace llvm;
41
42 namespace {
43   STATISTIC(EmittedInsts, "Number of machine instrs printed");
44
45   const std::string bss_section(".bss");
46
47   struct VISIBILITY_HIDDEN SPUAsmPrinter : public AsmPrinter {
48     std::set<std::string> FnStubs, GVStubs;
49
50     SPUAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) :
51       AsmPrinter(O, TM, T)
52     {
53     }
54
55     virtual const char *getPassName() const {
56       return "STI CBEA SPU Assembly Printer";
57     }
58
59     SPUTargetMachine &getTM() {
60       return static_cast<SPUTargetMachine&>(TM);
61     }
62
63     /// printInstruction - This method is automatically generated by tablegen
64     /// from the instruction set description.  This method returns true if the
65     /// machine instruction was sufficiently described to print it, otherwise it
66     /// returns false.
67     bool printInstruction(const MachineInstr *MI);
68
69     void printMachineInstruction(const MachineInstr *MI);
70     void printOp(const MachineOperand &MO);
71
72     /// printRegister - Print register according to target requirements.
73     ///
74     void printRegister(const MachineOperand &MO, bool R0AsZero) {
75       unsigned RegNo = MO.getReg();
76       assert(MRegisterInfo::isPhysicalRegister(RegNo) && "Not physreg??");
77       O << TM.getRegisterInfo()->get(RegNo).Name;
78     }
79
80     void printOperand(const MachineInstr *MI, unsigned OpNo) {
81       const MachineOperand &MO = MI->getOperand(OpNo);
82       if (MO.isRegister()) {
83         assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??");
84         O << TM.getRegisterInfo()->get(MO.getReg()).Name;
85       } else if (MO.isImmediate()) {
86         O << MO.getImm();
87       } else {
88         printOp(MO);
89       }
90     }
91     
92     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
93                          unsigned AsmVariant, const char *ExtraCode);
94     bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
95                                unsigned AsmVariant, const char *ExtraCode);
96    
97    
98     void
99     printS7ImmOperand(const MachineInstr *MI, unsigned OpNo)
100     {
101       int value = MI->getOperand(OpNo).getImm();
102       value = (value << (32 - 7)) >> (32 - 7);
103
104       assert((value >= -(1 << 8) && value <= (1 << 7) - 1)
105              && "Invalid s7 argument");
106       O << value;
107     }
108
109     void
110     printU7ImmOperand(const MachineInstr *MI, unsigned OpNo)
111     {
112       unsigned int value = MI->getOperand(OpNo).getImm();
113       assert(value < (1 << 8) && "Invalid u7 argument");
114       O << value;
115     }
116  
117     void
118     printMemRegImmS7(const MachineInstr *MI, unsigned OpNo)
119     {
120       char value = MI->getOperand(OpNo).getImm();
121       O << (int) value;
122       O << "(";
123       printOperand(MI, OpNo+1);
124       O << ")";
125     }
126
127     void
128     printS16ImmOperand(const MachineInstr *MI, unsigned OpNo)
129     {
130       O << (short) MI->getOperand(OpNo).getImm();
131     }
132
133     void
134     printU16ImmOperand(const MachineInstr *MI, unsigned OpNo)
135     {
136       O << (unsigned short)MI->getOperand(OpNo).getImm();
137     }
138
139     void
140     printU32ImmOperand(const MachineInstr *MI, unsigned OpNo)
141     {
142       O << (unsigned)MI->getOperand(OpNo).getImm();
143     }
144     
145     void
146     printMemRegReg(const MachineInstr *MI, unsigned OpNo) {
147       // When used as the base register, r0 reads constant zero rather than
148       // the value contained in the register.  For this reason, the darwin
149       // assembler requires that we print r0 as 0 (no r) when used as the base.
150       const MachineOperand &MO = MI->getOperand(OpNo);
151       O << TM.getRegisterInfo()->get(MO.getReg()).Name;
152       O << ", ";
153       printOperand(MI, OpNo+1);
154     }
155
156     void
157     printU18ImmOperand(const MachineInstr *MI, unsigned OpNo)
158     {
159       unsigned int value = MI->getOperand(OpNo).getImm();
160       assert(value <= (1 << 19) - 1 && "Invalid u18 argument");
161       O << value;
162     }
163
164     void
165     printS10ImmOperand(const MachineInstr *MI, unsigned OpNo)
166     {
167       short value = (short) (((int) MI->getOperand(OpNo).getImm() << 16)
168                              >> 16);
169       assert((value >= -(1 << 9) && value <= (1 << 9) - 1)
170              && "Invalid s10 argument");
171       O << value;
172     }
173
174     void
175     printU10ImmOperand(const MachineInstr *MI, unsigned OpNo)
176     {
177       short value = (short) (((int) MI->getOperand(OpNo).getImm() << 16)
178                              >> 16);
179       assert((value <= (1 << 10) - 1) && "Invalid u10 argument");
180       O << value;
181     }
182
183     void
184     printMemRegImmS10(const MachineInstr *MI, unsigned OpNo)
185     {
186       const MachineOperand &MO = MI->getOperand(OpNo);
187       assert(MO.isImmediate()
188              && "printMemRegImmS10 first operand is not immedate");
189       printS10ImmOperand(MI, OpNo);
190       O << "(";
191       printOperand(MI, OpNo+1);
192       O << ")";
193     }
194
195     void
196     printAddr256K(const MachineInstr *MI, unsigned OpNo)
197     {
198       /* Note: operand 1 is an offset or symbol name. */
199       if (MI->getOperand(OpNo).isImmediate()) {
200         printS16ImmOperand(MI, OpNo);
201       } else {
202         printOp(MI->getOperand(OpNo));
203         if (MI->getOperand(OpNo+1).isImmediate()) {
204           int displ = int(MI->getOperand(OpNo+1).getImm());
205           if (displ > 0)
206             O << "+" << displ;
207           else if (displ < 0)
208             O << displ;
209         }
210       }
211     }
212
213     void printCallOperand(const MachineInstr *MI, unsigned OpNo) {
214       printOp(MI->getOperand(OpNo));
215     }
216
217     void printPCRelativeOperand(const MachineInstr *MI, unsigned OpNo) {
218       printOp(MI->getOperand(OpNo));
219       O << "-.";
220     }
221
222     void printSymbolHi(const MachineInstr *MI, unsigned OpNo) {
223       if (MI->getOperand(OpNo).isImmediate()) {
224         printS16ImmOperand(MI, OpNo);
225       } else {
226         printOp(MI->getOperand(OpNo));
227         O << "@h";
228       }
229     }
230
231     void printSymbolLo(const MachineInstr *MI, unsigned OpNo) {
232       if (MI->getOperand(OpNo).isImmediate()) {
233         printS16ImmOperand(MI, OpNo);
234       } else {
235         printOp(MI->getOperand(OpNo));
236         O << "@l";
237       }
238     }
239
240     /// Print local store address
241     void printSymbolLSA(const MachineInstr *MI, unsigned OpNo) {
242       printOp(MI->getOperand(OpNo));
243     }
244
245     void printROTHNeg7Imm(const MachineInstr *MI, unsigned OpNo) {
246       if (MI->getOperand(OpNo).isImmediate()) {
247         int value = (int) MI->getOperand(OpNo).getImm();
248         assert((value >= 0 && value < 16)
249                && "Invalid negated immediate rotate 7-bit argument");
250         O << -value;
251       } else {
252         assert(0 &&"Invalid/non-immediate rotate amount in printRotateNeg7Imm");
253       }
254     }
255
256     void printROTNeg7Imm(const MachineInstr *MI, unsigned OpNo) {
257       if (MI->getOperand(OpNo).isImmediate()) {
258         int value = (int) MI->getOperand(OpNo).getImm();
259         assert((value >= 0 && value < 32)
260                && "Invalid negated immediate rotate 7-bit argument");
261         O << -value;
262       } else {
263         assert(0 &&"Invalid/non-immediate rotate amount in printRotateNeg7Imm");
264       }
265     }
266
267     virtual bool runOnMachineFunction(MachineFunction &F) = 0;
268     virtual bool doFinalization(Module &M) = 0;
269   };
270
271   /// LinuxAsmPrinter - SPU assembly printer, customized for Linux
272   struct VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter {
273   
274     DwarfWriter DW;
275
276     LinuxAsmPrinter(std::ostream &O, SPUTargetMachine &TM,
277                     const TargetAsmInfo *T) :
278       SPUAsmPrinter(O, TM, T),
279       DW(O, this, T)
280     { }
281
282     virtual const char *getPassName() const {
283       return "STI CBEA SPU Assembly Printer";
284     }
285     
286     bool runOnMachineFunction(MachineFunction &F);
287     bool doInitialization(Module &M);
288     bool doFinalization(Module &M);
289     
290     void getAnalysisUsage(AnalysisUsage &AU) const {
291       AU.setPreservesAll();
292       AU.addRequired<MachineModuleInfo>();
293       SPUAsmPrinter::getAnalysisUsage(AU);
294     }
295
296     /// getSectionForFunction - Return the section that we should emit the
297     /// specified function body into.
298     virtual std::string getSectionForFunction(const Function &F) const;
299   };
300 } // end of anonymous namespace
301
302 // Include the auto-generated portion of the assembly writer
303 #include "SPUGenAsmWriter.inc"
304
305 void SPUAsmPrinter::printOp(const MachineOperand &MO) {
306   switch (MO.getType()) {
307   case MachineOperand::MO_Immediate:
308     cerr << "printOp() does not handle immediate values\n";
309     abort();
310     return;
311
312   case MachineOperand::MO_MachineBasicBlock:
313     printBasicBlockLabel(MO.getMBB());
314     return;
315   case MachineOperand::MO_JumpTableIndex:
316     O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
317       << '_' << MO.getIndex();
318     return;
319   case MachineOperand::MO_ConstantPoolIndex:
320     O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber()
321       << '_' << MO.getIndex();
322     return;
323   case MachineOperand::MO_ExternalSymbol:
324     // Computing the address of an external symbol, not calling it.
325     if (TM.getRelocationModel() != Reloc::Static) {
326       std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName();
327       GVStubs.insert(Name);
328       O << "L" << Name << "$non_lazy_ptr";
329       return;
330     }
331     O << TAI->getGlobalPrefix() << MO.getSymbolName();
332     return;
333   case MachineOperand::MO_GlobalAddress: {
334     // Computing the address of a global symbol, not calling it.
335     GlobalValue *GV = MO.getGlobal();
336     std::string Name = Mang->getValueName(GV);
337
338     // External or weakly linked global variables need non-lazily-resolved
339     // stubs
340     if (TM.getRelocationModel() != Reloc::Static) {
341       if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
342             GV->hasLinkOnceLinkage()))) {
343         GVStubs.insert(Name);
344         O << "L" << Name << "$non_lazy_ptr";
345         return;
346       }
347     }
348     O << Name;
349     
350     if (GV->hasExternalWeakLinkage())
351       ExtWeakSymbols.insert(GV);
352     return;
353   }
354
355   default:
356     O << "<unknown operand type: " << MO.getType() << ">";
357     return;
358   }
359 }
360
361 /// PrintAsmOperand - Print out an operand for an inline asm expression.
362 ///
363 bool SPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
364                                     unsigned AsmVariant, 
365                                     const char *ExtraCode) {
366   // Does this asm operand have a single letter operand modifier?
367   if (ExtraCode && ExtraCode[0]) {
368     if (ExtraCode[1] != 0) return true; // Unknown modifier.
369     
370     switch (ExtraCode[0]) {
371     default: return true;  // Unknown modifier.
372     case 'L': // Write second word of DImode reference.  
373       // Verify that this operand has two consecutive registers.
374       if (!MI->getOperand(OpNo).isRegister() ||
375           OpNo+1 == MI->getNumOperands() ||
376           !MI->getOperand(OpNo+1).isRegister())
377         return true;
378       ++OpNo;   // Return the high-part.
379       break;
380     }
381   }
382   
383   printOperand(MI, OpNo);
384   return false;
385 }
386
387 bool SPUAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
388                                           unsigned OpNo,
389                                           unsigned AsmVariant, 
390                                           const char *ExtraCode) {
391   if (ExtraCode && ExtraCode[0])
392     return true; // Unknown modifier.
393   printMemRegReg(MI, OpNo);
394   return false;
395 }
396
397 /// printMachineInstruction -- Print out a single PowerPC MI in Darwin syntax
398 /// to the current output stream.
399 ///
400 void SPUAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
401   ++EmittedInsts;
402   printInstruction(MI);
403 }
404
405
406
407 std::string LinuxAsmPrinter::getSectionForFunction(const Function &F) const {
408   switch (F.getLinkage()) {
409   default: assert(0 && "Unknown linkage type!");
410   case Function::ExternalLinkage:
411   case Function::InternalLinkage: return TAI->getTextSection();
412   case Function::WeakLinkage:
413   case Function::LinkOnceLinkage:
414     return ""; // Print nothing for the time being...
415   }
416 }
417
418 /// runOnMachineFunction - This uses the printMachineInstruction()
419 /// method to print assembly for each instruction.
420 ///
421 bool
422 LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF)
423 {
424   DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>());
425
426   SetupMachineFunction(MF);
427   O << "\n\n";
428   
429   // Print out constants referenced by the function
430   EmitConstantPool(MF.getConstantPool());
431
432   // Print out labels for the function.
433   const Function *F = MF.getFunction();
434
435   SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
436   EmitAlignment(3, F);
437
438   switch (F->getLinkage()) {
439   default: assert(0 && "Unknown linkage type!");
440   case Function::InternalLinkage:  // Symbols default to internal.
441     break;
442   case Function::ExternalLinkage:
443     O << "\t.global\t" << CurrentFnName << "\n"
444       << "\t.type\t" << CurrentFnName << ", @function\n";
445     break;
446   case Function::WeakLinkage:
447   case Function::LinkOnceLinkage:
448     O << "\t.global\t" << CurrentFnName << "\n";
449     O << "\t.weak_definition\t" << CurrentFnName << "\n";
450     break;
451   }
452   O << CurrentFnName << ":\n";
453
454   // Emit pre-function debug information.
455   DW.BeginFunction(&MF);
456
457   // Print out code for the function.
458   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
459        I != E; ++I) {
460     // Print a label for the basic block.
461     if (I != MF.begin()) {
462       printBasicBlockLabel(I, true);
463       O << '\n';
464     }
465     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
466          II != E; ++II) {
467       // Print the assembly for the instruction.
468       O << "\t";
469       printMachineInstruction(II);
470     }
471   }
472
473   O << "\t.size\t" << CurrentFnName << ",.-" << CurrentFnName << "\n";
474
475   // Print out jump tables referenced by the function.
476   EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
477   
478   // Emit post-function debug information.
479   DW.EndFunction();
480   
481   // We didn't modify anything.
482   return false;
483 }
484
485
486 bool LinuxAsmPrinter::doInitialization(Module &M) {
487   bool Result = AsmPrinter::doInitialization(M);
488   SwitchToTextSection(TAI->getTextSection());
489   // Emit initial debug information.
490   DW.BeginModule(&M);
491   return Result;
492 }
493
494 bool LinuxAsmPrinter::doFinalization(Module &M) {
495   const TargetData *TD = TM.getTargetData();
496
497   // Print out module-level global variables here.
498   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
499        I != E; ++I) {
500     if (!I->hasInitializer()) continue;   // External global require no code
501     
502     // Check to see if this is a special global used by LLVM, if so, emit it.
503     if (EmitSpecialLLVMGlobal(I))
504       continue;
505     
506     std::string name = Mang->getValueName(I);
507     Constant *C = I->getInitializer();
508     unsigned Size = TD->getTypeStoreSize(C->getType());
509     unsigned Align = TD->getPreferredAlignmentLog(I);
510
511     if (C->isNullValue() && /* FIXME: Verify correct */
512         (I->hasInternalLinkage() || I->hasWeakLinkage() ||
513          I->hasLinkOnceLinkage() ||
514          (I->hasExternalLinkage() && !I->hasSection()))) {
515       if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
516       if (I->hasExternalLinkage()) {
517         // External linkage globals -> .bss section
518         // FIXME: Want to set the global variable's section so that
519         // SwitchToDataSection emits the ".section" directive
520         SwitchToDataSection("\t.section\t.bss", I);
521         O << "\t.global\t" << name << '\n';
522         O << "\t.align\t" << Align << '\n';
523         O << "\t.type\t" << name << ", @object\n";
524         O << "\t.size\t" << name << ", " << Size << '\n';
525         O << name << ":\n";
526         O << "\t.zero\t" << Size;
527       } else if (I->hasInternalLinkage()) {
528         SwitchToDataSection("\t.data", I);
529         O << ".local " << name << "\n";
530         O << TAI->getCOMMDirective() << name << "," << Size << "," << Align << "\n";
531       } else {
532         SwitchToDataSection("\t.data", I);
533         O << ".comm " << name << "," << Size;
534       }
535       O << "\t\t# '" << I->getName() << "'\n";
536     } else {
537       switch (I->getLinkage()) {
538       case GlobalValue::LinkOnceLinkage:
539       case GlobalValue::WeakLinkage:
540         O << "\t.global " << name << '\n'
541           << "\t.weak_definition " << name << '\n';
542         SwitchToDataSection(".section __DATA,__datacoal_nt,coalesced", I);
543         break;
544       case GlobalValue::AppendingLinkage:
545         // FIXME: appending linkage variables should go into a section of
546         // their name or something.  For now, just emit them as external.
547       case GlobalValue::ExternalLinkage:
548         // If external or appending, declare as a global symbol
549         O << "\t.global " << name << "\n";
550         // FALL THROUGH
551       case GlobalValue::InternalLinkage:
552         if (I->isConstant()) {
553           const ConstantArray *CVA = dyn_cast<ConstantArray>(C);
554           if (TAI->getCStringSection() && CVA && CVA->isCString()) {
555             SwitchToDataSection(TAI->getCStringSection(), I);
556             break;
557           }
558         }
559
560         SwitchToDataSection("\t.data", I);
561         break;
562       default:
563         cerr << "Unknown linkage type!";
564         abort();
565       }
566
567       EmitAlignment(Align, I);
568       O << name << ":\t\t\t\t# '" << I->getName() << "'\n";
569
570       // If the initializer is a extern weak symbol, remember to emit the weak
571       // reference!
572       if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
573         if (GV->hasExternalWeakLinkage())
574           ExtWeakSymbols.insert(GV);
575
576       EmitGlobalConstant(C);
577       O << '\n';
578     }
579   }
580
581   // Output stubs for dynamically-linked functions
582   if (TM.getRelocationModel() == Reloc::PIC_) {
583     for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
584          i != e; ++i) {
585       SwitchToTextSection(".section __TEXT,__picsymbolstub1,symbol_stubs,"
586                           "pure_instructions,32");
587       EmitAlignment(4);
588       O << "L" << *i << "$stub:\n";
589       O << "\t.indirect_symbol " << *i << "\n";
590       O << "\tmflr r0\n";
591       O << "\tbcl 20,31,L0$" << *i << "\n";
592       O << "L0$" << *i << ":\n";
593       O << "\tmflr r11\n";
594       O << "\taddis r11,r11,ha16(L" << *i << "$lazy_ptr-L0$" << *i << ")\n";
595       O << "\tmtlr r0\n";
596       O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n";
597       O << "\tmtctr r12\n";
598       O << "\tbctr\n";
599       SwitchToDataSection(".lazy_symbol_pointer");
600       O << "L" << *i << "$lazy_ptr:\n";
601       O << "\t.indirect_symbol " << *i << "\n";
602       O << "\t.long dyld_stub_binding_helper\n";
603     }
604   } else {
605     for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
606          i != e; ++i) {
607       SwitchToTextSection(".section __TEXT,__symbol_stub1,symbol_stubs,"
608                           "pure_instructions,16");
609       EmitAlignment(4);
610       O << "L" << *i << "$stub:\n";
611       O << "\t.indirect_symbol " << *i << "\n";
612       O << "\tlis r11,ha16(L" << *i << "$lazy_ptr)\n";
613       O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr)(r11)\n";
614       O << "\tmtctr r12\n";
615       O << "\tbctr\n";
616       SwitchToDataSection(".lazy_symbol_pointer");
617       O << "L" << *i << "$lazy_ptr:\n";
618       O << "\t.indirect_symbol " << *i << "\n";
619       O << "\t.long dyld_stub_binding_helper\n";
620     }
621   }
622
623   O << "\n";
624
625   // Output stubs for external and common global variables.
626   if (GVStubs.begin() != GVStubs.end()) {
627     SwitchToDataSection(".non_lazy_symbol_pointer");
628     for (std::set<std::string>::iterator I = GVStubs.begin(),
629          E = GVStubs.end(); I != E; ++I) {
630       O << "L" << *I << "$non_lazy_ptr:\n";
631       O << "\t.indirect_symbol " << *I << "\n";
632       O << "\t.long\t0\n";
633     }
634   }
635
636   // Emit initial debug information.
637   DW.EndModule();
638
639   // Emit ident information
640   O << "\t.ident\t\"(llvm 2.2+) STI CBEA Cell SPU backend\"\n";
641
642   return AsmPrinter::doFinalization(M);
643 }
644
645
646
647 /// createSPUCodePrinterPass - Returns a pass that prints the Cell SPU
648 /// assembly code for a MachineFunction to the given output stream, in a format
649 /// that the Linux SPU assembler can deal with.
650 ///
651 FunctionPass *llvm::createSPUAsmPrinterPass(std::ostream &o,
652                                             SPUTargetMachine &tm) {
653   return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo());
654 }
655