summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm-c/Core.h7
-rw-r--r--llvm/lib/IR/Core.cpp11
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 67527750720..3d54a216178 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -1706,6 +1706,13 @@ void LLVMSetGC(LLVMValueRef Fn, const char *Name);
void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
/**
+ * Add a target-dependent attribute to a fuction
+ * @see llvm::AttrBuilder::addAttribute()
+ */
+void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
+ const char *V);
+
+/**
* Obtain an attribute from a function.
*
* @see llvm::Function::getAttributes()
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index f1f7eb31bb3..e769ab4e7d0 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1443,6 +1443,17 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
Func->setAttributes(PALnew);
}
+void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
+ const char *V) {
+ Function *Func = unwrap<Function>(Fn);
+ int Idx = AttributeSet::FunctionIndex;
+ AttrBuilder B;
+
+ B.addAttribute(A, V);
+ AttributeSet Set = AttributeSet::get(Func->getContext(), Idx, B);
+ Func->addAttributes(Idx, Set);
+}
+
void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
Function *Func = unwrap<Function>(Fn);
const AttributeSet PAL = Func->getAttributes();
OpenPOWER on IntegriCloud