[llvm-commits] [llvm-gcc-4.2] r79706 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Eric Christopher
echristo at apple.com
Fri Aug 21 17:25:40 PDT 2009
Author: echristo
Date: Fri Aug 21 19:25:39 2009
New Revision: 79706
URL: http://llvm.org/viewvc/llvm-project?rev=79706&view=rev
Log:
The unwind and resume call is not an llvm intrinsic and therefore
needs a calling convention set on it for targets that have default
calling conventions - do that in the call to EmitUnwindBlock() or
else instcombine will likely delete the call later due to a
mismatch of calling convention.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=79706&r1=79705&r2=79706&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Aug 21 19:25:39 2009
@@ -2159,7 +2159,21 @@
// Fetch and store exception handler.
Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr");
assert(llvm_unwind_resume_libfunc && "no unwind resume function!");
+
+ // As we're emitting a naked call (not an expression) going through
+ // EmitCallOf would be wasteful and incorrect. Manually adjust
+ // the calling convention for this call here if necessary.
+#ifdef TARGET_ADJUST_LLVM_CC
+ tree fntype = TREE_TYPE(llvm_unwind_resume_libfunc);
+ CallingConv::ID CallingConvention = CallingConv::C;
+
+ TARGET_ADJUST_LLVM_CC(CallingConvention, fntype);
+ CallInst *Call = Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc),
+ Arg);
+ Call->setCallingConv(CallingConvention);
+#else
Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc), Arg);
+#endif
Builder.CreateUnreachable();
}
}
More information about the llvm-commits
mailing list