summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-29 18:58:03 +0000
committerChris Lattner <sabre@nondot.org>2007-04-29 18:58:03 +0000
commit412d61af43e01da7bbdcca22005147d26ff7b2cc (patch)
tree420f1728cb43a8b92585be8ffd5597cfa5ef7e94
parent6058a35624d9258a0aad8c07672dbdeb8de09f96 (diff)
downloadbcm5719-llvm-412d61af43e01da7bbdcca22005147d26ff7b2cc.tar.gz
bcm5719-llvm-412d61af43e01da7bbdcca22005147d26ff7b2cc.zip
generalize aggregate handling
llvm-svn: 36568
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index d2b7e44e9f8..023bbfd0906 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -3248,12 +3248,28 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
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;
OpenPOWER on IntegriCloud