[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 8 20:46:17 PST 2006



Changes in directory llvm/lib/Target/SparcV9:

SparcV9AsmPrinter.cpp updated: 1.129 -> 1.130
---
Log message:

Adjust to MachineConstantPool interface change: instead of keeping a 
value/alignment pair for each constant, keep a value/offset pair.


---
Diffs of the changes:  (+12 -2)

 SparcV9AsmPrinter.cpp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.129 llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.130
--- llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.129	Wed Feb  8 22:22:52 2006
+++ llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp	Wed Feb  8 22:46:04 2006
@@ -216,7 +216,8 @@
 
       if (Alignment == 0)
         Alignment = ConstantToAlignment(CV, TM);
-      O << "\t.align\t" << Alignment << "\n";
+      if (Alignment != 1)
+        O << "\t.align\t" << Alignment << "\n";
 
       // Print .size and .type only if it is not a string.
       if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
@@ -727,9 +728,18 @@
   const std::vector<MachineConstantPoolEntry> &CP = MCP->getConstants();
 
   enterSection(ReadOnlyData);
+  O << "\t.align\t" << (1 << MCP->getConstantPoolAlignment()) << "\n";
   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
     std::string cpiName = ".CPI_" + CurrentFnName + "_" + utostr(i);
-    printConstant(CP[i].Val, CP[i].Alignment, cpiName);
+    printConstant(CP[i].Val, 1, cpiName);
+    
+    if (i != e-1) {
+      unsigned EntSize = TM.getTargetData().getTypeSize(CP[i].Val->getType());
+      unsigned ValEnd = CP[i].Offset + EntSize;
+      // Emit inter-object padding for alignment.
+      for (unsigned NumZeros = CP[i+1].Offset-ValEnd; NumZeros; --NumZeros)
+        O << "\t.byte 0\n";
+    }
   }
 
   enterSection(Text);






More information about the llvm-commits mailing list