[llvm-commits] [llvm] r165562 - in /llvm/trunk/include/llvm: Instructions.h Support/CallSite.h
Bill Wendling
isanbard at gmail.com
Tue Oct 9 16:40:31 PDT 2012
Author: void
Date: Tue Oct 9 18:40:31 2012
New Revision: 165562
URL: http://llvm.org/viewvc/llvm-project?rev=165562&view=rev
Log:
Use the attribute builder to add attributes to call/invoke instruction. No functionality change intended.
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/Support/CallSite.h
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=165562&r1=165561&r2=165562&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Oct 9 18:40:31 2012
@@ -1280,50 +1280,56 @@
/// @brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
- void setIsNoInline(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::NoInline);
- else removeAttribute(~0, Attribute::NoInline);
+ void setIsNoInline() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoInline);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Return true if the call can return twice
bool canReturnTwice() const {
return hasFnAttr(Attributes::ReturnsTwice);
}
- void setCanReturnTwice(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::ReturnsTwice);
- else removeAttribute(~0, Attribute::ReturnsTwice);
+ void setCanReturnTwice() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReturnsTwice);
+ addAttribute(~0U, Attributes::get(B));
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
return hasFnAttr(Attributes::ReadNone);
}
- void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
- else removeAttribute(~0, Attribute::ReadNone);
+ void setDoesNotAccessMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadNone);
+ addAttribute(~0U, Attributes::get(B));
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
- void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
- else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
+ void setOnlyReadsMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadOnly);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
- void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
- else removeAttribute(~0, Attribute::NoReturn);
+ void setDoesNotReturn() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoReturn);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
- else removeAttribute(~0, Attribute::NoUnwind);
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoUnwind);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call returns a structure through first
@@ -3043,41 +3049,46 @@
/// @brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
- void setIsNoInline(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::NoInline);
- else removeAttribute(~0, Attribute::NoInline);
+ void setIsNoInline() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoInline);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
return hasFnAttr(Attributes::ReadNone);
}
- void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
- else removeAttribute(~0, Attribute::ReadNone);
+ void setDoesNotAccessMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadNone);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
- void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
- else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
+ void setOnlyReadsMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadOnly);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
- void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
- else removeAttribute(~0, Attribute::NoReturn);
+ void setDoesNotReturn() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoReturn);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
- void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
- else removeAttribute(~0, Attribute::NoUnwind);
+ void setDoesNotThrow() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoUnwind);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call returns a structure through first
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=165562&r1=165561&r2=165562&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Tue Oct 9 18:40:31 2012
@@ -211,32 +211,32 @@
bool doesNotAccessMemory() const {
CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
}
- void setDoesNotAccessMemory(bool doesNotAccessMemory = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory(doesNotAccessMemory));
+ void setDoesNotAccessMemory() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory());
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
}
- void setOnlyReadsMemory(bool onlyReadsMemory = true) {
- CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory(onlyReadsMemory));
+ void setOnlyReadsMemory() {
+ CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory());
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const {
CALLSITE_DELEGATE_GETTER(doesNotReturn());
}
- void setDoesNotReturn(bool doesNotReturn = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotReturn(doesNotReturn));
+ void setDoesNotReturn() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotReturn());
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const {
CALLSITE_DELEGATE_GETTER(doesNotThrow());
}
- void setDoesNotThrow(bool doesNotThrow = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotThrow(doesNotThrow));
+ void setDoesNotThrow() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotThrow());
}
#undef CALLSITE_DELEGATE_GETTER
More information about the llvm-commits
mailing list