BINOP
from p. 167 (also in assignment 4 code); key operations:
public class BINOP extends Exp { ... public ExpList kids() { return new ExpList(left, new ExpList(right, null)); } public Exp build(ExpList kids) { return new BINOP(binop, kids.head, kids.tail.head); } }
MOVE
(p. 168):
public ExpList kids() { if (dst instanceof MEM) return new ExpList(((MEM) dst).exp, new ExpList(src, null)); else return new ExpList(src, null); } public Stm build(ExpList kids) { if (dst instanceof MEM) return new MOVE(new MEM(kids.head), kids.tail.head); else return new MOVE(dst, kids.head); }
CALL(fun, args) → ESEQ(MOVE(TEMP t, CALL(fun, args)), TEMP t)
CJUMP(cond, a, b, t, f') label f' jump f
LABEL(NAME(test)) CJUMP(>, i, N, done, body) label(body) loop body statements JUMP(NAME(test)) LABEL(done)or
JUMP(NAME(test)) LABEL(body) loop body statements LABEL(test) CJUMP(<=, i, N, body, done) LABEL(done)