eliminate the ARMFunctionInfo::Align member, using
[oota-llvm.git] / lib / Target / ARM / AsmPrinter / ARMAsmPrinter.cpp
index 63aa7ce7eac7d36a893d0e43ae25a6d57b103ddc..7fcd0e974297db7ae9e422cefd78d53b3861ae02 100644 (file)
@@ -241,8 +241,6 @@ namespace {
 /// method to print assembly for each instruction.
 ///
 bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  this->MF = &MF;
-
   AFI = MF.getInfo<ARMFunctionInfo>();
   MCP = MF.getConstantPool();
 
@@ -282,16 +280,13 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   printVisibility(CurrentFnSym, F->getVisibility());
 
-  unsigned FnAlign = 1 << MF.getAlignment();  // MF alignment is log2.
+  EmitAlignment(1 << MF.getAlignment(), F);
   if (AFI->isThumbFunction()) {
-    EmitAlignment(FnAlign, F, AFI->getAlign());
     O << "\t.code\t16\n";
     O << "\t.thumb_func";
     if (Subtarget->isTargetDarwin())
       O << "\t" << *CurrentFnSym;
     O << "\n";
-  } else {
-    EmitAlignment(FnAlign, F);
   }
 
   O << *CurrentFnSym << ":\n";
@@ -371,7 +366,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
     break;
   }
   case MachineOperand::MO_MachineBasicBlock:
-    O << *GetMBBSymbol(MO.getMBB()->getNumber());
+    O << *MO.getMBB()->getSymbol(OutContext);
     return;
   case MachineOperand::MO_GlobalAddress: {
     bool isCallOp = Modifier && !strcmp(Modifier, "call");
@@ -938,29 +933,28 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
 
   const char *JTEntryDirective = MAI->getData32bitsDirective();
 
-  const MachineFunction *MF = MI->getParent()->getParent();
   const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
-  bool UseSet= MAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
+  bool UseSet= MAI->hasSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
   SmallPtrSet<MachineBasicBlock*, 8> JTSets;
   for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
     MachineBasicBlock *MBB = JTBBs[i];
     bool isNew = JTSets.insert(MBB);
 
     if (UseSet && isNew) {
-      O << MAI->getSetDirective() << ' '
+      O << "\t.set\t"
         << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << ','
-        << *GetMBBSymbol(MBB->getNumber()) << '-' << *JTISymbol << '\n';
+        << *MBB->getSymbol(OutContext) << '-' << *JTISymbol << '\n';
     }
 
     O << JTEntryDirective << ' ';
     if (UseSet)
       O << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB);
     else if (TM.getRelocationModel() == Reloc::PIC_)
-      O << *GetMBBSymbol(MBB->getNumber()) << '-' << *JTISymbol;
+      O << *MBB->getSymbol(OutContext) << '-' << *JTISymbol;
     else
-      O << *GetMBBSymbol(MBB->getNumber());
+      O << *MBB->getSymbol(OutContext);
 
     if (i != e-1)
       O << '\n';
@@ -975,7 +969,6 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) {
   MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel2(JTI, MO2.getImm());
   OutStreamer.EmitLabel(JTISymbol);
 
-  const MachineFunction *MF = MI->getParent()->getParent();
   const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
@@ -993,9 +986,9 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) {
       O << MAI->getData16bitsDirective();
     
     if (ByteOffset || HalfWordOffset)
-      O << '(' << *GetMBBSymbol(MBB->getNumber()) << "-" << *JTISymbol << ")/2";
+      O << '(' << *MBB->getSymbol(OutContext) << "-" << *JTISymbol << ")/2";
     else
-      O << "\tb.w " << *GetMBBSymbol(MBB->getNumber());
+      O << "\tb.w " << *MBB->getSymbol(OutContext);
 
     if (i != e-1)
       O << '\n';