Skip to content
Snippets Groups Projects
Commit d4e15b64 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Translate diese and nor into boolred in the Inline module.

parent 9cb4aa09
No related branches found
No related tags found
No related merge requests found
(** Time-stamp: <modified the 28/11/2008 (at 10:28) by Erwan Jahier> *)
(** Time-stamp: <modified the 28/11/2008 (at 15:51) by Erwan Jahier> *)
open Lxm
......@@ -208,6 +208,38 @@ let rec (inline_eq: Eff.local_env ->
in
(List.rev_append neqs eqs, List.append acc_vars locs)
| CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.DIESE_n,_)}, OperEff args) ->
(* a diese is a particular kind of boolred:
#(A,...,an) = boolred(1,1,n)([a1,...,an])
*)
let n = List.length args in
let sargs = [ConstStaticArgEff(Ident.of_string "i",Int_const_eff 1);
ConstStaticArgEff(Ident.of_string "j",Int_const_eff 1);
ConstStaticArgEff(Ident.of_string "k",Int_const_eff n)
]
in
let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in
let arg = CallByPosEff({src=lxm_ve;it=ARRAY args}, OperEff []) in
let rhs = CallByPosEff({src=lxm_ve;it=boolred_op}, OperEff [arg]) in
let eq = { src = lxm_eq ; it = (lhs, rhs) } in
inline_eq node_env id_solver (eqs, locs) eq
| CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.NOR_n,_)}, OperEff args) ->
(* a nor is a particular kind of boolred too:
#(A,...,an) = boolred(0,0,n)([a1,...,an])
*)
let n = List.length args in
let sargs = [ConstStaticArgEff(Ident.of_string "i",Int_const_eff 0);
ConstStaticArgEff(Ident.of_string "j",Int_const_eff 0);
ConstStaticArgEff(Ident.of_string "k",Int_const_eff n)
]
in
let boolred_op = Eff.Predef(Predef.BoolRed,sargs) in
let arg = CallByPosEff({src=lxm_ve;it=ARRAY args}, OperEff []) in
let rhs = CallByPosEff({src=lxm_ve;it=boolred_op}, OperEff [arg]) in
let eq = { src = lxm_eq ; it = (lhs, rhs) } in
inline_eq node_env id_solver (eqs, locs) eq
| CallByPosEff({src=lxm_ve;it=Eff.Predef(Predef.BoolRed,sargs)}, OperEff args) ->
(* Given
- 3 integers i, j, k
......
(** Time-stamp: <modified the 26/11/2008 (at 11:15) by Erwan Jahier> *)
(** Time-stamp: <modified the 28/11/2008 (at 15:17) by Erwan Jahier> *)
open Printf
open Lxm
......@@ -171,12 +171,12 @@ and string_of_type_eff = function
Indeed instead of printing:
node toto(x: int ^ 4) ...
node toto(x: int ^ 4) ...
we want to print something like :
type int4 = int ^ 4;
node toto(x: int4) ...
type int4 = int ^ 4;
node toto(x: int4) ...
That may occur only for array actually.
......
(** Time-stamp: <modified the 27/11/2008 (at 10:16) by Erwan Jahier> *)
(** Time-stamp: <modified the 28/11/2008 (at 15:20) by Erwan Jahier> *)
open Lxm
......@@ -195,7 +195,7 @@ and (split_val_exp : bool -> Eff.local_env -> Eff.val_exp -> Eff.val_exp * split
let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in
rhs, (eql, vl)
| Eff.ARRAY vel ->
| Eff.ARRAY vel ->
let vel, (eql, vl) = split_val_exp_list false node_env vel in
let by_pos_op_eff = Lxm.flagit (Eff.ARRAY(vel)) lxm in
let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in
......@@ -205,7 +205,7 @@ and (split_val_exp : bool -> Eff.local_env -> Eff.val_exp -> Eff.val_exp * split
let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in
rhs, (eql, vl)
in
if top_level || by_pos_op_eff.it = TUPLE then
if top_level || by_pos_op_eff.it = TUPLE then
rhs, (eql, vl)
else
(* create the var for the current call *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment