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

Chris Lattner sabre at nondot.org
Sun Apr 29 11:58:20 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.438 -> 1.439
---
Log message:

generalize aggregate handling


---
Diffs of the changes:  (+21 -5)

 SelectionDAGISel.cpp |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.438 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.439
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.438	Sat Apr 28 16:12:06 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sun Apr 29 13:58:03 2007
@@ -3248,12 +3248,28 @@
     if (OpInfo.CallOperandVal) {
       OpInfo.CallOperand = getValue(OpInfo.CallOperandVal);
       const Type *OpTy = OpInfo.CallOperandVal->getType();
-      if (!OpInfo.isIndirect) {
-        // Must be an input.
-        OpVT = TLI.getValueType(OpTy);
-      } else {
-        OpVT = TLI.getValueType(cast<PointerType>(OpTy)->getElementType(),true);
+      // If this is an indirect operand, the operand is a pointer to the
+      // accessed type.
+      if (OpInfo.isIndirect)
+        OpTy = cast<PointerType>(OpTy)->getElementType();
+      
+      // If OpTy is not a first-class value, it may be a struct/union that we
+      // can tile with integers.
+      if (!OpTy->isFirstClassType() && OpTy->isSized()) {
+        unsigned BitSize = TD->getTypeSizeInBits(OpTy);
+        switch (BitSize) {
+        default: break;
+        case 1:
+        case 8:
+        case 16:
+        case 32:
+        case 64:
+          OpTy = IntegerType::get(BitSize);
+          break;
+        }
       }
+      
+      OpVT = TLI.getValueType(OpTy, true);
     }
     
     OpInfo.ConstraintVT = OpVT;






More information about the llvm-commits mailing list