Skip to content

Commit 6230a4e

Browse files
authored
Merge pull request #8 from xushiwei/q
CreateGEP/CreateInBoundsGEP
2 parents 6233231 + 4615c39 commit 6230a4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

z_llvmext.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ func CreateAlloca(b Builder, t Type) (v Value) {
6666
return
6767
}
6868

69+
func CreateGEP(b Builder, t Type, p Value, indices []Value) (v Value) {
70+
ptr, nvals := llvmValueRefs(indices)
71+
v.C = C.LLVMBuildGEP2(b.C, t.C, p.C, ptr, nvals, &emptyCStr[0])
72+
return
73+
}
74+
75+
func CreateInBoundsGEP(b Builder, t Type, p Value, indices []Value) (v Value) {
76+
ptr, nvals := llvmValueRefs(indices)
77+
v.C = C.LLVMBuildInBoundsGEP2(b.C, t.C, p.C, ptr, nvals, &emptyCStr[0])
78+
return
79+
}
80+
6981
func CreateStructGEP(b Builder, t Type, p Value, i int) (v Value) {
7082
v.C = C.LLVMBuildStructGEP2(b.C, t.C, p.C, C.unsigned(i), &emptyCStr[0])
7183
return

0 commit comments

Comments
 (0)