[llvm] r179645 - C API: Add LLVMAddTargetDependentFunctionAttr()
Tom Stellard
thomas.stellard at amd.com
Tue Apr 16 16:12:43 PDT 2013
Author: tstellar
Date: Tue Apr 16 18:12:43 2013
New Revision: 179645
URL: http://llvm.org/viewvc/llvm-project?rev=179645&view=rev
Log:
C API: Add LLVMAddTargetDependentFunctionAttr()
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=179645&r1=179644&r2=179645&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Tue Apr 16 18:12:43 2013
@@ -1706,6 +1706,13 @@ void LLVMSetGC(LLVMValueRef Fn, const ch
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()
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=179645&r1=179644&r2=179645&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Tue Apr 16 18:12:43 2013
@@ -1443,6 +1443,17 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn
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();
More information about the llvm-commits
mailing list