I'm following the Essentials of Compilation book together with this code for the exercises. I find the ordering of subq argument is giving me surprising result, I feel I must be making a silly mistake somewhere, yet I cannot figure out where.. so here I am :)
Hello,
I'm following the Essentials of Compilation book together with this code for the exercises. I find the ordering of
subq
argument is giving me surprising result, I feel I must be making a silly mistake somewhere, yet I cannot figure out where.. so here I am :)here is my example
X86Program
:which essentially is
However, both
interp-pseudo-x86-0
andinterp-x86-0
gives me 10 instead of -10. If I swap the arguments tosubq
then I do get -10 back.From reading both the x86 instruction quick reference from the book:
subq A, B
map toB - A -> B
And in code:
it seems they are consistent with my understanding of the ordering of arguments. What am I doing wrong?