Pristine Ack-5.5
[Ack-5.5.git] / doc / ego / ic / ic1
1 .bp
2 .NH
3 The Intermediate Code and the IC phase
4 .PP
5 In this chapter the intermediate code of the EM global optimizer
6 will be defined.
7 The 'Intermediate Code construction' phase (IC),
8 which builds the initial intermediate code from
9 EM Compact Assembly Language,
10 will be described.
11 .NH 2
12 Introduction
13 .PP
14 The EM global optimizer is a multi pass program,
15 hence there is a need for an intermediate code.
16 Usually, programs in the Amsterdam Compiler Kit use the
17 Compact Assembly Language format
18 .[~[
19 keizer architecture
20 .], section 11.2]
21 for this purpose.
22 Although this code has some convenient features,
23 such as being compact,
24 it is quite unsuitable in our case,
25 because of a number of reasons.
26 At first, the code lacks global information
27 about whole procedures or whole basic blocks.
28 Second, it uses identifiers ('names') to bind
29 defining and applied occurrences of
30 procedures, data labels and instruction labels.
31 Although this is usual in high level programming
32 languages, it is awkward in an intermediate code
33 that must be read many times.
34 Each pass of the optimizer would have
35 to incorporate an identifier look-up mechanism
36 to associate a defining occurrence with each
37 applied occurrence of an identifier.
38 Finally, EM programs are used to declare blocks of bytes,
39 rather than variables. A 'hol 6' instruction may be used to
40 declare three 2-byte variables.
41 Clearly, the optimizer wants to deal with variables, and
42 not with rows of bytes.
43 .PP
44 To overcome these problems, we have developed a new
45 intermediate code.
46 This code does not merely consist of the EM instructions,
47 but also contains global information in the
48 form of tables and graphs.
49 Before describing the intermediate code we will
50 first leap aside to outline
51 the problems one generally encounters
52 when trying to store complex data structures such as
53 graphs outside the program, i.e. in a file.
54 We trust this will enhance the
55 comprehensibility of the
56 intermediate code definition and the design and implementation
57 of the IC phase.