aboutsummaryrefslogtreecommitdiffstats
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
commit6995cf6015580eeab07a1c671fca180084a1325e (patch)
tree74565b2ee711ab8659266970daa57206354eb4d2
parentf52e608459011b6f0ebc6eda29e9ba5cb632682e (diff)
downloadexternal_llvm-6995cf6015580eeab07a1c671fca180084a1325e.tar.gz
external_llvm-6995cf6015580eeab07a1c671fca180084a1325e.tar.bz2
external_llvm-6995cf6015580eeab07a1c671fca180084a1325e.zip
generalize aggregate handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36568 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index d2b7e44e9f..023bbfd090 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/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;