summaryrefslogtreecommitdiff
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-12-19 02:14:12 +0000
committerReid Kleckner <reid@kleckner.net>2013-12-19 02:14:12 +0000
commit4b70bfc905f3ac68a8429f9fe0016e30433b3b0c (patch)
treea00d968a7acb98e5d24df90bbb9d1ba61befb0c9 /include/llvm/Support
parent1d4866ccbfa64517e5755ddb06f92b4b6aafda0f (diff)
downloadllvm-4b70bfc905f3ac68a8429f9fe0016e30433b3b0c.tar.gz
llvm-4b70bfc905f3ac68a8429f9fe0016e30433b3b0c.tar.bz2
llvm-4b70bfc905f3ac68a8429f9fe0016e30433b3b0c.tar.xz
Begin adding docs and IR-level support for the inalloca attribute
The inalloca attribute is designed to support passing C++ objects by value in the Microsoft C++ ABI. It behaves the same as byval, except that it always implies that the argument is in memory and that the bytes are never copied. This attribute allows the caller to take the address of an outgoing argument's memory and execute arbitrary code to store into it. This patch adds basic IR support, docs, and verification. It does not attempt to implement any lowering or fix any possibly broken transforms. When this patch lands, a complete description of this feature should appear at http://llvm.org/docs/InAlloca.html . Differential Revision: http://llvm-reviews.chandlerc.com/D2173 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/CallSite.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h
index 2a1c5ca4d4..d2c47b53ed 100644
--- a/include/llvm/Support/CallSite.h
+++ b/include/llvm/Support/CallSite.h
@@ -257,6 +257,22 @@ public:
return paramHasAttr(ArgNo + 1, Attribute::ByVal);
}
+ /// @brief Determine whether this argument is passed in an alloca.
+ bool isInAllocaArgument(unsigned ArgNo) const {
+ return paramHasAttr(ArgNo + 1, Attribute::InAlloca);
+ }
+
+ /// @brief Determine whether this argument is passed by value or in an alloca.
+ bool isByValOrInAllocaArgument(unsigned ArgNo) const {
+ return paramHasAttr(ArgNo + 1, Attribute::ByVal) ||
+ paramHasAttr(ArgNo + 1, Attribute::InAlloca);
+ }
+
+ /// @brief Determine if there are any inalloca arguments.
+ bool hasInAllocaArgument() const {
+ return getAttributes().hasAttrSomewhere(Attribute::InAlloca);
+ }
+
bool doesNotAccessMemory(unsigned ArgNo) const {
return paramHasAttr(ArgNo + 1, Attribute::ReadNone);
}