diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-27 23:44:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-27 23:44:28 +0000 |
commit | acf8b01fd6dd7a796d490795886bdfa67f074631 (patch) | |
tree | b8f43ffb489f1ca071587d3de5c8592bb50336a1 | |
parent | 96bb6226462536dc0fff4b5c0250613300abb9fb (diff) |
Another step to getting multiple result inline asm to work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50329 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index b63470ffd1..b43ff1c625 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3760,6 +3760,7 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) { bool SawEarlyClobber = false; unsigned ArgNo = 0; // ArgNo - The argument of the CallInst. + unsigned ResNo = 0; // ResNo - The result number of the next output. for (unsigned i = 0, e = ConstraintInfos.size(); i != e; ++i) { ConstraintOperands.push_back(SDISelAsmOperandInfo(ConstraintInfos[i])); SDISelAsmOperandInfo &OpInfo = ConstraintOperands.back(); @@ -3769,14 +3770,21 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) { // Compute the value type for each operand. switch (OpInfo.Type) { case InlineAsm::isOutput: - if (!OpInfo.isIndirect) { - // The return value of the call is this value. As such, there is no - // corresponding argument. - assert(CS.getType() != Type::VoidTy && "Bad inline asm!"); - OpVT = TLI.getValueType(CS.getType()); - } else { + // Indirect outputs just consume an argument. + if (OpInfo.isIndirect) { OpInfo.CallOperandVal = CS.getArgument(ArgNo++); + break; + } + // The return value of the call is this value. As such, there is no + // corresponding argument. + assert(CS.getType() != Type::VoidTy && "Bad inline asm!"); + if (const StructType *STy = dyn_cast<StructType>(CS.getType())) { + OpVT = TLI.getValueType(STy->getElementType(ResNo)); + } else { + assert(ResNo == 0 && "Asm only has one result!"); + OpVT = TLI.getValueType(CS.getType()); } + ++ResNo; break; case InlineAsm::isInput: OpInfo.CallOperandVal = CS.getArgument(ArgNo++); |