[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Jan 22 15:04:52 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.28 -> 1.29
---
Log message:
Get this to work for 64-bit systems.
---
Diffs of the changes: (+11 -6)
SelectionDAGISel.cpp | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.28 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.29
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.28 Wed Jan 19 16:31:21 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Jan 22 17:04:37 2005
@@ -566,11 +566,13 @@
unsigned Align = TLI.getTargetData().getTypeAlignment(Ty);
SDOperand AllocSize = getValue(I.getArraySize());
+ MVT::ValueType IntPtr = TLI.getPointerTy();
+ if (IntPtr < AllocSize.getValueType())
+ AllocSize = DAG.getNode(ISD::TRUNCATE, IntPtr, AllocSize);
+ else if (IntPtr > AllocSize.getValueType())
+ AllocSize = DAG.getNode(ISD::ZERO_EXTEND, IntPtr, AllocSize);
- assert(AllocSize.getValueType() == TLI.getPointerTy() &&
- "FIXME: should extend or truncate to pointer size!");
-
- AllocSize = DAG.getNode(ISD::MUL, TLI.getPointerTy(), AllocSize,
+ AllocSize = DAG.getNode(ISD::MUL, IntPtr, AllocSize,
getIntPtrConstant(TySize));
// Handle alignment. If the requested alignment is less than or equal to the
@@ -679,8 +681,11 @@
SDOperand Src = getValue(I.getOperand(0));
MVT::ValueType IntPtr = TLI.getPointerTy();
- // FIXME: Extend or truncate to the intptr size.
- assert(Src.getValueType() == IntPtr && "Need to adjust the amount!");
+
+ if (IntPtr < Src.getValueType())
+ Src = DAG.getNode(ISD::TRUNCATE, IntPtr, Src);
+ else if (IntPtr > Src.getValueType())
+ Src = DAG.getNode(ISD::ZERO_EXTEND, IntPtr, Src);
// Scale the source by the type size.
uint64_t ElementSize = TD.getTypeSize(I.getType()->getElementType());
More information about the llvm-commits
mailing list