Chapter 8: Intermediate Code Generation

Generate code for a < b or c < d and e < f

Using the rules given in the previous two slides, we finally get the values of E.t and E.f by bottom up evaluation of the tree.

from E => E1 or M E 2

{ backpatch(E 1 .falselist, M.quad); ...}

=>

{ backpatch({101}, 102); ...}

gives 101: goto 102

from E => E1 and M E 2

{ backpatch(E 1 .truelist, M.quad); ...}

=>

{ backpatch({102}, 104); ...} gives

102: if c < d goto 104

Note that:

. the entire expression is true if the gotos of statements 100 or 104 are reached,

. the entire expression is false if the gotos of statements 103 or 105 are reached, and

. these targets will be filled in later when the action depending on the true/false is known.