From 6995cf6015580eeab07a1c671fca180084a1325e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 29 Apr 2007 18:58:03 +0000 Subject: [PATCH] generalize aggregate handling git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36568 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index d2b7e44e9f8..023bbfd0906 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(OpTy)->getElementType(),true); + // If this is an indirect operand, the operand is a pointer to the + // accessed type. + if (OpInfo.isIndirect) + OpTy = cast(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; -- 2.34.1