Contents    Page-10    Prev    Next    Page+10    Index   

IF Statement Optimization

Special cases of IF statements are common; these can be compiled as shown below, where jmp c represents a jump on condition and jmp -c represents a jump on the opposite of a condition.


(if c (goto l))            jmp c   l

(if c (progn) (goto l))    jmp -c  l

(if c p1 (goto l))         jmp -c  l
                           p1

(if c (goto l) p2)         jmp c   l
                           p2

(if c p1)                  jmp -c  L1
                           p1
                       L1:

(if c (progn) p2)          jmp c   L1
                           p2
                       L1: