aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c/PostpassScheduling.v
blob: 8ec72f900e03cfce2e2c4ad6836e7a6d6869b81f (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
27
28
29
30
31
32
33
34
35
36
37
38
(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)

Require Import Asmblock.

(** Oracle taking as input a basic block,
    returns a basic block with its instruction reordered *)
Axiom schedule: bblock -> bblock.

(** Oracle taking as input a basic block
    splits it into several bblocks (representing bundles *)
Axiom split: bblock -> list bblock.

(* TODO - separate the postpass_schedule in two phases *)

Definition postpass_schedule (lb : list bblock) : list bblock :=
  match lb with
  | nil => nil
  | (cons b lb) => split (schedule b) ++ lb
  end.

Definition transf_function (f: function) : function :=
  mkfunction (fn_sig f) (postpass_schedule (fn_blocks f)).

Definition transf_fundef (f: fundef) : fundef :=
  AST.transf_fundef transf_function f.

Definition transf_program (p: program) : program :=
  AST.transform_program transf_fundef p.