From f3c606256bb7ca7da8cadb232674498d9fdc324c Mon Sep 17 00:00:00 2001 From: Salvador Abreu Date: Tue, 18 Aug 2015 15:49:15 +0900 Subject: [PATCH] layout handler for multi-AST-node code gen --- fz/paccs/coverage.pl | 14 +++++++++++++- fz/paccs/output.pl | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fz/paccs/coverage.pl b/fz/paccs/coverage.pl index 2857fd2..cb353a7 100644 --- a/fz/paccs/coverage.pl +++ b/fz/paccs/coverage.pl @@ -2,7 +2,10 @@ % == Code coverage for PaCCS ================================================== -% ++ cv_basic(AST, CODE, ST) - - - - - - - - - - - - - - - - - - - - - - - - - +% -- cv_basic(AST, ST) -------------------------------------------------------- +% +% AST single-node matches are implemented with the code generated by each +% DCG rule. cv_basic(int_lin_ne(COEF, VARS, CONST), _ST) --> int_vector(COEF, CC, NN), @@ -11,6 +14,15 @@ cv_basic(int_lin_ne(COEF, VARS, CONST), _ST) --> { name(CC, CCN), name(YY, YYN), name(KK, KKN), name(NN, NNN) }, "fd_poly_ne_k(", CCN, ", ", YYN, ", ", NNN, ", ", KKN, ");\n". +% -- cv_multi(ASTI, ASTO, ST) ------------------------------------------------- +% +% AST multiple-node matches. For now this does nothing. + +cv_multi(_, _, _ST) --> { !, fail }. + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + int_vector(val(CC,array(int,1,NN),_,_), CC, NN) --> []. var_vector(lit(VS, array(int(_LB,_UB))), VA) --> % array of FD variables diff --git a/fz/paccs/output.pl b/fz/paccs/output.pl index f2549da..2dffbed 100644 --- a/fz/paccs/output.pl +++ b/fz/paccs/output.pl @@ -95,6 +95,7 @@ cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST). % emit an instruction which partly covers CI, leaving CO untreated % FIXME: still need to search for an optimal solution... +cg_coverage(CI, CO, ST) --> cv_multi(CI, CO, ST), { ! }. cg_coverage([constraint(CE, _A)|CS], CS, ST) --> cv_basic(CE, ST). -- libgit2 0.21.2