Move pr717 to here.
[oota-llvm.git] / lib / Target / Alpha / AlphaAsmPrinter.cpp
index 18ff6babf5ac55e4c688918c5903ca13248ea99a..42e4b7843cf29c7b7473d40314d3680276fa6ad2 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -53,9 +53,9 @@ namespace {
     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
                          unsigned AsmVariant, const char *ExtraCode);
     bool PrintAsmMemoryOperand(const MachineInstr *MI, 
-                              unsigned OpNo,
-                              unsigned AsmVariant, 
-                              const char *ExtraCode);
+                               unsigned OpNo,
+                               unsigned AsmVariant, 
+                               const char *ExtraCode);
   };
 } // end of anonymous namespace
 
@@ -75,11 +75,12 @@ void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum)
 {
   const MachineOperand &MO = MI->getOperand(opNum);
   if (MO.getType() == MachineOperand::MO_Register) {
-    assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??");
-    O << TM.getRegisterInfo()->get(MO.getReg()).Name;
+    assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) &&
+           "Not physreg??");
+    O << TM.getRegisterInfo()->get(MO.getReg()).AsmName;
   } else if (MO.isImmediate()) {
-    O << MO.getImmedValue();
-    assert(MO.getImmedValue() < (1 << 30));
+    O << MO.getImm();
+    assert(MO.getImm() < (1 << 30));
   } else {
     printOp(MO);
   }
@@ -87,11 +88,11 @@ void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum)
 
 
 void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
-  const MRegisterInfo &RI = *TM.getRegisterInfo();
+  const TargetRegisterInfo &RI = *TM.getRegisterInfo();
 
   switch (MO.getType()) {
   case MachineOperand::MO_Register:
-    O << RI.get(MO.getReg()).Name;
+    O << RI.get(MO.getReg()).AsmName;
     return;
 
   case MachineOperand::MO_Immediate:
@@ -100,12 +101,12 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
     return;
 
   case MachineOperand::MO_MachineBasicBlock:
-    printBasicBlockLabel(MO.getMachineBasicBlock());
+    printBasicBlockLabel(MO.getMBB());
     return;
 
   case MachineOperand::MO_ConstantPoolIndex:
     O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
-      << MO.getConstantPoolIndex();
+      << MO.getIndex();
     return;
 
   case MachineOperand::MO_ExternalSymbol:
@@ -122,7 +123,7 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
 
   case MachineOperand::MO_JumpTableIndex:
     O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
-      << '_' << MO.getJumpTableIndex();
+      << '_' << MO.getIndex();
     return;
 
   default:
@@ -170,14 +171,13 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
        I != E; ++I) {
     if (I != MF.begin()) {
-      printBasicBlockLabel(I, true);
+      printBasicBlockLabel(I, true, true);
       O << '\n';
     }
     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
          II != E; ++II) {
       // Print the assembly for the instruction.
       ++EmittedInsts;
-      O << "\t";
       if (!printInstruction(II)) {
         assert(0 && "Unhandled instruction in asm writer!");
         abort();
@@ -198,8 +198,7 @@ bool AlphaAsmPrinter::doInitialization(Module &M)
   else
     O << "\t.arch ev6\n";
   O << "\t.set noat\n";
-  AsmPrinter::doInitialization(M);
-  return false;
+  return AsmPrinter::doInitialization(M);
 }
 
 bool AlphaAsmPrinter::doFinalization(Module &M) {
@@ -215,7 +214,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) {
     
     std::string name = Mang->getValueName(I);
     Constant *C = I->getInitializer();
-    unsigned Size = TD->getTypeSize(C->getType());
+    unsigned Size = TD->getABITypeSize(C->getType());
     unsigned Align = TD->getPreferredAlignmentLog(I);
     
     //1: hidden?
@@ -271,23 +270,22 @@ bool AlphaAsmPrinter::doFinalization(Module &M) {
     O << '\n';
   }
 
-  AsmPrinter::doFinalization(M);
-  return false;
+  return AsmPrinter::doFinalization(M);
 }
 
 /// PrintAsmOperand - Print out an operand for an inline asm expression.
 ///
 bool AlphaAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
-                                    unsigned AsmVariant, 
-                                    const char *ExtraCode) {
+                                      unsigned AsmVariant, 
+                                      const char *ExtraCode) {
   printOperand(MI, OpNo);
   return false;
 }
 
 bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, 
-                                           unsigned OpNo,
-                                           unsigned AsmVariant, 
-                                           const char *ExtraCode) {
+                                            unsigned OpNo,
+                                            unsigned AsmVariant, 
+                                            const char *ExtraCode) {
   if (ExtraCode && ExtraCode[0])
     return true; // Unknown modifier.
   O << "0(";