From 7a7dff5b705e94a511e30fbca71e49f02c4fedb0 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Fri, 10 Jun 2016 11:39:22 +1000 Subject: [PATCH] eod: don't force sparse iter for general prog --- src/rose/rose_build_bytecode.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/rose/rose_build_bytecode.cpp b/src/rose/rose_build_bytecode.cpp index 1c8e8cd0..b37b259a 100644 --- a/src/rose/rose_build_bytecode.cpp +++ b/src/rose/rose_build_bytecode.cpp @@ -3958,7 +3958,8 @@ u32 buildReportPrograms(RoseBuildImpl &build, build_context &bc) { static vector makeEodAnchorProgram(RoseBuildImpl &build, build_context &bc, - const RoseEdge &e) { + const RoseEdge &e, + const bool multiple_preds) { const RoseGraph &g = build.g; const RoseVertex v = target(e, g); @@ -3968,7 +3969,7 @@ vector makeEodAnchorProgram(RoseBuildImpl &build, makeRoleCheckBounds(build, v, e, program); } - if (hasGreaterInDegree(1, v, g)) { + if (multiple_preds) { // Only necessary when there is more than one pred. makeRoleCheckNotHandled(bc, v, program); } @@ -4002,23 +4003,27 @@ pair buildEodAnchorProgram(RoseBuildImpl &build, build_context &bc) { DEBUG_PRINTF("vertex %zu (with %zu preds) fires on EOD\n", g[v].idx, in_degree(v, g)); + vector edge_list; for (const auto &e : in_edges_range(v, g)) { RoseVertex u = source(e, g); - if (!build.isInETable(u)) { DEBUG_PRINTF("pred %zu is not in etable\n", g[u].idx); continue; } - if (canEagerlyReportAtEod(build, e)) { DEBUG_PRINTF("already done report for vertex %zu\n", g[u].idx); continue; } + edge_list.push_back(e); + } + const bool multiple_preds = edge_list.size() > 1; + for (const auto &e : edge_list) { + RoseVertex u = source(e, g); assert(contains(bc.roleStateIndices, u)); u32 predStateIdx = bc.roleStateIndices.at(u); - auto program = makeEodAnchorProgram(build, bc, e); + auto program = makeEodAnchorProgram(build, bc, e, multiple_preds); predProgramLists[predStateIdx].push_back(program); } } @@ -4055,23 +4060,27 @@ void addGeneralEodAnchorProgram(RoseBuildImpl &build, build_context &bc, DEBUG_PRINTF("vertex %zu (with %zu preds) fires on EOD\n", g[v].idx, in_degree(v, g)); + vector edge_list; for (const auto &e : in_edges_range(v, g)) { RoseVertex u = source(e, g); - if (build.isInETable(u)) { DEBUG_PRINTF("pred %zu is in etable\n", g[u].idx); continue; } - if (canEagerlyReportAtEod(build, e)) { DEBUG_PRINTF("already done report for vertex %zu\n", g[u].idx); continue; } + edge_list.push_back(e); + } + const bool multiple_preds = edge_list.size() > 1; + for (const auto &e : edge_list) { + RoseVertex u = source(e, g); assert(contains(bc.roleStateIndices, u)); u32 predStateIdx = bc.roleStateIndices.at(u); - auto program = makeEodAnchorProgram(build, bc, e); + auto program = makeEodAnchorProgram(build, bc, e, multiple_preds); predProgramLists[predStateIdx].push_back(program); } } @@ -4085,9 +4094,7 @@ void addGeneralEodAnchorProgram(RoseBuildImpl &build, build_context &bc, assert(program.back().code() == ROSE_INSTR_END); program.pop_back(); } - // TODO: don't force sparse iter, be more careful with generating - // CHECK_NOT_HANDLED. - addPredBlocks(bc, predProgramLists, program, true); + addPredBlocks(bc, predProgramLists, program, false); } static