SHARE
TWEET

Untitled

a guest Dec 17th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     let list_slice_ty m typ =
  2.        ... load src list, list_slice(i,j) ...
  3.        (* init loop counter *)
  4.        let loop_cnt_ptr = L.build_alloca i32_t "loop_cnt" build in
  5.        let _ = L.build_store (L.const_int i32_t 0) loop_cnt_ptr build in
  6.  
  7.        (* define upper bound of loop *)
  8.        let loop_upper_bound = L.build_sub (L.param def 1) (L.param def 0) "loop_upper_bound" build in
  9.  
  10.        (* loop condition: cntr <= (j-i) *)
  11.        let loop_cond = L.build_icmp L.Icmp.Sle loop_cnt_ptr loop_upper_bound "cond" build in
  12.  
  13.        (* loop iteration: cntr = cntr + 1 *)
  14.        let loop_itr = L.build_add loop_cnt_ptr (L.const_int i32_t 1) "loop_itr" build in
  15.  
  16.        (* loop body: assignment *)
  17.        let loop_body = (* assign b[loop_cnt] = a[loop_cnt + i] *) in
  18.  
  19.        construct_for_loop;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top