diff options
author | James Molloy <james.molloy@arm.com> | 2012-12-20 16:04:27 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2012-12-20 16:04:27 +0000 |
commit | 67ae13575900e8efd056672987249fd0adbf5e73 (patch) | |
tree | c297968f698f92b4b2d7b06c6d892a2299061887 /lib/AsmParser | |
parent | 6af228a92a7b8414fa3c1b3c37ee659d32e66e1b (diff) | |
download | llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.gz llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.bz2 llvm-67ae13575900e8efd056672987249fd0adbf5e73.tar.xz |
Add a new attribute, 'noduplicate'. If a function contains a noduplicate call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call.
Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 3 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 350eef2b19..5300f9276b 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -564,6 +564,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(nonlazybind); KEYWORD(address_safety); KEYWORD(minsize); + KEYWORD(noduplicate); KEYWORD(type); KEYWORD(opaque); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 7ba32b83f9..c45ad0a083 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -957,6 +957,7 @@ bool LLParser::ParseOptionalFuncAttrs(AttrBuilder &B) { case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break; case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break; case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break; + case lltok::kw_noduplicate: B.addAttribute(Attribute::NoDuplicate); break; // Error handling. case lltok::kw_zeroext: @@ -1042,6 +1043,7 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) { case lltok::kw_byval: case lltok::kw_nest: HaveError |= Error(Lex.getLoc(), "invalid use of parameter-only attribute"); break; + case lltok::kw_noreturn: case lltok::kw_nounwind: case lltok::kw_uwtable: case lltok::kw_returns_twice: case lltok::kw_noinline: case lltok::kw_readnone: @@ -1052,6 +1054,7 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) { case lltok::kw_naked: case lltok::kw_nonlazybind: case lltok::kw_address_safety: case lltok::kw_minsize: case lltok::kw_alignstack: case lltok::kw_align: + case lltok::kw_noduplicate: HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute"); break; } diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 2ed2c221a8..5b4d415d8e 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -116,6 +116,7 @@ namespace lltok { kw_nonlazybind, kw_address_safety, kw_minsize, + kw_noduplicate, kw_type, kw_opaque, |