Printing support for more stuff
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9AsmPrinter.cpp
index 5f73a8d5fc6d33560039d76a49720cb943294e68..38518eef41c2c9ebd23df1ffa645047112387351 100644 (file)
@@ -139,9 +139,9 @@ public:
   //
   string getID(const Value *V, const char *Prefix, const char *FPrefix = 0) {
     string Result = FPrefix ? FPrefix : "";  // "Forced prefix"
-    
+
     Result +=  V->hasName() ? V->getName() : string(Prefix);
-    
+
     // Qualify all internal names with a unique id.
     if (!isExternal(V)) {
       int valId = idTable->Table.getValSlot(V);
@@ -153,9 +153,12 @@ public:
           valId = I->second;
       }
       Result = Result + "_" + itostr(valId);
+
+      // Replace or prefix problem characters in the name
+      Result = getValidSymbolName(Result);
     }
-    
-    return getValidSymbolName(Result);
+
+    return Result;
   }
   
   // getID Wrappers - Ensure consistent usage...
@@ -440,10 +443,10 @@ SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
 {
   unsigned Opcode = MI->getOpCode();
 
-  if (TargetInstrDescriptors[Opcode].iclass & M_DUMMY_PHI_FLAG)
+  if (Target.getInstrInfo().isDummyPhiInstr(Opcode))
     return;  // IGNORE PHI NODES
 
-  toAsm << "\t" << TargetInstrDescriptors[Opcode].opCodeString << "\t";
+  toAsm << "\t" << Target.getInstrInfo().getName(Opcode) << "\t";
 
   unsigned Mask = getOperandMask(Opcode);
   
@@ -454,9 +457,8 @@ SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
       if (NeedComma) toAsm << ", ";         // Handle comma outputing
       NeedComma = true;
       N = printOperands(MI, OpNum);
-    }
-  else
-    N = 1;
+    } else
+      N = 1;
   
   toAsm << "\n";
 }