Displaying 4 results from an estimated 4 matches for "objsz".
Did you mean:
objs
2013 Jan 15
2
[LLVMdev] Having trouble with GEP
I'm running up against an error with this IR:
%array$str = type { i64, [0 x %str] }
%array.raw = call i8* @malloc(i64 %objsz)
%array = bitcast i8* %array.raw to %array$str*
%array.data = getelementptr %array$str* %array, i32 0, i32 1
This is kind of hand-written, but it errors out, like this:
print-var.ll:50:30: error: invalid getelementptr indices
%array.data = getelementptr %array$str* %array, i32 0, i32 1...
2013 Jan 16
0
[LLVMdev] Having trouble with GEP
...d (presumably because
LLVM doesn't know its alignment requirements so can't lay out the
array$str type properly). For example, the following complete program
works correctly for me:
%str = type {i8*, i64}
%array$str = type { i64, [0 x %str] }
declare i8* @malloc(i64)
define i64 @foo(i64 %objsz) {
%array.raw = call i8* @malloc(i64 %objsz)
%array = bitcast i8* %array.raw to %array$str*
%array.data = getelementptr %array$str* %array, i32 0, i32 1
%ret = ptrtoint [0 x %str]* %array.data to i64
ret i64 %ret
}
But it fails if the first line is commented out. Could you give a
similar...
2013 Jan 16
2
[LLVMdev] Having trouble with GEP
...w its alignment requirements so can't lay out the
> array$str type properly). For example, the following complete program
> works correctly for me:
>
> %str = type {i8*, i64}
> %array$str = type { i64, [0 x %str] }
>
> declare i8* @malloc(i64)
>
> define i64 @foo(i64 %objsz) {
> %array.raw = call i8* @malloc(i64 %objsz)
> %array = bitcast i8* %array.raw to %array$str*
> %array.data = getelementptr %array$str* %array, i32 0, i32 1
> %ret = ptrtoint [0 x %str]* %array.data to i64
> ret i64 %ret
> }
>
> But it fails if the first line is...
2013 Jan 16
0
[LLVMdev] Having trouble with GEP
> Yes:
>
> %array$str = type { i64, [0 x %str] }
>
> declare i8* @malloc(i64)
>
> define i64 @foo(i64 %objsz) {
> %array.raw = call i8* @malloc(i64 %objsz);
> %array = bitcast i8* %array.raw to %array$str*
> %array.data = getelementptr %array$str* %array, i32 0, i32 1
> %ret = ptrtoint [0 x %str]* %array.data to i64
> ret i64 %ret
> }
>
> %str = type {i8*, i64}...