Created
July 12, 2016 21:28
-
-
Save sklam/3f5426e007f22588d66becc789c39728 to your computer and use it in GitHub Desktop.
pyir_in_tuple.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
s_expr = ('bundle', | |
('constants', | |
('$array_of_int32_type', | |
('python-type', '&array_of_int32TypeObject'))), | |
('func', | |
('signature', ('param', '$array_of_int32_type', '$a'), ('result', 'int32')), | |
('local', '$total', 'i32'), | |
('local', '$i', 'i64'), # question: are these zero-initialized or undefined? | |
('set_local', '$total', ('i32.const', 0)), | |
('set_local', '$i', ('i32.const', 0)), | |
('loop', '$done', '$loop', | |
('if', | |
('i64.ge', ('get_local', '$i'), ('i64.load', '$a', 24)), | |
('br', '$done'), | |
('block', | |
('set_local', | |
'$total', | |
('i32.add', | |
('get_local' '$total'), | |
('i32.load', | |
('i64.add', | |
('i64.load', '$a', 16), | |
('i64.mul', ('i64.const', 4), (('get_local', '$i')))), | |
0))), | |
('set_local', '$i', ('i64.add', ('get_local', '$i'), ('i64.const', 1))))), | |
('br', '$loop')), | |
('get_local', '$total')), | |
) | |
pprint(s_expr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment