diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-04-28 17:37:06 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-04-28 17:37:06 +0000 |
commit | e2435da8abe5ca62c7f08f29c242b6b98e0ec7af (patch) | |
tree | 66e5cc5aa713285dde8e0d76592f695810cd847a /lib/VMCore/Core.cpp | |
parent | 1f13c686df75ddbbe15b208606ece4846d7479a8 (diff) | |
download | external_llvm-e2435da8abe5ca62c7f08f29c242b6b98e0ec7af.zip external_llvm-e2435da8abe5ca62c7f08f29c242b6b98e0ec7af.tar.gz external_llvm-e2435da8abe5ca62c7f08f29c242b6b98e0ec7af.tar.bz2 |
Expose parameter attributes via C bindings.
Patch by Anders Johnsen!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Core.cpp')
-rw-r--r-- | lib/VMCore/Core.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index ad72095..a07464f 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -20,6 +20,7 @@ #include "llvm/TypeSymbolTable.h" #include "llvm/ModuleProvider.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/CallSite.h" #include <cassert> #include <cstdlib> #include <cstring> @@ -798,6 +799,19 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) { return wrap(--I); } +void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) { + unwrap<Argument>(Arg)->addAttr(PA); +} + +void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) { + unwrap<Argument>(Arg)->removeAttr(PA); +} + +void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) { + unwrap<Argument>(Arg)->addAttr( + ParamAttr::constructAlignmentFromInt(align)); +} + /*--.. Operations on basic blocks ..........................................--*/ LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB) { @@ -936,6 +950,28 @@ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) { assert(0 && "LLVMSetInstructionCallConv applies only to call and invoke!"); } +void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index, + LLVMParamAttr PA) { + CallSite Call = CallSite(unwrap<Instruction>(Instr)); + Call.setParamAttrs( + Call.getParamAttrs().addAttr(index, PA)); +} + +void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index, + LLVMParamAttr PA) { + CallSite Call = CallSite(unwrap<Instruction>(Instr)); + Call.setParamAttrs( + Call.getParamAttrs().removeAttr(index, PA)); +} + +void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, + unsigned align) { + CallSite Call = CallSite(unwrap<Instruction>(Instr)); + Call.setParamAttrs( + Call.getParamAttrs().addAttr(index, + ParamAttr::constructAlignmentFromInt(align))); +} + /*--.. Operations on phi nodes .............................................--*/ void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, |