57 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| .bp
 | |
| .NH
 | |
| The Intermediate Code and the IC phase
 | |
| .PP
 | |
| In this chapter the intermediate code of the EM global optimizer
 | |
| will be defined.
 | |
| The 'Intermediate Code construction' phase (IC),
 | |
| which builds the initial intermediate code from
 | |
| EM Compact Assembly Language,
 | |
| will be described.
 | |
| .NH 2
 | |
| Introduction
 | |
| .PP
 | |
| The EM global optimizer is a multi pass program,
 | |
| hence there is a need for an intermediate code.
 | |
| Usually, programs in the Amsterdam Compiler Kit use the
 | |
| Compact Assembly Language format
 | |
| .[~[
 | |
| keizer architecture
 | |
| .], section 11.2]
 | |
| for this purpose.
 | |
| Although this code has some convenient features,
 | |
| such as being compact,
 | |
| it is quite unsuitable in our case,
 | |
| because of a number of reasons.
 | |
| At first, the code lacks global information
 | |
| about whole procedures or whole basic blocks.
 | |
| Second, it uses identifiers ('names') to bind
 | |
| defining and applied occurrences of
 | |
| procedures, data labels and instruction labels.
 | |
| Although this is usual in high level programming
 | |
| languages, it is awkward in an intermediate code
 | |
| that must be read many times.
 | |
| Each pass of the optimizer would have
 | |
| to incorporate an identifier look-up mechanism
 | |
| to associate a defining occurrence with each
 | |
| applied occurrence of an identifier.
 | |
| Finally, EM programs are used to declare blocks of bytes,
 | |
| rather than variables. A 'hol 6' instruction may be used to
 | |
| declare three 2-byte variables.
 | |
| Clearly, the optimizer wants to deal with variables, and
 | |
| not with rows of bytes.
 | |
| .PP
 | |
| To overcome these problems, we have developed a new
 | |
| intermediate code.
 | |
| This code does not merely consist of the EM instructions,
 | |
| but also contains global information in the
 | |
| form of tables and graphs.
 | |
| Before describing the intermediate code we will
 | |
| first leap aside to outline
 | |
| the problems one generally encounters
 | |
| when trying to store complex data structures such as
 | |
| graphs outside the program, i.e. in a file.
 | |
| We trust this will enhance the
 | |
| comprehensibility of the
 | |
| intermediate code definition and the design and implementation
 | |
| of the IC phase.
 |