[llvm-commits] Patch to add set/get of AllocaInst alignment to the C bindings

Benjamin Kramer benny.kra at gmail.com
Mon Oct 1 10:18:11 PDT 2012


On 30.09.2012, at 21:45, Antony Hosking <hosking at cs.purdue.edu> wrote:

> Please accept this patch to allow C binding access to the SetAlignment and GetAlignment methods for AllocaInst.


> Index: include/llvm-c/Core.h
> ===================================================================
> --- include/llvm-c/Core.h	(revision 164918)
> +++ include/llvm-c/Core.h	(working copy)
> @@ -2431,6 +2431,9 @@
>  LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
>  void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
>  
> +unsigned LLVMGetAllocaAlignment(LLVMValueRef Alloca);
> +void LLVMSetAllocaAlignment(LLVMValueRef Alloca, unsigned Bytes);
> +
>  /* Casts */
>  LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val,
>                              LLVMTypeRef DestTy, const char *Name);
> Index: lib/VMCore/Core.cpp
> ===================================================================
> --- lib/VMCore/Core.cpp	(revision 164918)
> +++ lib/VMCore/Core.cpp	(working copy)
> @@ -2112,6 +2112,14 @@
>    return cast<StoreInst>(P)->setVolatile(isVolatile);
>  }
>  
> +unsigned LLVMGetAllocaAlignment(LLVMValueRef Alloca) {
> +  return unwrap<AllocaInst>(Alloca)->getAlignment();
> +}
> +
> +void SetAllocaAlignment(LLVMValueRef Alloca, unsigned Bytes) {
> +  unwrap<AllocaInst>(Alloca)->setAlignment(Bytes);
> +}

Declaration doesn't match the prototype in Core.h, making it impossible to call.

- Ben

> +
>  /*--.. Casts ...............................................................--*/
>  
>  LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val,




More information about the llvm-commits mailing list