Add pnaclcall convention to Native Client targets.
authorDerek Schuff <dschuff@google.com>
Tue, 16 Oct 2012 22:30:41 +0000 (22:30 +0000)
committerDerek Schuff <dschuff@google.com>
Tue, 16 Oct 2012 22:30:41 +0000 (22:30 +0000)
commita202096dc0d3bf62e88d194e126f2bef9c54fcec
tree9941a7eda7b9254de7bbbdacab60a8adbe169c21
parent0e8bf254b5fb6ddb2505836361edb44f5df55f25
Add pnaclcall convention to Native Client targets.

Because PNaCl bitcode must be target-independent, it uses some
different bitcode representations from other targets (e.g. byval and
sret for structures). This means that without additional type
information, it cannot meet some native ABI requirements for some
targets (e.g. passing structures containing unions by value on
x86-64). To allow generation of code which uses the correct native
ABIs, we also support triples such as x86_64-nacl, which uses
target-dependent IR (as opposed to le32-nacl, which uses byval and
sret).

To allow interoperation between the two types of code, this patch adds
a calling convention attribute to be used in code compiled with the
target-dependent triple, which will generate code using the le32-style
bitcode. This calling convention does not need to be explicitly
supported in the backend because it determines bitcode representation
rather than native conventions (the backend just needs to undersand
how to handle byval and sret for the Native Client OS).

This patch implements __attribute__((pnaclcall)) to generate calls in
bitcode according to the le32 bitcode conventions, an attribute which
is accepted by any Native Client target, but issues a warning
otherwise.

llvm-svn: 166065
16 files changed:
clang/include/clang-c/Index.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/Specifiers.h
clang/lib/AST/DumpXML.cpp
clang/lib/AST/Type.cpp
clang/lib/AST/TypePrinter.cpp
clang/lib/Basic/Targets.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaType.cpp
clang/test/CodeGen/arm-pnaclcall.c [new file with mode: 0644]
clang/test/CodeGen/x86_64-arguments-nacl.c
clang/test/Sema/callingconv.c
clang/tools/libclang/CXType.cpp