Skip to content

Instantly share code, notes, and snippets.

@stephenroller
Created May 3, 2010 19:02
Show Gist options
  • Save stephenroller/388458 to your computer and use it in GitHub Desktop.
Save stephenroller/388458 to your computer and use it in GitHub Desktop.
@optimization([('LDC', "$A", 2, WILD),
('LD', "$B", 0, SP),
('LDA', SP, 1, SP),
('MUL', "$A", "$B", "$A")])
def times_two(nodes, A, B):
nodes[0].remove()
nodes[1].inst5 = ('LD', A, 0, SP, 'get A off of stack')
nodes[3].inst5 = ('ADD', A, A, A, 'A * 2')
@stephenroller
Copy link
Author

My lisp envy got the best of me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment