diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-12-19 02:14:12 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-12-19 02:14:12 +0000 |
commit | a534a381304efc038276f426a756f5c56834bbc5 (patch) | |
tree | 0e73ad0bfb6ba29e5473a7ce1d4d91bb68175557 /llvm/lib/IR/Function.cpp | |
parent | b353ee18086227b3a4192a970cdbced5358003f5 (diff) | |
download | bcm5719-llvm-a534a381304efc038276f426a756f5c56834bbc5.tar.gz bcm5719-llvm-a534a381304efc038276f426a756f5c56834bbc5.zip |
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
llvm-svn: 197645
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index e8a2402b3d9..970bbaeed8b 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -84,6 +84,14 @@ bool Argument::hasByValAttr() const { hasAttribute(getArgNo()+1, Attribute::ByVal); } +/// \brief Return true if this argument has the inalloca attribute on it in +/// its containing function. +bool Argument::hasInAllocaAttr() const { + if (!getType()->isPointerTy()) return false; + return getParent()->getAttributes(). + hasAttribute(getArgNo()+1, Attribute::InAlloca); +} + unsigned Argument::getParamAlignment() const { assert(getType()->isPointerTy() && "Only pointers have alignments"); return getParent()->getParamAlignment(getArgNo()+1); |