Page:AITR-474.djvu/52

From Wikisource
Jump to navigation Jump to search
This page needs to be proofread.

42

main:   <code for a> 
        LOAD reg2,[name2]
        CALL-FUNCTION 2,[name1] 
name1:  CALL-FUNCTION 0,reg2 
name2:  <code for b>
        LOAD reg2,[name4]
        CALL-FUNCTION 2.[name3]
name3:  CALL-FUNCTION 0,reg2
name4:  <code for c> 
        RETURN

Turning general function calls into direct GO's, on the basis of analysts of what variables must refer to constant functions:

main:   <code for a> 
        LOAD reg2,[name2] 
        GOTO name1 

name1:  GOTO name2 

name2:  <code for b> 
        LOAD reg2,[name4] 
        GOTO name1 

name3:  GOTO name4 

name4:  <code for c> 
        RETURN

Eliminating useless GOTO and LOAD instructions:

main:  <code for a> 
name1:  
name2: <code for b> 
name3: 
name4: <code for c> 
       RETURN

What more could one ask for?

Notice that this has fallen out of a general strategy involving only an approach to compiling function calls, and has involved no special knowledge of OR