Changes to build successfully with GCC 3.02
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9AsmPrinter.cpp
1 //===-- EmitAssembly.cpp - Emit Sparc Specific .s File ---------------------==//
2 //
3 // This file implements all of the stuff neccesary to output a .s file from
4 // LLVM.  The code in this file assumes that the specified module has already
5 // been compiled into the internal data structures of the Module.
6 //
7 // The entry point of this file is the UltraSparc::emitAssembly method.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #include "SparcInternals.h"
12 #include "llvm/Analysis/SlotCalculator.h"
13 #include "llvm/Transforms/Linker.h"
14 #include "llvm/CodeGen/MachineInstr.h"
15 #include "llvm/GlobalVariable.h"
16 #include "llvm/GlobalValue.h"
17 #include "llvm/ConstantVals.h"
18 #include "llvm/DerivedTypes.h"
19 #include "llvm/BasicBlock.h"
20 #include "llvm/Method.h"
21 #include "llvm/Module.h"
22 #include "Support/StringExtras.h"
23 #include "Support/HashExtras.h"
24 #include <locale.h>
25 using std::string;
26
27 namespace {
28
29
30 class SparcAsmPrinter {
31   typedef std::hash_map<const Value*, int> ValIdMap;
32   typedef ValIdMap::      iterator ValIdMapIterator;
33   typedef ValIdMap::const_iterator ValIdMapConstIterator;
34   
35   std::ostream &toAsm;
36   SlotCalculator Table;   // map anonymous values to unique integer IDs
37   ValIdMap valToIdMap;    // used for values not handled by SlotCalculator 
38   const UltraSparc &Target;
39   
40   enum Sections {
41     Unknown,
42     Text,
43     ReadOnlyData,
44     InitRWData,
45     UninitRWData,
46   } CurSection;
47   
48 public:
49   inline SparcAsmPrinter(std::ostream &o, const Module *M, const UltraSparc &t)
50     : toAsm(o), Table(SlotCalculator(M, true)), Target(t), CurSection(Unknown) {
51     emitModule(M);
52   }
53
54 private :
55   void emitModule(const Module *M);
56   void emitMethod(const Method *M);
57   void emitGlobalsAndConstants(const Module* module);
58   //void processMethodArgument(const MethodArgument *MA);
59   void emitBasicBlock(const BasicBlock *BB);
60   void emitMachineInst(const MachineInstr *MI);
61   
62   void printGlobalVariable(   const GlobalVariable* GV);
63   void printSingleConstant(   const Constant* CV);
64   void printConstantValueOnly(const Constant* CV);
65   void printConstant(         const Constant* CV, std::string valID = "");
66   
67   unsigned int printOperands(const MachineInstr *MI, unsigned int opNum);
68   void printOneOperand(const MachineOperand &Op);
69
70   bool OpIsBranchTargetLabel(const MachineInstr *MI, unsigned int opNum);
71   bool OpIsMemoryAddressBase(const MachineInstr *MI, unsigned int opNum);
72   
73   // enterSection - Use this method to enter a different section of the output
74   // executable.  This is used to only output neccesary section transitions.
75   //
76   void enterSection(enum Sections S) {
77     if (S == CurSection) return;        // Only switch section if neccesary
78     CurSection = S;
79
80     toAsm << "\n\t.section ";
81     switch (S)
82       {
83       default: assert(0 && "Bad section name!");
84       case Text:         toAsm << "\".text\""; break;
85       case ReadOnlyData: toAsm << "\".rodata\",#alloc"; break;
86       case InitRWData:   toAsm << "\".data\",#alloc,#write"; break;
87       case UninitRWData: toAsm << "\".bss\",#alloc,#write\nBbss.bss:"; break;
88       }
89     toAsm << "\n";
90   }
91
92   std::string getValidSymbolName(const string &S) {
93     string Result;
94     
95     // Symbol names in Sparc assembly language have these rules:
96     // (a) Must match { letter | _ | . | $ } { letter | _ | . | $ | digit }*
97     // (b) A name beginning in "." is treated as a local name.
98     // (c) Names beginning with "_" are reserved by ANSI C and shd not be used.
99     // 
100     if (S[0] == '_' || isdigit(S[0]))
101       Result += "ll";
102     
103     for (unsigned i = 0; i < S.size(); ++i)
104       {
105         char C = S[i];
106         if (C == '_' || C == '.' || C == '$' || isalpha(C) || isdigit(C))
107           Result += C;
108         else
109           {
110             Result += '_';
111             Result += char('0' + ((unsigned char)C >> 4));
112             Result += char('0' + (C & 0xF));
113           }
114       }
115     return Result;
116   }
117
118   // getID - Return a valid identifier for the specified value.  Base it on
119   // the name of the identifier if possible, use a numbered value based on
120   // prefix otherwise.  FPrefix is always prepended to the output identifier.
121   //
122   string getID(const Value *V, const char *Prefix, const char *FPrefix = 0) {
123     string Result;
124     string FP(FPrefix ? FPrefix : "");  // "Forced prefix"
125     if (V->hasName()) {
126       Result = FP + V->getName();
127     } else {
128       int valId = Table.getValSlot(V);
129       if (valId == -1) {
130         ValIdMapConstIterator I = valToIdMap.find(V);
131         valId = (I == valToIdMap.end())? (valToIdMap[V] = valToIdMap.size())
132                                        : (*I).second;
133       }
134       Result = FP + string(Prefix) + itostr(valId);
135     }
136     return getValidSymbolName(Result);
137   }
138   
139   // getID Wrappers - Ensure consistent usage...
140   string getID(const Module *M) {
141     return getID(M, "LLVMModule_");
142   }
143   string getID(const Method *M) {
144     return getID(M, "LLVMMethod_");
145   }
146   string getID(const BasicBlock *BB) {
147     return getID(BB, "LL", (".L_"+getID(BB->getParent())+"_").c_str());
148   }
149   string getID(const GlobalVariable *GV) {
150     return getID(GV, "LLVMGlobal_", ".G_");
151   }
152   string getID(const Constant *CV) {
153     return getID(CV, "LLVMConst_", ".C_");
154   }
155   
156   unsigned getOperandMask(unsigned Opcode) {
157     switch (Opcode) {
158     case SUBcc:   return 1 << 3;  // Remove CC argument
159     case BA:      return 1 << 0;  // Remove Arg #0, which is always null or xcc
160     default:      return 0;       // By default, don't hack operands...
161     }
162   }
163 };
164
165
166 // Can we treat the specified array as a string?  Only if it is an array of
167 // ubytes or non-negative sbytes.
168 //
169 static bool isStringCompatible(ConstantArray *CPA) {
170   const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
171   if (ETy == Type::UByteTy) return true;
172   if (ETy != Type::SByteTy) return false;
173
174   for (unsigned i = 0; i < CPA->getNumOperands(); ++i)
175     if (cast<ConstantSInt>(CPA->getOperand(i))->getValue() < 0)
176       return false;
177
178   return true;
179 }
180
181 // toOctal - Convert the low order bits of X into an octal letter
182 static inline char toOctal(int X) {
183   return (X&7)+'0';
184 }
185
186 // getAsCString - Return the specified array as a C compatible string, only if
187 // the predicate isStringCompatible is true.
188 //
189 static string getAsCString(ConstantArray *CPA) {
190   if (isStringCompatible(CPA)) {
191     string Result;
192     const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
193     Result = "\"";
194     for (unsigned i = 0; i < CPA->getNumOperands(); ++i) {
195       unsigned char C = (ETy == Type::SByteTy) ?
196         (unsigned char)cast<ConstantSInt>(CPA->getOperand(i))->getValue() :
197         (unsigned char)cast<ConstantUInt>(CPA->getOperand(i))->getValue();
198
199       if (isprint(C)) {
200         Result += C;
201       } else {
202         switch(C) {
203         case '\a': Result += "\\a"; break;
204         case '\b': Result += "\\b"; break;
205         case '\f': Result += "\\f"; break;
206         case '\n': Result += "\\n"; break;
207         case '\r': Result += "\\r"; break;
208         case '\t': Result += "\\t"; break;
209         case '\v': Result += "\\v"; break;
210         default:
211           Result += '\\';
212           Result += toOctal(C >> 6);
213           Result += toOctal(C >> 3);
214           Result += toOctal(C >> 0);
215           break;
216         }
217       }
218     }
219     Result += "\"";
220
221     return Result;
222   } else {
223     return CPA->getStrValue();
224   }
225 }
226
227
228 inline bool
229 SparcAsmPrinter::OpIsBranchTargetLabel(const MachineInstr *MI,
230                                        unsigned int opNum) {
231   switch (MI->getOpCode()) {
232   case JMPLCALL:
233   case JMPLRET: return (opNum == 0);
234   default:      return false;
235   }
236 }
237
238
239 inline bool
240 SparcAsmPrinter::OpIsMemoryAddressBase(const MachineInstr *MI,
241                                        unsigned int opNum) {
242   if (Target.getInstrInfo().isLoad(MI->getOpCode()))
243     return (opNum == 0);
244   else if (Target.getInstrInfo().isStore(MI->getOpCode()))
245     return (opNum == 1);
246   else
247     return false;
248 }
249
250
251 #define PrintOp1PlusOp2(Op1, Op2) \
252   printOneOperand(Op1); \
253   toAsm << "+"; \
254   printOneOperand(Op2);
255
256 unsigned int
257 SparcAsmPrinter::printOperands(const MachineInstr *MI,
258                                unsigned int opNum)
259 {
260   const MachineOperand& Op = MI->getOperand(opNum);
261   
262   if (OpIsBranchTargetLabel(MI, opNum))
263     {
264       PrintOp1PlusOp2(Op, MI->getOperand(opNum+1));
265       return 2;
266     }
267   else if (OpIsMemoryAddressBase(MI, opNum))
268     {
269       toAsm << "[";
270       PrintOp1PlusOp2(Op, MI->getOperand(opNum+1));
271       toAsm << "]";
272       return 2;
273     }
274   else
275     {
276       printOneOperand(Op);
277       return 1;
278     }
279 }
280
281
282 void
283 SparcAsmPrinter::printOneOperand(const MachineOperand &op)
284 {
285   switch (op.getOperandType())
286     {
287     case MachineOperand::MO_VirtualRegister:
288     case MachineOperand::MO_CCRegister:
289     case MachineOperand::MO_MachineRegister:
290       {
291         int RegNum = (int)op.getAllocatedRegNum();
292         
293         // ****this code is temporary till NULL Values are fixed
294         if (RegNum == Target.getRegInfo().getInvalidRegNum()) {
295           toAsm << "<NULL VALUE>";
296         } else {
297           toAsm << "%" << Target.getRegInfo().getUnifiedRegName(RegNum);
298         }
299         break;
300       }
301     
302     case MachineOperand::MO_PCRelativeDisp:
303       {
304         const Value *Val = op.getVRegValue();
305         if (!Val)
306           toAsm << "\t<*NULL Value*>";
307         else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val))
308           toAsm << getID(BB);
309         else if (const Method *M = dyn_cast<const Method>(Val))
310           toAsm << getID(M);
311         else if (const GlobalVariable *GV=dyn_cast<const GlobalVariable>(Val))
312           toAsm << getID(GV);
313         else if (const Constant *CV = dyn_cast<const Constant>(Val))
314           toAsm << getID(CV);
315         else
316           toAsm << "<unknown value=" << Val << ">";
317         break;
318       }
319     
320     case MachineOperand::MO_SignExtendedImmed:
321     case MachineOperand::MO_UnextendedImmed:
322       toAsm << (long)op.getImmedValue();
323       break;
324     
325     default:
326       toAsm << op;      // use dump field
327       break;
328     }
329 }
330
331
332 void
333 SparcAsmPrinter::emitMachineInst(const MachineInstr *MI)
334 {
335   unsigned Opcode = MI->getOpCode();
336
337   if (TargetInstrDescriptors[Opcode].iclass & M_DUMMY_PHI_FLAG)
338     return;  // IGNORE PHI NODES
339
340   toAsm << "\t" << TargetInstrDescriptors[Opcode].opCodeString << "\t";
341
342   unsigned Mask = getOperandMask(Opcode);
343   
344   bool NeedComma = false;
345   unsigned N = 1;
346   for (unsigned OpNum = 0; OpNum < MI->getNumOperands(); OpNum += N)
347     if (! ((1 << OpNum) & Mask)) {        // Ignore this operand?
348       if (NeedComma) toAsm << ", ";         // Handle comma outputing
349       NeedComma = true;
350       N = printOperands(MI, OpNum);
351     }
352   else
353     N = 1;
354   
355   toAsm << "\n";
356 }
357
358 void
359 SparcAsmPrinter::emitBasicBlock(const BasicBlock *BB)
360 {
361   // Emit a label for the basic block
362   toAsm << getID(BB) << ":\n";
363
364   // Get the vector of machine instructions corresponding to this bb.
365   const MachineCodeForBasicBlock &MIs = BB->getMachineInstrVec();
366   MachineCodeForBasicBlock::const_iterator MII = MIs.begin(), MIE = MIs.end();
367
368   // Loop over all of the instructions in the basic block...
369   for (; MII != MIE; ++MII)
370     emitMachineInst(*MII);
371   toAsm << "\n";  // Seperate BB's with newlines
372 }
373
374 void
375 SparcAsmPrinter::emitMethod(const Method *M)
376 {
377   if (M->isExternal()) return;
378
379   // Make sure the slot table has information about this method...
380   Table.incorporateMethod(M);
381
382   string methName = getID(M);
383   toAsm << "!****** Outputing Method: " << methName << " ******\n";
384   enterSection(Text);
385   toAsm << "\t.align\t4\n\t.global\t" << methName << "\n";
386   //toAsm << "\t.type\t" << methName << ",#function\n";
387   toAsm << "\t.type\t" << methName << ", 2\n";
388   toAsm << methName << ":\n";
389
390   // Output code for all of the basic blocks in the method...
391   for (Method::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
392     emitBasicBlock(*I);
393
394   // Output a .size directive so the debugger knows the extents of the function
395   toAsm << ".EndOf_" << methName << ":\n\t.size "
396         << methName << ", .EndOf_"
397         << methName << "-" << methName << "\n";
398
399   // Put some spaces between the methods
400   toAsm << "\n\n";
401
402   // Forget all about M.
403   Table.purgeMethod();
404 }
405
406 inline bool
407 ArrayTypeIsString(ArrayType* arrayType)
408 {
409   return (arrayType->getElementType() == Type::UByteTy ||
410           arrayType->getElementType() == Type::SByteTy);
411 }
412
413 inline const string
414 TypeToDataDirective(const Type* type)
415 {
416   switch(type->getPrimitiveID())
417     {
418     case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID:
419       return ".byte";
420     case Type::UShortTyID: case Type::ShortTyID:
421       return ".half";
422     case Type::UIntTyID: case Type::IntTyID:
423       return ".word";
424     case Type::ULongTyID: case Type::LongTyID: case Type::PointerTyID:
425       return ".xword";
426     case Type::FloatTyID:
427       return ".single";
428     case Type::DoubleTyID:
429       return ".double";
430     case Type::ArrayTyID:
431       if (ArrayTypeIsString((ArrayType*) type))
432         return ".ascii";
433       else
434         return "<InvaliDataTypeForPrinting>";
435     default:
436       return "<InvaliDataTypeForPrinting>";
437     }
438 }
439
440 // Get the size of the constant for the given target.
441 // If this is an unsized array, return 0.
442 // 
443 inline unsigned int
444 ConstantToSize(const Constant* CV, const TargetMachine& target)
445 {
446   if (ConstantArray* CPA = dyn_cast<ConstantArray>(CV))
447     {
448       ArrayType *aty = cast<ArrayType>(CPA->getType());
449       if (ArrayTypeIsString(aty))
450         return 1 + CPA->getNumOperands();
451     }
452   
453   return target.findOptimalStorageSize(CV->getType());
454 }
455
456 inline
457 unsigned int TypeToSize(const Type* type, const TargetMachine& target)
458 {
459   return target.findOptimalStorageSize(type);
460 }
461
462
463 // Align data larger than one L1 cache line on L1 cache line boundaries.
464 // Align all smaller data on the next higher 2^x boundary (4, 8, ...).
465 // 
466 inline unsigned int
467 SizeToAlignment(unsigned int size, const TargetMachine& target)
468 {
469   unsigned short cacheLineSize = target.getCacheInfo().getCacheLineSize(1); 
470   if (size > (unsigned) cacheLineSize / 2)
471     return cacheLineSize;
472   else
473     for (unsigned sz=1; /*no condition*/; sz *= 2)
474       if (sz >= size)
475         return sz;
476 }
477
478 // Get the size of the type and then use SizeToAlignment.
479 // 
480 inline unsigned int
481 TypeToAlignment(const Type* type, const TargetMachine& target)
482 {
483   return SizeToAlignment(target.findOptimalStorageSize(type), target);
484 }
485
486 // Get the size of the constant and then use SizeToAlignment.
487 // Handles strings as a special case;
488 inline unsigned int
489 ConstantToAlignment(const Constant* CV, const TargetMachine& target)
490 {
491   if (ConstantArray* CPA = dyn_cast<ConstantArray>(CV))
492     if (ArrayTypeIsString(cast<ArrayType>(CPA->getType())))
493       return SizeToAlignment(1 + CPA->getNumOperands(), target);
494   
495   return TypeToAlignment(CV->getType(), target);
496 }
497
498
499 // Print a single constant value.
500 void
501 SparcAsmPrinter::printSingleConstant(const Constant* CV)
502 {
503   assert(CV->getType() != Type::VoidTy &&
504          CV->getType() != Type::TypeTy &&
505          CV->getType() != Type::LabelTy &&
506          "Unexpected type for Constant");
507   
508   assert((! isa<ConstantArray>( CV) && ! isa<ConstantStruct>(CV))
509          && "Collective types should be handled outside this function");
510   
511   toAsm << "\t"
512         << TypeToDataDirective(CV->getType()) << "\t";
513   
514   if (CV->getType()->isPrimitiveType())
515     {
516       if (CV->getType() == Type::FloatTy || CV->getType() == Type::DoubleTy)
517         toAsm << "0r";                  // FP constants must have this prefix
518       toAsm << CV->getStrValue() << "\n";
519     }
520   else if (ConstantPointer* CPP = dyn_cast<ConstantPointer>(CV))
521     {
522       assert(CPP->isNullValue() &&
523              "Cannot yet print non-null pointer constants to assembly");
524       toAsm << "0\n";
525     }
526   else if (isa<ConstantPointerRef>(CV))
527     {
528       assert(0 && "Cannot yet initialize pointer refs in assembly");
529     }
530   else
531     {
532       assert(0 && "Unknown elementary type for constant");
533     }
534 }
535
536 // Print a constant value or values (it may be an aggregate).
537 // Uses printSingleConstant() to print each individual value.
538 void
539 SparcAsmPrinter::printConstantValueOnly(const Constant* CV)
540 {
541   ConstantArray *CPA = dyn_cast<ConstantArray>(CV);
542   
543   if (CPA && isStringCompatible(CPA))
544     { // print the string alone and return
545       toAsm << "\t" << ".ascii" << "\t" << getAsCString(CPA) << "\n";
546     }
547   else if (CPA)
548     { // Not a string.  Print the values in successive locations
549       const std::vector<Use> &constValues = CPA->getValues();
550       for (unsigned i=1; i < constValues.size(); i++)
551         this->printConstantValueOnly(cast<Constant>(constValues[i].get()));
552     }
553   else if (ConstantStruct *CPS = dyn_cast<ConstantStruct>(CV))
554     { // Print the fields in successive locations
555       const std::vector<Use>& constValues = CPS->getValues();
556       for (unsigned i=1; i < constValues.size(); i++)
557         this->printConstantValueOnly(cast<Constant>(constValues[i].get()));
558     }
559   else
560     this->printSingleConstant(CV);
561 }
562
563 // Print a constant (which may be an aggregate) prefixed by all the
564 // appropriate directives.  Uses printConstantValueOnly() to print the
565 // value or values.
566 void
567 SparcAsmPrinter::printConstant(const Constant* CV, string valID)
568 {
569   if (valID.length() == 0)
570     valID = getID(CV);
571   
572   toAsm << "\t.align\t" << ConstantToAlignment(CV, Target)
573         << "\n";
574   
575   // Print .size and .type only if it is not a string.
576   ConstantArray *CPA = dyn_cast<ConstantArray>(CV);
577   if (CPA && isStringCompatible(CPA))
578     { // print it as a string and return
579       toAsm << valID << ":\n";
580       toAsm << "\t" << ".ascii" << "\t" << getAsCString(CPA) << "\n";
581       return;
582     }
583   
584   toAsm << "\t.type" << "\t" << valID << ",#object\n";
585
586   unsigned int constSize = ConstantToSize(CV, Target);
587   if (constSize)
588     toAsm << "\t.size" << "\t" << valID << ","
589           << constSize << "\n";
590   
591   toAsm << valID << ":\n";
592   
593   this->printConstantValueOnly(CV);
594 }
595
596
597 void
598 SparcAsmPrinter::printGlobalVariable(const GlobalVariable* GV)
599 {
600   toAsm << "\t.global\t" << getID(GV) << "\n";
601   
602   if (GV->hasInitializer())
603     printConstant(GV->getInitializer(), getID(GV));
604   else {
605     toAsm << "\t.align\t"
606           << TypeToAlignment(GV->getType()->getElementType(), Target) << "\n";
607     toAsm << "\t.type\t" << getID(GV) << ",#object\n";
608     toAsm << "\t.reserve\t" << getID(GV) << ","
609           << TypeToSize(GV->getType()->getElementType(), Target)
610           << "\n";
611   }
612 }
613
614
615 static void
616 FoldConstants(const Module *M,
617               std::hash_set<const Constant*>& moduleConstants)
618 {
619   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
620     if (! (*I)->isExternal())
621       {
622         const std::hash_set<const Constant*>& pool =
623           MachineCodeForMethod::get(*I).getConstantPoolValues();
624         moduleConstants.insert(pool.begin(), pool.end());
625       }
626 }
627
628
629 void
630 SparcAsmPrinter::emitGlobalsAndConstants(const Module *M)
631 {
632   // First, get the constants there were marked by the code generator for
633   // inclusion in the assembly code data area and fold them all into a
634   // single constant pool since there may be lots of duplicates.  Also,
635   // lets force these constants into the slot table so that we can get
636   // unique names for unnamed constants also.
637   // 
638   std::hash_set<const Constant*> moduleConstants;
639   FoldConstants(M, moduleConstants);
640   
641   // Now, emit the three data sections separately; the cost of I/O should
642   // make up for the cost of extra passes over the globals list!
643   // 
644   // Read-only data section (implies initialized)
645   for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
646     {
647       const GlobalVariable* GV = *GI;
648       if (GV->hasInitializer() && GV->isConstant())
649         {
650           if (GI == M->gbegin())
651             enterSection(ReadOnlyData);
652           printGlobalVariable(GV);
653         }
654   }
655   
656   for (std::hash_set<const Constant*>::const_iterator
657          I = moduleConstants.begin(),
658          E = moduleConstants.end();  I != E; ++I)
659     printConstant(*I);
660   
661   // Initialized read-write data section
662   for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
663     {
664       const GlobalVariable* GV = *GI;
665       if (GV->hasInitializer() && ! GV->isConstant())
666         {
667           if (GI == M->gbegin())
668             enterSection(InitRWData);
669           printGlobalVariable(GV);
670         }
671   }
672
673   // Uninitialized read-write data section
674   for (Module::const_giterator GI=M->gbegin(), GE=M->gend(); GI != GE; ++GI)
675     {
676       const GlobalVariable* GV = *GI;
677       if (! GV->hasInitializer())
678         {
679           if (GI == M->gbegin())
680             enterSection(UninitRWData);
681           printGlobalVariable(GV);
682         }
683   }
684
685   toAsm << "\n";
686 }
687
688
689 void
690 SparcAsmPrinter::emitModule(const Module *M)
691 {
692   // TODO: Look for a filename annotation on M to emit a .file directive
693   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
694     emitMethod(*I);
695   
696   emitGlobalsAndConstants(M);
697 }
698
699 }  // End anonymous namespace
700
701
702 //
703 // emitAssembly - Output assembly language code (a .s file) for the specified
704 // method. The specified method must have been compiled before this may be
705 // used.
706 //
707 void
708 UltraSparc::emitAssembly(const Module *M, std::ostream &toAsm) const
709 {
710   SparcAsmPrinter Print(toAsm, M, *this);
711 }