@@ -563,12 +563,29 @@ public:
563
563
}
564
564
565
565
/**
566
- Builds a Struct GEP instruction
566
+ Builds a GEP instruction
567
567
568
568
I don't know what this does yet.
569
569
*/
570
- Value BuildStructGEP (Type type, Value addr, uint idx, string name = " " ) {
571
- return new Value(LLVMBuildStructGEP2(ptr, type.ptr, addr.ptr, idx, name.toStringz));
570
+ Value BuildGEP (Value addr, Value[] indices, string name = " " ) {
571
+ // Convert D Value to LLVM native types
572
+ LLVMValueRef[] refs = new LLVMValueRef[indices.length];
573
+ foreach (i, item; indices) refs[i] = item.ptr;
574
+
575
+ return new Value(LLVMBuildGEP(ptr, addr.ptr, refs.ptr, cast (uint )refs.length, name.toStringz));
576
+ }
577
+
578
+ /**
579
+ Builds a GEP instruction
580
+
581
+ I don't know what this does yet.
582
+ */
583
+ Value BuildInboundsGEP (Value addr, Value[] indices, string name = " " ) {
584
+ // Convert D Value to LLVM native types
585
+ LLVMValueRef[] refs = new LLVMValueRef[indices.length];
586
+ foreach (i, item; indices) refs[i] = item.ptr;
587
+
588
+ return new Value(LLVMBuildInBoundsGEP(ptr, addr.ptr, refs.ptr, cast (uint )refs.length, name.toStringz));
572
589
}
573
590
574
591
/**
0 commit comments