diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-02-06 01:16:28 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-02-06 01:16:28 +0000 |
| commit | 74bb06c0f02e650ea9ec73729f41a620fc55a8ee (patch) | |
| tree | afca8ce6c36562b58ca308a8e9ac59667e982e9e /llvm/include | |
| parent | a10e65c852e1a4e27d57960276c6b0ef691fda71 (diff) | |
| download | bcm5719-llvm-74bb06c0f02e650ea9ec73729f41a620fc55a8ee.tar.gz bcm5719-llvm-74bb06c0f02e650ea9ec73729f41a620fc55a8ee.zip | |
Reintroduce the InlineHint function attribute.
This time it's for real! I am going to hook this up in the frontends as well.
The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.
We need some experiments to determine if that is the right thing to do.
llvm-svn: 95466
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm-c/Core.h | 3 | ||||
| -rw-r--r-- | llvm/include/llvm/Attributes.h | 4 | ||||
| -rw-r--r-- | llvm/include/llvm/Transforms/IPO/InlinerPass.h | 7 |
3 files changed, 9 insertions, 5 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index 674dde509d5..98358fe3807 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -118,7 +118,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 7fa5d4ae6bd..068f81fc7de 100644 --- a/llvm/include/llvm/Attributes.h +++ b/llvm/include/llvm/Attributes.h @@ -58,6 +58,8 @@ 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 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 +68,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/include/llvm/Transforms/IPO/InlinerPass.h b/llvm/include/llvm/Transforms/IPO/InlinerPass.h index dc5e644c7fe..30ece0eb422 100644 --- a/llvm/include/llvm/Transforms/IPO/InlinerPass.h +++ b/llvm/include/llvm/Transforms/IPO/InlinerPass.h @@ -52,10 +52,11 @@ struct Inliner : public CallGraphSCCPass { unsigned getInlineThreshold() const { return InlineThreshold; } /// Calculate the inline threshold for given Caller. This threshold is lower - /// if Caller is marked with OptimizeForSize and -inline-threshold is not - /// given on the comand line. + /// if the caller is marked with OptimizeForSize and -inline-threshold is not + /// given on the comand line. It is higher if the callee is marked with the + /// inlinehint attribute. /// - unsigned getInlineThreshold(Function* Caller) const; + unsigned getInlineThreshold(CallSite CS) const; /// getInlineCost - This method must be implemented by the subclass to /// determine the cost of inlining the specified call site. If the cost |

