a guest Dec 17th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- let list_slice_ty m typ =
- ... load src list, list_slice(i,j) ...
- (* init loop counter *)
- let loop_cnt_ptr = L.build_alloca i32_t "loop_cnt" build in
- let _ = L.build_store (L.const_int i32_t 0) loop_cnt_ptr build in
- (* define upper bound of loop *)
- let loop_upper_bound = L.build_sub (L.param def 1) (L.param def 0) "loop_upper_bound" build in
- (* loop condition: cntr <= (j-i) *)
- let loop_cond = L.build_icmp L.Icmp.Sle loop_cnt_ptr loop_upper_bound "cond" build in
- (* loop iteration: cntr = cntr + 1 *)
- let loop_itr = L.build_add loop_cnt_ptr (L.const_int i32_t 1) "loop_itr" build in
- (* loop body: assignment *)
- let loop_body = (* assign b[loop_cnt] = a[loop_cnt + i] *) in
RAW Paste Data