[llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 17 12:25:55 PDT 2004



Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.118 -> 1.119
---
Log message:

Start using alignment output routines from AsmPrinter.
Changes to make this more similar to the ppc asmprinter


---
Diffs of the changes:  (+8 -10)

Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.118 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.119
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.118	Tue Aug 17 01:48:55 2004
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp	Tue Aug 17 14:25:42 2004
@@ -149,9 +149,8 @@
 
   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
     O << "\t.section .rodata\n";
-    O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
-      << "\n";
-    O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t#"
+    emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
+    O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentChar
       << *CP[i] << "\n";
     emitGlobalConstant(CP[i]);
   }
@@ -169,7 +168,7 @@
 
   // Print out labels for the function.
   O << "\t.text\n";
-  O << "\t.align 16\n";
+  emitAlignment(4);
   O << "\t.globl\t" << CurrentFnName << "\n";
   O << "\t.type\t" << CurrentFnName << ", @function\n";
   O << CurrentFnName << ":\n";
@@ -178,8 +177,8 @@
   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
        I != E; ++I) {
     // Print a label for the basic block.
-    O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t# "
-      << I->getBasicBlock()->getName() << "\n";
+    O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t"
+      << CommentChar << " " << I->getBasicBlock()->getName() << "\n";
     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
          II != E; ++II) {
       // Print the assembly for the instruction.
@@ -387,7 +386,7 @@
       std::string name = Mang->getValueName(I);
       Constant *C = I->getInitializer();
       unsigned Size = TD.getTypeSize(C->getType());
-      unsigned Align = TD.getTypeAlignment(C->getType());
+      unsigned Align = TD.getTypeAlignmentShift(C->getType());
 
       if (C->isNullValue() && 
           (I->hasLinkOnceLinkage() || I->hasInternalLinkage() ||
@@ -397,7 +396,7 @@
           O << "\t.local " << name << "\n";
         
         O << "\t.comm " << name << "," << TD.getTypeSize(C->getType())
-          << "," << (unsigned)TD.getTypeAlignment(C->getType());
+          << "," << (1 << Align);
         O << "\t\t# ";
         WriteAsOperand(O, I, true, true, &M);
         O << "\n";
@@ -410,7 +409,6 @@
           SwitchSection(O, CurSection, "");
           O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\", at progbits\n";
           break;
-        
         case GlobalValue::AppendingLinkage:
           // FIXME: appending linkage variables should go into a section of
           // their name or something.  For now, just emit them as external.
@@ -426,7 +424,7 @@
           break;
         }
 
-        O << "\t.align " << Align << "\n";
+        emitAlignment(Align);
         O << "\t.type " << name << ", at object\n";
         O << "\t.size " << name << "," << Size << "\n";
         O << name << ":\t\t\t\t# ";






More information about the llvm-commits mailing list