It then assembles the arguments 1 and the value of n into argl . Then it tests whether proc contains a primitive or a compound procedure, and dispatches to a primitive branch or a compound branch accordingly. Both branches resume at the after-call label. The requirements to preserve registers around the evaluation of the operator and operands don't result in any saving of registers, because in this case those evaluations don't modify the registers in question. Each of these calls sets up proc and argl and its own primitive and compound branches.
Figure shows the complete compilation of the definition of the factorial procedure.
Notice that the possible save and restore of continue and env around the predicate, shown above, are in fact generated, because these registers are modified by the procedure call in the predicate and needed for the procedure call and the return linkage in the branches. Compile this procedure and compare the resulting code with that produced for factorial . Explain any differences you find. Modify the compiler so that it produces some other order of evaluation. One way to understand the compiler's preserving mechanism for optimizing stack usage is to see what extra operations would be generated if we did not use this idea.