C API: Add LLVMAddTargetDependentFunctionAttr()

llvm-svn: 179645
This commit is contained in:
Tom Stellard 2013-04-16 23:12:43 +00:00
parent 024e24d7f3
commit 18edd84b8a
2 changed files with 18 additions and 0 deletions

View File

@ -1705,6 +1705,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.
*

View File

@ -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();