summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/include/llvm/IR/Function.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/include/llvm/IR/Function.h')
-rw-r--r--contrib/llvm/include/llvm/IR/Function.h61
1 files changed, 49 insertions, 12 deletions
diff --git a/contrib/llvm/include/llvm/IR/Function.h b/contrib/llvm/include/llvm/IR/Function.h
index f97929f..bba7ecd 100644
--- a/contrib/llvm/include/llvm/IR/Function.h
+++ b/contrib/llvm/include/llvm/IR/Function.h
@@ -159,37 +159,44 @@ public:
/// calling convention of this function. The enum values for the known
/// calling conventions are defined in CallingConv.h.
CallingConv::ID getCallingConv() const {
- return static_cast<CallingConv::ID>(getSubclassDataFromValue() >> 1);
+ return static_cast<CallingConv::ID>(getSubclassDataFromValue() >> 2);
}
void setCallingConv(CallingConv::ID CC) {
- setValueSubclassData((getSubclassDataFromValue() & 1) |
- (static_cast<unsigned>(CC) << 1));
+ setValueSubclassData((getSubclassDataFromValue() & 3) |
+ (static_cast<unsigned>(CC) << 2));
}
- /// getAttributes - Return the attribute list for this Function.
- ///
+ /// @brief Return the attribute list for this Function.
AttributeSet getAttributes() const { return AttributeSets; }
- /// setAttributes - Set the attribute list for this Function.
- ///
+ /// @brief Set the attribute list for this Function.
void setAttributes(AttributeSet attrs) { AttributeSets = attrs; }
- /// addFnAttr - Add function attributes to this function.
- ///
+ /// @brief Add function attributes to this function.
void addFnAttr(Attribute::AttrKind N) {
setAttributes(AttributeSets.addAttribute(getContext(),
AttributeSet::FunctionIndex, N));
}
- /// addFnAttr - Add function attributes to this function.
- ///
+ /// @brief Remove function attributes from this function.
+ void removeFnAttr(Attribute::AttrKind N) {
+ setAttributes(AttributeSets.removeAttribute(
+ getContext(), AttributeSet::FunctionIndex, N));
+ }
+
+ /// @brief Add function attributes to this function.
void addFnAttr(StringRef Kind) {
setAttributes(
AttributeSets.addAttribute(getContext(),
AttributeSet::FunctionIndex, Kind));
}
+ void addFnAttr(StringRef Kind, StringRef Value) {
+ setAttributes(
+ AttributeSets.addAttribute(getContext(),
+ AttributeSet::FunctionIndex, Kind, Value));
+ }
- /// \brief Return true if the function has the attribute.
+ /// @brief Return true if the function has the attribute.
bool hasFnAttribute(Attribute::AttrKind Kind) const {
return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
}
@@ -197,6 +204,14 @@ public:
return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);
}
+ /// @brief Return the attribute for the given attribute kind.
+ Attribute getFnAttribute(Attribute::AttrKind Kind) const {
+ return AttributeSets.getAttribute(AttributeSet::FunctionIndex, Kind);
+ }
+ Attribute getFnAttribute(StringRef Kind) const {
+ return AttributeSets.getAttribute(AttributeSet::FunctionIndex, Kind);
+ }
+
/// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
/// to use during code generation.
bool hasGC() const;
@@ -303,6 +318,21 @@ public:
addAttribute(n, Attribute::NoCapture);
}
+ bool doesNotAccessMemory(unsigned n) const {
+ return AttributeSets.hasAttribute(n, Attribute::ReadNone);
+ }
+ void setDoesNotAccessMemory(unsigned n) {
+ addAttribute(n, Attribute::ReadNone);
+ }
+
+ bool onlyReadsMemory(unsigned n) const {
+ return doesNotAccessMemory(n) ||
+ AttributeSets.hasAttribute(n, Attribute::ReadOnly);
+ }
+ void setOnlyReadsMemory(unsigned n) {
+ addAttribute(n, Attribute::ReadOnly);
+ }
+
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a Function) from the Function Src to this one.
void copyAttributesFrom(const GlobalValue *Src);
@@ -397,6 +427,13 @@ public:
size_t arg_size() const;
bool arg_empty() const;
+ bool hasPrefixData() const {
+ return getSubclassDataFromValue() & 2;
+ }
+
+ Constant *getPrefixData() const;
+ void setPrefixData(Constant *PrefixData);
+
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the
/// program, displaying the CFG of the current function with the code for each
OpenPOWER on IntegriCloud