From e2435da8abe5ca62c7f08f29c242b6b98e0ec7af Mon Sep 17 00:00:00 2001 From: Gordon Henriksen Date: Mon, 28 Apr 2008 17:37:06 +0000 Subject: 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 --- include/llvm-c/Core.h | 22 ++++++++++++++++++++++ include/llvm/Argument.h | 7 +++++++ 2 files changed, 29 insertions(+) (limited to 'include') diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index b536bf5..d1251dc 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -83,6 +83,20 @@ typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef; typedef struct LLVMOpaquePassManager *LLVMPassManagerRef; typedef enum { + LLVMZExtParamAttr = 1<<0, + LLVMSExtParamAttr = 1<<1, + LLVMNoReturnParamAttr = 1<<2, + LLVMNoUnwindParamAttr = 1<<3, + LLVMInRegParamAttr = 1<<4, + LLVMNoAliasParamAttr = 1<<5, + LLVMStructRetParamAttr = 1<<6, + LLVMByValParamAttr = 1<<7, + LLVMNestParamAttr = 1<<8, + LLVMReadNoneParamAttr = 1<<9, + LLVMReadOnlyParamAttr = 1<<10 +} LLVMParamAttr; + +typedef enum { LLVMVoidTypeKind, /**< type with no size */ LLVMFloatTypeKind, /**< 32 bit floating point type */ LLVMDoubleTypeKind, /**< 64 bit floating point type */ @@ -413,6 +427,9 @@ LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn); LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn); LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg); LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg); +void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA); +void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA); +void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align); /* Operations on basic blocks */ LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB); @@ -441,6 +458,11 @@ LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst); /* Operations on call sites */ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC); unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr); +void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index, LLVMParamAttr); +void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index, + LLVMParamAttr); +void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, + unsigned align); /* Operations on phi nodes */ void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h index 23d1a08..d203a93 100644 --- a/include/llvm/Argument.h +++ b/include/llvm/Argument.h @@ -15,6 +15,7 @@ #define LLVM_ARGUMENT_H #include "llvm/Value.h" +#include "llvm/ParameterAttributes.h" namespace llvm { @@ -60,7 +61,13 @@ public: /// hasSRetAttr - Return true if this argument has the sret attribute on it in /// its containing function. bool hasStructRetAttr() const; + + /// addAttr - Add a ParamAttr to an argument + void addAttr(ParameterAttributes); + /// removeAttr - Remove a ParamAttr from an argument + void removeAttr(ParameterAttributes); + virtual void print(std::ostream &OS) const; void print(std::ostream *OS) const { if (OS) print(*OS); -- cgit v1.1