Skip to content

Commit

Permalink
Example used for register allocation article
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarh committed Nov 5, 2013
1 parent e74d92d commit 79fda57
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/testreg.rb
@@ -0,0 +1,27 @@

def foo
%s(let (a b c foobar)
(assign foobar 5)
(assign a 2)
(assign b 5)
(assign c 10)
(assign a (add a b))
(assign a (add a c))
(assign a (mul a 2))
(printf "a = %d\n" a)
(printf "b = %d\n" b)
(printf "c = %d\n" c)
(assign a (add a 1))
(printf "a = %d\n" a)
(printf "b = %d\n" b)
(printf "c = %d\n" c)
)
end

foo

0 comments on commit 79fda57

Please sign in to comment.