aboutsummaryrefslogtreecommitdiffstats
path: root/scheduling/RTLtoBTL.v
blob: 2b2bd15c5bd775daf61e90a31a4c8535e300cce2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Require Import Coqlib Maps.
Require Import AST Integers Values Events Memory Globalenvs Smallstep.
Require Import RTL Op Registers OptionMonad BTL.

Require Import Errors Linking.

(** External oracle *)
Parameter rtl2btl: RTL.function -> BTL.code * node * (PTree.t node).

Local Open Scope error_monad_scope.

Definition transf_function (f: RTL.function) : res BTL.function :=
  let (tcte, dupmap) := rtl2btl f in
  let (tc, te) := tcte in
  (* TODO, pour finir la preuve: remplacer ci-dessous "right_assoc_code" par "expand_code" 
     on s'arrangera pour éliminer cette transformation "coûteuse" à la fin !
  *)
  let f' := BTL.mkfunction (RTL.fn_sig f) (RTL.fn_params f) (RTL.fn_stacksize f) (right_assoc_code tc) te in
  do u <- verify_function dupmap f' f;
  OK f'.

Definition transf_fundef (f: RTL.fundef) : res fundef :=
  transf_partial_fundef transf_function f.

Definition transf_program (p: RTL.program) : res program :=
  transform_partial_program transf_fundef p.