summaryrefslogtreecommitdiff
path: root/lib/AsmParser
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 /lib/AsmParser
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 'lib/AsmParser')
-rw-r--r--lib/AsmParser/LLLexer.cpp1
-rw-r--r--lib/AsmParser/LLParser.cpp3
-rw-r--r--lib/AsmParser/LLToken.h1
3 files changed, 5 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 3c384f5fcc..1b32047e4b 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -572,6 +572,7 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(alwaysinline);
KEYWORD(builtin);
KEYWORD(byval);
+ KEYWORD(inalloca);
KEYWORD(cold);
KEYWORD(inlinehint);
KEYWORD(inreg);
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 3b903cdb09..a5b2aa586e 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -944,6 +944,7 @@ bool LLParser::ParseFnAttributeValuePairs(AttrBuilder &B,
"invalid use of attribute on a function");
break;
case lltok::kw_byval:
+ case lltok::kw_inalloca:
case lltok::kw_nest:
case lltok::kw_noalias:
case lltok::kw_nocapture:
@@ -1156,6 +1157,7 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
continue;
}
case lltok::kw_byval: B.addAttribute(Attribute::ByVal); break;
+ case lltok::kw_inalloca: B.addAttribute(Attribute::InAlloca); break;
case lltok::kw_inreg: B.addAttribute(Attribute::InReg); break;
case lltok::kw_nest: B.addAttribute(Attribute::Nest); break;
case lltok::kw_noalias: B.addAttribute(Attribute::NoAlias); break;
@@ -1218,6 +1220,7 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
// Error handling.
case lltok::kw_align:
case lltok::kw_byval:
+ case lltok::kw_inalloca:
case lltok::kw_nest:
case lltok::kw_nocapture:
case lltok::kw_returned:
diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h
index 786d84d766..5a6866dd14 100644
--- a/lib/AsmParser/LLToken.h
+++ b/lib/AsmParser/LLToken.h
@@ -99,6 +99,7 @@ namespace lltok {
kw_sanitize_address,
kw_builtin,
kw_byval,
+ kw_inalloca,
kw_cold,
kw_inlinehint,
kw_inreg,