From 3ae2fb417e9270e7b666d51ee32f98f0e7b00eb0 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Tue, 31 Jan 2017 10:22:23 +1100 Subject: [PATCH] move final_to_frag_map into RoseBuildImpl (for dump code) --- src/rose/rose_build_bytecode.cpp | 2 +- src/rose/rose_build_dump.cpp | 21 ++++++++++----------- src/rose/rose_build_impl.h | 16 +++++++++------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/rose/rose_build_bytecode.cpp b/src/rose/rose_build_bytecode.cpp index 92e9aa59..51d8da97 100644 --- a/src/rose/rose_build_bytecode.cpp +++ b/src/rose/rose_build_bytecode.cpp @@ -5414,7 +5414,7 @@ aligned_unique_ptr RoseBuildImpl::buildFinalEngine(u32 minWidth) { DEBUG_PRINTF("longLitLengthThreshold=%zu\n", longLitLengthThreshold); allocateFinalLiteralId(*this); - auto final_to_frag_map = groupByFragment(*this); + final_to_frag_map = groupByFragment(*this); auto anchored_dfas = buildAnchoredDfas(*this); diff --git a/src/rose/rose_build_dump.cpp b/src/rose/rose_build_dump.cpp index abd34629..2b19e197 100644 --- a/src/rose/rose_build_dump.cpp +++ b/src/rose/rose_build_dump.cpp @@ -505,28 +505,27 @@ void dumpRoseTestLiterals(const RoseBuildImpl &build, const string &base) { size_t longLitLengthThreshold = calcLongLitThreshold(build, historyRequired); - const auto final_to_frag_map = groupByFragment(build); - - auto mp = makeMatcherProto(build, final_to_frag_map, ROSE_ANCHORED, false, - longLitLengthThreshold); + auto mp = makeMatcherProto(build, build.final_to_frag_map, ROSE_ANCHORED, + false, longLitLengthThreshold); dumpTestLiterals(base + "rose_anchored_test_literals.txt", mp.lits); - mp = makeMatcherProto(build, final_to_frag_map, ROSE_FLOATING, false, + mp = makeMatcherProto(build, build.final_to_frag_map, ROSE_FLOATING, false, longLitLengthThreshold); dumpTestLiterals(base + "rose_float_test_literals.txt", mp.lits); - mp = makeMatcherProto(build, final_to_frag_map, ROSE_FLOATING, true, + mp = makeMatcherProto(build, build.final_to_frag_map, ROSE_FLOATING, true, longLitLengthThreshold); dumpTestLiterals(base + "rose_delay_rebuild_test_literals.txt", mp.lits); - mp = makeMatcherProto(build, final_to_frag_map, ROSE_EOD_ANCHORED, false, - build.ematcher_region_size); + mp = makeMatcherProto(build, build.final_to_frag_map, ROSE_EOD_ANCHORED, + false, build.ematcher_region_size); dumpTestLiterals(base + "rose_eod_test_literals.txt", mp.lits); if (!build.cc.streaming) { - mp = makeMatcherProto(build, final_to_frag_map, ROSE_FLOATING, false, - ROSE_SMALL_BLOCK_LEN, ROSE_SMALL_BLOCK_LEN); - auto mp2 = makeMatcherProto(build, final_to_frag_map, + mp = + makeMatcherProto(build, build.final_to_frag_map, ROSE_FLOATING, + false, ROSE_SMALL_BLOCK_LEN, ROSE_SMALL_BLOCK_LEN); + auto mp2 = makeMatcherProto(build, build.final_to_frag_map, ROSE_ANCHORED_SMALL_BLOCK, false, ROSE_SMALL_BLOCK_LEN, ROSE_SMALL_BLOCK_LEN); mp.lits.insert(end(mp.lits), begin(mp2.lits), end(mp2.lits)); diff --git a/src/rose/rose_build_impl.h b/src/rose/rose_build_impl.h index e615d42b..e9ba5f55 100644 --- a/src/rose/rose_build_impl.h +++ b/src/rose/rose_build_impl.h @@ -436,6 +436,13 @@ private: std::set all_reports(const OutfixInfo &outfix); +struct LitFragment { + explicit LitFragment(u32 fragment_id_in) : fragment_id(fragment_id_in) {} + u32 fragment_id; + u32 lit_program_offset = 0; + u32 delay_program_offset = 0; +}; + // Concrete impl class class RoseBuildImpl : public RoseBuild { public: @@ -587,6 +594,8 @@ public: std::map > final_id_to_literal; /* final literal id to * literal id */ + std::map final_to_frag_map; + unordered_set transient; unordered_map rose_squash_masks; @@ -642,13 +651,6 @@ void normaliseLiteralMask(const ue2_literal &s, std::vector &msk, bool canImplementGraphs(const RoseBuildImpl &tbi); #endif -struct LitFragment { - explicit LitFragment(u32 fragment_id_in) : fragment_id(fragment_id_in) {} - u32 fragment_id; - u32 lit_program_offset = 0; - u32 delay_program_offset = 0; -}; - std::map groupByFragment(const RoseBuildImpl &build); } // namespace ue2