Skip to content

Instantly share code, notes, and snippets.

@GiorgioRegni
Created September 9, 2010 10:15
Show Gist options
  • Save GiorgioRegni/571686 to your computer and use it in GitHub Desktop.
Save GiorgioRegni/571686 to your computer and use it in GitHub Desktop.
; LOOP for(t=0; t<max, t++)
store i32 0, i32* %t.addr
br label %loop_over_t
loop_over_t:
%t = load i32* %t.addr ; %t contains the loop counter current value
; ... DO SOME WORK ...
; increment t and loop
%t_plus_1 = add i32 1, %t
store i32 %t_plus_1, i32* %t.addr
%cond_max_loop_reached = icmp eq i32 %tp1, %max ; (t<max ?)
br i1 %cond_max_loop_reached, label %max_reached, label %setup_next_loop ; loop if t < max
max_reached:
; LOOP IS OVER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment