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