[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 8 18:23:25 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAG.cpp updated: 1.65 -> 1.66
---
Log message:

Make MachineConstantPool entries alignments explicit


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

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


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.65 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.66
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.65	Sat Feb  4 10:20:31 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp	Wed Feb  8 20:23:13 2006
@@ -23,6 +23,7 @@
 #include "llvm/Target/TargetInstrItineraries.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Constant.h"
 #include <iostream>
 using namespace llvm;
 
@@ -194,8 +195,17 @@
         MI->addFrameIndexOperand(FI->getIndex());
       } else if (ConstantPoolSDNode *CP = 
                     dyn_cast<ConstantPoolSDNode>(Node->getOperand(i))) {
-        unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(),
-                                                       CP->getAlignment());
+        unsigned Align = CP->getAlignment();
+        // MachineConstantPool wants an explicit alignment.
+        if (Align == 0) {
+          if (CP->get()->getType() == Type::DoubleTy)
+            Align = 3;  // always 8-byte align doubles.
+          else
+            Align = TM.getTargetData()
+              .getTypeAlignmentShift(CP->get()->getType());
+        }
+        
+        unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(), Align);
         MI->addConstantPoolIndexOperand(Idx);
       } else if (ExternalSymbolSDNode *ES = 
                  dyn_cast<ExternalSymbolSDNode>(Node->getOperand(i))) {






More information about the llvm-commits mailing list