diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86CallingConv.td | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/swift-error.ll | 18 |
3 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 9acaa446447..15d06871e70 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1253,6 +1253,8 @@ static void propagateSwiftErrorVRegs(FunctionLoweringInfo *FuncInfo) { // If we don't need a phi create a copy to the upward exposed vreg. if (!needPHI) { assert(UpwardsUse); + assert(!VRegs.empty() && + "No predecessors? Is the Calling Convention correct?"); unsigned DestReg = UUseVReg; BuildMI(*MBB, MBB->getFirstNonPHI(), DLoc, TII->get(TargetOpcode::COPY), DestReg) diff --git a/llvm/lib/Target/X86/X86CallingConv.td b/llvm/lib/Target/X86/X86CallingConv.td index 26461986427..64c81391578 100644 --- a/llvm/lib/Target/X86/X86CallingConv.td +++ b/llvm/lib/Target/X86/X86CallingConv.td @@ -592,6 +592,9 @@ def CC_X86_Win64_C : CallingConv<[ // The 'nest' parameter, if any, is passed in R10. CCIfNest<CCAssignToReg<[R10]>>, + // A SwiftError is passed in R12. + CCIfSwiftError<CCIfType<[i64], CCAssignToReg<[R12]>>>, + // 128 bit vectors are passed by pointer CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCPassIndirect<i64>>, diff --git a/llvm/test/CodeGen/X86/swift-error.ll b/llvm/test/CodeGen/X86/swift-error.ll new file mode 100644 index 00000000000..5fb67d4f3b2 --- /dev/null +++ b/llvm/test/CodeGen/X86/swift-error.ll @@ -0,0 +1,18 @@ +; RUN: llc -mtriple x86_64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s + +%swift.error = type opaque + +declare swiftcc void @f(%swift.error** swifterror) + +define swiftcc void @g(i8*, i8*, i8*, i8*, %swift.error** swifterror %error) { +entry: + call swiftcc void @f(%swift.error** nonnull nocapture swifterror %error) + ret void +} + +; CHECK-LABEL: g +; CHECK: pushq %r12 +; CHECK: callq f +; CHECK: popq %r12 +; CHECK: retq + |

