I am trying to create an LLVM value of a structure type. I use the LLVM-C interface and find the function:
LLVMValueRef LLVMConstStruct (LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
This works fine if all members are a constant value created by LLVMConstXXX (), it generates code, for example:
store { i32, i32, i32 } { i32 1, i32 2, i32 3 }, { i32, i32, i32 }* %17, align 4
But the problem is that the member is not a 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 LLVM code snippet to NVVM (back-back-back-back-back-back file), it says:
module 0 (27, 39): parsing error: invalid use of the local-function name
So, I do not know if this construction of the structure value is correct. I need a value, not a dedicated memory.
Does anyone have an idea?
Regards, Xiang.