From 882987f30c919b6bac33588b5de2bd2f29e26a28 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 28 Feb 2013 19:01:20 +0000 Subject: Use the actual ABI-determined C calling convention for runtime calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286 --- clang/lib/CodeGen/CodeGenFunction.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenFunction.h') diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6cb0b3304eb..e64498859c4 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2301,11 +2301,29 @@ public: RValue EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue = ReturnValueSlot()); + llvm::CallInst *EmitRuntimeCall(llvm::Value *callee, + const Twine &name = ""); + llvm::CallInst *EmitRuntimeCall(llvm::Value *callee, + ArrayRef args, + const Twine &name = ""); + llvm::CallInst *EmitNounwindRuntimeCall(llvm::Value *callee, + const Twine &name = ""); + llvm::CallInst *EmitNounwindRuntimeCall(llvm::Value *callee, + ArrayRef args, + const Twine &name = ""); + llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee, ArrayRef Args, const Twine &Name = ""); llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee, const Twine &Name = ""); + llvm::CallSite EmitRuntimeCallOrInvoke(llvm::Value *callee, + ArrayRef args, + const Twine &name = ""); + llvm::CallSite EmitRuntimeCallOrInvoke(llvm::Value *callee, + const Twine &name = ""); + void EmitNoreturnRuntimeCallOrInvoke(llvm::Value *callee, + ArrayRef args); llvm::Value *BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This, llvm::Type *Ty); -- cgit v1.2.3