diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-23 22:59:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-23 22:59:07 +0000 |
commit | a54934ae9d278448fb557366eb4a79a8cb3fc606 (patch) | |
tree | 840df7c6eee7773d11a40219125eccd77714da57 /include | |
parent | bc7a902713c4e3f13a93c383e647d2a18712f447 (diff) | |
download | llvm-a54934ae9d278448fb557366eb4a79a8cb3fc606.tar.gz llvm-a54934ae9d278448fb557366eb4a79a8cb3fc606.tar.bz2 llvm-a54934ae9d278448fb557366eb4a79a8cb3fc606.tar.xz |
add some accessors to callsite/callinst/invokeinst to check
for the noinline attribute, and make the inliner refuse to
inline a call site when the call site is marked noinline even
if the callee isn't. This fixes PR6682.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 14 | ||||
-rw-r--r-- | include/llvm/Support/CallSite.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index b1f1996045..b382f0c912 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -971,6 +971,13 @@ public: unsigned getParamAlignment(unsigned i) const { return AttributeList.getParamAlignment(i); } + + /// @brief Return true if the call should not be inlined. + bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); } + void setIsNoInline(bool Value) { + if (Value) addAttribute(~0, Attribute::NoInline); + else removeAttribute(~0, Attribute::NoInline); + } /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const { @@ -2456,6 +2463,13 @@ public: return AttributeList.getParamAlignment(i); } + /// @brief Return true if the call should not be inlined. + bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); } + void setIsNoInline(bool Value) { + if (Value) addAttribute(~0, Attribute::NoInline); + else removeAttribute(~0, Attribute::NoInline); + } + /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const { return paramHasAttr(~0, Attribute::ReadNone); diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index 285b558afc..23d24e7c5e 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -76,6 +76,10 @@ public: /// @brief Extract the alignment for a call or parameter (0=unknown). uint16_t getParamAlignment(uint16_t i) const; + /// @brief Return true if the call should not be inlined. + bool isNoInline() const; + void setIsNoInline(bool Value = true); + /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const; void setDoesNotAccessMemory(bool doesNotAccessMemory = true); |