memcpy函数:
The ‘llvm.memcpy.*’ intrinsics copy a block of memory from the source location to the destination location.
从源src所指的内存地址的起始位置开始拷贝N个字节到目标dst所指的内存地址的起始位置中。
Note that, unlike the standard libc function, the llvm.memcpy.* intrinsics do not return a value, takes extra isvolatile arguments and the pointers can be in specified address spaces.
The ‘llvm.memcpy.*’ 与c程序中memcpy不同之处在于不返回value。
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* <dest>, i8* <src>,
i32 <len>, i1 <isvolatile>)
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* <dest>, i8* <src>,
i64 <len>, i1 <isvolatile>)
参数:
The first argument is a pointer to the destination, the second is a pointer to the source. The third argument is an integer argument specifying the number of bytes to copy, and the fourth is a boolean indicating a volatile access.
第一个参数是指向目标destination的指针,
第二个参数是指向源source的指针。
第三个参数是一个整数参数(length),指定要复制的字节数,
第四个参数是一个表示易失性访问的布尔值。
The align parameter attribute can be provided for the first and second arguments.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast (%struct.str* @main.global to i8*), i64 28, i32 8, i1 false) #3
该instruction中的i32 8 就是align,为第一个和第二个参数提供align参数属性。
If the isvolatile parameter is true, the llvm.memcpy call is a volatile operation. The detailed access behavior is not very cleanly specified and it is unwise to depend on it.
如果isvolatile参数为true,则llvm.memcpy调用是volatile操作。 详细的访问行为没有非常清晰地指定,依赖它是不明智的。