[cfe-commits] [PATCH] [llvm+clang] memset for non-8-bit bytes

Chris Lattner clattner at apple.com
Thu Oct 18 15:03:24 PDT 2012


On Oct 18, 2012, at 6:11 AM, Patrik Hägglund H <patrik.h.hagglund at ericsson.com> wrote:

> We have a back-end with 16-bit bytes, and have changed the memset
> intrinsics to be able to work on arbitrary word sizes, just as memcpy.

Hi Patrik,

This is interesting.  Please start a thread on llvmdev about this functionality, and outline what other intrinsics will have to change to add non-8-bit byte support.  This isn't the sort of feature that we just add without understanding the full impact.

Also, to actually roll this out, you'll need to add lib/VMCore/AutoUpgrade.cpp support for this change, because we need to be able to read old .bc and .ll files that use the previous form of the intrinsic.

-Chris

> 
> This patch updates the type of the second parameter of memset in
> Intrinsics.td, from llvm_i8_ty, to llvm_anyint_ty:
> 
> def int_memset  : Intrinsic<[],
> -                            [llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
> +                            [llvm_anyptr_ty, llvm_anyint_ty, llvm_anyint_ty,
>                              llvm_i32_ty, llvm_i1_ty],
> 
> IRBuilder.cpp and LangRef.html is updated accordingly.
> 
> To use the intrinsic, the declaration,
> 
>  declare void @llvm.memset.p0i8.i32(i8* <dest>, i8 <val>,
>                                     i32 <len>, i32 <align>, i1 <isvolatile>)
> 
> now becomes
> 
>  declare void @llvm.memset.p0i8.i8.i32(i8* <dest>, i8 <val>,
>                                        i32 <len>, i32 <align>, i1 <isvolatile>)
> 
> The bulk of this patch consists of such changes (mainly in tests).
> 
> Some tests in clang has to be updated, as shown by the second patch file.
> 
> /Patrik Hägglund  
> <0002-clang-Change-memset-in-Intrinsics.td-to-take-anyint.patch><0001-llvm-Change-memset-in-Intrinsics.td-to-take-anyint.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list