forked from M-Labs/nac3
fixed M-Labs/nac3#146
This commit is contained in:
parent
521f136f2e
commit
1bd966965e
|
@ -488,7 +488,6 @@ pub fn allocate_list<'ctx, 'a, G: CodeGenerator>(
|
|||
let ptr_to_arr =
|
||||
ctx.builder.build_in_bounds_gep(arr_str_ptr, &[zero, i32_t.const_zero()], "ptr_to_arr");
|
||||
ctx.builder.build_store(ptr_to_arr, arr_ptr);
|
||||
println!("arr_str_ptr: {:?}", arr_str_ptr);
|
||||
arr_str_ptr
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ pub fn gen_store_target<'ctx, 'a, G: CodeGenerator>(
|
|||
.into_int_value();
|
||||
unsafe {
|
||||
let arr_ptr = ctx
|
||||
.build_gep_and_load(v, &[i32_type.const_zero(), i32_type.const_int(1, false)])
|
||||
.build_gep_and_load(v, &[i32_type.const_zero(), i32_type.const_zero()])
|
||||
.into_pointer_value();
|
||||
ctx.builder.build_gep(arr_ptr, &[index], "loadarrgep")
|
||||
}
|
||||
|
@ -168,7 +168,6 @@ pub fn gen_for<'ctx, 'a, G: CodeGenerator>(
|
|||
);
|
||||
ctx.builder.position_at_end(body_bb);
|
||||
} else {
|
||||
println!("{:?}", iter_val);
|
||||
let counter = generator.gen_var_alloc(ctx, size_t.into());
|
||||
// counter = -1
|
||||
ctx.builder.build_store(counter, size_t.const_int(u64::max_value(), true));
|
||||
|
|
|
@ -589,7 +589,12 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
|
|||
} else {
|
||||
let int32 = ctx.ctx.i32_type();
|
||||
let zero = int32.const_zero();
|
||||
Some(ctx.build_gep_and_load(arg.into_pointer_value(), &[zero, zero]))
|
||||
let len = ctx.build_gep_and_load(arg.into_pointer_value(), &[zero, int32.const_int(1, false)]).into_int_value();
|
||||
if len.get_type().get_bit_width() != 32 {
|
||||
Some(ctx.builder.build_int_truncate(len, int32, "len2i32").into())
|
||||
} else {
|
||||
Some(len.into())
|
||||
}
|
||||
}
|
||||
},
|
||||
)))),
|
||||
|
|
Loading…
Reference in New Issue