Commit f3c606256bb7ca7da8cadb232674498d9fdc324c

Authored by Salvador Abreu
1 parent ec6f4ebc
Exists in master

layout handler for multi-AST-node code gen

Showing 2 changed files with 14 additions and 1 deletions   Show diff stats
fz/paccs/coverage.pl
... ... @@ -2,7 +2,10 @@
2 2  
3 3 % == Code coverage for PaCCS ==================================================
4 4  
5   -% ++ cv_basic(AST, CODE, ST) - - - - - - - - - - - - - - - - - - - - - - - - -
  5 +% -- cv_basic(AST, ST) --------------------------------------------------------
  6 +%
  7 +% AST single-node matches are implemented with the code generated by each
  8 +% DCG rule.
6 9  
7 10 cv_basic(int_lin_ne(COEF, VARS, CONST), _ST) -->
8 11 int_vector(COEF, CC, NN),
... ... @@ -11,6 +14,15 @@ cv_basic(int_lin_ne(COEF, VARS, CONST), _ST) -->
11 14 { name(CC, CCN), name(YY, YYN), name(KK, KKN), name(NN, NNN) },
12 15 "fd_poly_ne_k(", CCN, ", ", YYN, ", ", NNN, ", ", KKN, ");\n".
13 16  
  17 +% -- cv_multi(ASTI, ASTO, ST) -------------------------------------------------
  18 +%
  19 +% AST multiple-node matches. For now this does nothing.
  20 +
  21 +cv_multi(_, _, _ST) --> { !, fail }.
  22 +
  23 +
  24 +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  25 +
14 26 int_vector(val(CC,array(int,1,NN),_,_), CC, NN) --> [].
15 27  
16 28 var_vector(lit(VS, array(int(_LB,_UB))), VA) --> % array of FD variables
... ...
fz/paccs/output.pl
... ... @@ -95,6 +95,7 @@ cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST).
95 95 % emit an instruction which partly covers CI, leaving CO untreated
96 96 % FIXME: still need to search for an optimal solution...
97 97  
  98 +cg_coverage(CI, CO, ST) --> cv_multi(CI, CO, ST), { ! }.
98 99 cg_coverage([constraint(CE, _A)|CS], CS, ST) --> cv_basic(CE, ST).
99 100  
100 101  
... ...