diff options
author | Dale Johannesen <dalej@apple.com> | 2009-08-26 01:08:21 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-08-26 01:08:21 +0000 |
commit | 2aaf5395640d33eb2db8b7c41829e23459ab54f6 (patch) | |
tree | 1dda5eb2c9e6235d3d26225d0348856a9c6c3d29 | |
parent | a1b4dd96f298008e10f5ff09cf7b25556fab96b8 (diff) | |
download | bcm5719-llvm-2aaf5395640d33eb2db8b7c41829e23459ab54f6.tar.gz bcm5719-llvm-2aaf5395640d33eb2db8b7c41829e23459ab54f6.zip |
Add an 'inline hint' attribute to represent source
code hints that it would be a good idea to inline
a function ("inline" keyword). No functional change
yet; FEs do not emit this and inliner does not use it.
llvm-svn: 80063
-rw-r--r-- | llvm/docs/LangRef.html | 5 | ||||
-rw-r--r-- | llvm/include/llvm-c/Core.h | 3 | ||||
-rw-r--r-- | llvm/include/llvm/Attributes.h | 5 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/AsmParser/LLToken.h | 1 | ||||
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/VMCore/Attributes.cpp | 2 | ||||
-rw-r--r-- | llvm/utils/llvm.grm | 1 | ||||
-rw-r--r-- | llvm/utils/vim/llvm.vim | 2 |
10 files changed, 18 insertions, 4 deletions
diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html index ab86271f333..44ef03b4efe 100644 --- a/llvm/docs/LangRef.html +++ b/llvm/docs/LangRef.html @@ -1042,6 +1042,11 @@ define void @f() optsize function into callers whenever possible, ignoring any active inlining size threshold for this caller.</dd> + <dt><tt>inlinehint</tt></dt> + <dd>This attribute indicates that the source code contained a hint that inlining + this function is desirable (such as the "inline" keyword in C/C++). It + is just a hint; it imposes no requirements on the inliner.</dd> + <dt><tt>noinline</tt></dt> <dd>This attribute indicates that the inliner should never inline this function in any situation. This attribute may not be used together with diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index b0a9800ce29..e1a99531b55 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -109,7 +109,8 @@ typedef enum { LLVMNoCaptureAttribute = 1<<21, LLVMNoRedZoneAttribute = 1<<22, LLVMNoImplicitFloatAttribute = 1<<23, - LLVMNakedAttribute = 1<<24 + LLVMNakedAttribute = 1<<24, + LLVMInlineHintAttribute = 1<<25 } LLVMAttribute; typedef enum { diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h index 49f6057f31a..0bbdc349b1b 100644 --- a/llvm/include/llvm/Attributes.h +++ b/llvm/include/llvm/Attributes.h @@ -57,7 +57,8 @@ const Attributes NoCapture = 1<<21; ///< Function creates no aliases of pointer const Attributes NoRedZone = 1<<22; /// disable redzone const Attributes NoImplicitFloat = 1<<23; /// disable implicit floating point /// instructions. -const Attributes Naked = 1<<24; ///< Naked function +const Attributes Naked = 1<<24; ///< Naked function +const Attributes InlineHint = 1<<25; ///< source said inlining was desirable /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; @@ -66,7 +67,7 @@ const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; /// be used on return values or function parameters. const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq | - NoRedZone | NoImplicitFloat | Naked; + NoRedZone | NoImplicitFloat | Naked | InlineHint; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 8d6b5dbb134..23d7f19bbce 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -556,6 +556,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(readnone); KEYWORD(readonly); + KEYWORD(inlinehint); KEYWORD(noinline); KEYWORD(alwaysinline); KEYWORD(optsize); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 5ac4a82ccbe..784672acef2 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -907,6 +907,7 @@ bool LLParser::ParseOptionalAttrs(unsigned &Attrs, unsigned AttrKind) { case lltok::kw_noinline: Attrs |= Attribute::NoInline; break; case lltok::kw_readnone: Attrs |= Attribute::ReadNone; break; case lltok::kw_readonly: Attrs |= Attribute::ReadOnly; break; + case lltok::kw_inlinehint: Attrs |= Attribute::InlineHint; break; case lltok::kw_alwaysinline: Attrs |= Attribute::AlwaysInline; break; case lltok::kw_optsize: Attrs |= Attribute::OptimizeForSize; break; case lltok::kw_ssp: Attrs |= Attribute::StackProtect; break; diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h index a49d05442bc..b053cca18a7 100644 --- a/llvm/lib/AsmParser/LLToken.h +++ b/llvm/lib/AsmParser/LLToken.h @@ -82,6 +82,7 @@ namespace lltok { kw_readnone, kw_readonly, + kw_inlinehint, kw_noinline, kw_alwaysinline, kw_optsize, diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index bebad667967..e9b3aa901d0 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -472,6 +472,7 @@ namespace { HANDLE_ATTR(Nest); HANDLE_ATTR(ReadNone); HANDLE_ATTR(ReadOnly); + HANDLE_ATTR(InlineHint); HANDLE_ATTR(NoInline); HANDLE_ATTR(AlwaysInline); HANDLE_ATTR(OptimizeForSize); diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index 51fd5f02ac9..d68bba30729 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -55,6 +55,8 @@ std::string Attribute::getAsString(Attributes Attrs) { Result += "optsize "; if (Attrs & Attribute::NoInline) Result += "noinline "; + if (Attrs & Attribute::InlineHint) + Result += "inlinehint "; if (Attrs & Attribute::AlwaysInline) Result += "alwaysinline "; if (Attrs & Attribute::StackProtect) diff --git a/llvm/utils/llvm.grm b/llvm/utils/llvm.grm index 4499d4b35a9..86a707a925d 100644 --- a/llvm/utils/llvm.grm +++ b/llvm/utils/llvm.grm @@ -161,6 +161,7 @@ FuncAttr ::= noreturn | signext | readnone | readonly + | inlinehint | noinline | alwaysinline | optsize diff --git a/llvm/utils/vim/llvm.vim b/llvm/utils/vim/llvm.vim index b99b04cdd14..2cc266bd27e 100644 --- a/llvm/utils/vim/llvm.vim +++ b/llvm/utils/vim/llvm.vim @@ -51,7 +51,7 @@ syn keyword llvmKeyword volatile fastcc coldcc cc ccc syn keyword llvmKeyword x86_stdcallcc x86_fastcallcc syn keyword llvmKeyword signext zeroext inreg sret nounwind noreturn syn keyword llvmKeyword nocapture byval nest readnone readonly noalias -syn keyword llvmKeyword noinline alwaysinline optsize ssp sspreq +syn keyword llvmKeyword inlinehint noinline alwaysinline optsize ssp sspreq syn keyword llvmKeyword noredzone noimplicitfloat naked syn keyword llvmKeyword module asm align tail to syn keyword llvmKeyword addrspace section alias sideeffect c gc |