Use the actual ABI-determined C calling convention for runtime
authorJohn McCall <rjmccall@apple.com>
Thu, 28 Feb 2013 19:01:20 +0000 (19:01 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 28 Feb 2013 19:01:20 +0000 (19:01 +0000)
commit882987f30c919b6bac33588b5de2bd2f29e26a28
tree44e56f927c7488af2c7d101d22f0287446525cd8
parent11a9828745efd724e71e4b361a648bce5047ed14
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
23 files changed:
clang/lib/CodeGen/ABIInfo.h
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGCUDANV.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/CodeGen/CGException.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CGObjCRuntime.cpp
clang/lib/CodeGen/CGObjCRuntime.h
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGenCXX/runtimecc.cpp [new file with mode: 0644]
clang/test/CodeGenObjC/arc-arm.m