I'm trying to create an LLVM value of a structure type. I'm using LLVM-C interface and find a function:
LLVMValueRef LLVMConstStruct (LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
This works fine if all members are constant value created by LLVMConstXXX(), it will generate code like:
store { i32, i32, i32 } { i32 1, i32 2, i32 3 }, { i32, i32, i32 }* %17, align 4
But the problem is if the member is not constant, it will generate things like:
%0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
store { i32, i32, i32 } { i32 1, i32 %0, i32 3 }, { i32, i32, i32 }* %17, align 4
And when I send this piece of LLVM code to NVVM (Nvidia PTX backend), it says:
module 0 (27, 39): parse error: invalid use of function-local name
So, I don't know if this struct value creating is a correct. What I need is a value, not an allocated memory.
Anyone has idea?
Regards, Xiang.