From eb80d3d43fdb070fe99718501d3b0fbdca61ab8d Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 15 Aug 2019 22:47:59 +0200 Subject: [PATCH] Change pmgen default rule to reject, switch peepopt behavior to accept Signed-off-by: Clifford Wolf --- passes/pmgen/demo_reduce.pmg | 3 +-- passes/pmgen/ice40_dsp.pmg | 1 + passes/pmgen/peepopt_muldiv.pmg | 2 +- passes/pmgen/peepopt_shiftmul.pmg | 2 +- passes/pmgen/pmgen.py | 4 +--- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/passes/pmgen/demo_reduce.pmg b/passes/pmgen/demo_reduce.pmg index ddc932de5..09856e9ae 100644 --- a/passes/pmgen/demo_reduce.pmg +++ b/passes/pmgen/demo_reduce.pmg @@ -23,6 +23,7 @@ code finally chain.pop_back(); log_assert(chain.empty()); + accept; endcode // ------------------------------------------------------------------ @@ -48,7 +49,6 @@ endmatch code non_first_cells.insert(next); - reject; endcode // ------------------------------------------------------------------ @@ -74,7 +74,6 @@ code if (GetSize(chain) > GetSize(longest_chain)) longest_chain = chain; } - reject; finally if (next) chain.pop_back(); diff --git a/passes/pmgen/ice40_dsp.pmg b/passes/pmgen/ice40_dsp.pmg index 1f3590d4e..7003092bb 100644 --- a/passes/pmgen/ice40_dsp.pmg +++ b/passes/pmgen/ice40_dsp.pmg @@ -159,4 +159,5 @@ code clock clock_pol clock_vld clock_pol = cp; clock_vld = true; } + accept; endcode diff --git a/passes/pmgen/peepopt_muldiv.pmg b/passes/pmgen/peepopt_muldiv.pmg index 06c275834..7cad759d0 100644 --- a/passes/pmgen/peepopt_muldiv.pmg +++ b/passes/pmgen/peepopt_muldiv.pmg @@ -32,5 +32,5 @@ code log("muldiv pattern in %s: mul=%s, div=%s\n", log_id(module), log_id(mul), log_id(div)); module->connect(div_y, val_y); autoremove(div); - reject; + accept; endcode diff --git a/passes/pmgen/peepopt_shiftmul.pmg b/passes/pmgen/peepopt_shiftmul.pmg index d766d9e4a..d4748ae19 100644 --- a/passes/pmgen/peepopt_shiftmul.pmg +++ b/passes/pmgen/peepopt_shiftmul.pmg @@ -91,6 +91,6 @@ code shift->setParam(\B_WIDTH, GetSize(new_b)); blacklist(shift); - reject; + accept; } endcode diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index 22a7a5225..c6e9a9cbf 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -494,8 +494,6 @@ with open(outfile, "w") as f: current_pattern, current_subpattern = block["pattern"] if block["type"] == "final": - print(" on_accept();", file=f) - print(" check_blacklist_{}();".format(current_pattern), file=f) print(" }", file=f) if index+1 != len(blocks): print("", file=f) @@ -556,7 +554,7 @@ with open(outfile, "w") as f: print("#define reject do {{ check_blacklist_{}(); goto rollback_label; }} while(0)".format(current_pattern), file=f) print("#define accept do {{ on_accept(); check_blacklist_{}(); if (rollback) goto rollback_label; }} while(0)".format(current_pattern), file=f) print("#define branch do {{ block_{}(); if (rollback) goto rollback_label; }} while(0)".format(index+1), file=f) - print("#define subpattern(pattern_name) block_subpattern_{}_ ## pattern_name ()".format(current_pattern), file=f) + print("#define subpattern(pattern_name) do {{ block_subpattern_{}_ ## pattern_name (); if (rollback) goto rollback_label; }} while(0)".format(current_pattern), file=f) for line in block["code"]: print(" " + line, file=f) -- 2.30.2