]> matita.cs.unibo.it Git - pkg-cerco/acc.git/blob - src/RTL/RTLToERTL.mli
Imported Upstream version 0.2
[pkg-cerco/acc.git] / src / RTL / RTLToERTL.mli
1
2 (** This module provides a translation of [RTL] programs to [ERTL] programs. *)
3
4 (** The work consists in expliciting the calling convention.
5
6     Function call instructions will be expanded so has to explicitely pass
7     arguments on dedicated physical registers, and then on specific places in
8     the stack if there are not enough registers.
9
10     We add a prologue at the beginning of each function that does the following
11     things:
12     - Allocate enough space on the stack for the function to execute.
13     - Save the return address.
14     - Save callee-saved registers.
15     - Fetch parameters from physical registers and potentially from the stack.
16
17     Also, we add an epilogue which pretty much reverses the effects of the
18     prologue:
19     - Save the return value in physical registers that can only be used for
20       this.
21     - Restore callee-saved register.
22     - Restore the return address.
23     - Free the allocated space on the stack.
24     - Assign the return value to the physical return registers. *)
25
26 val translate : RTL.program -> ERTL.program