rose: expose smwr builder, tidy up engine build

This commit is contained in:
Justin Viiret
2016-07-15 09:50:08 +10:00
committed by Matthew Barr
parent a427a2843b
commit 9eb349a343
8 changed files with 68 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2016, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -39,20 +39,12 @@
#include "util/compile_context.h"
#include "util/graph_range.h"
#include "util/make_unique.h"
#include "smallwrite/smallwrite_build.h"
#include "som/slot_manager.h"
using std::vector;
using namespace ue2;
static
std::unique_ptr<RoseBuild> constructBuilder(const Grey &grey) {
CompileContext cc(true, false, get_current_target(), grey);
ReportManager rm(cc.grey);
SomSlotManager ssm(8); // som precision
BoundaryReports boundary;
return makeRoseBuilder(rm, ssm, cc, boundary);
}
static
std::unique_ptr<NGHolder> makeSuffixGraph(ReportID report) {
auto h = ue2::make_unique<NGHolder>(NFA_SUFFIX);
@@ -100,7 +92,12 @@ size_t numUniqueSuffixGraphs(const RoseGraph &g) {
TEST(RoseMerge, uncalcLeaves_nonleaf) {
Grey grey;
auto build_base = constructBuilder(grey);
CompileContext cc(true, false, get_current_target(), grey);
ReportManager rm(cc.grey);
SomSlotManager ssm(8); // som precision
auto smwr = makeSmallWriteBuilder(1, rm, cc);
BoundaryReports boundary;
auto build_base = makeRoseBuilder(rm, ssm, *smwr, cc, boundary);
ASSERT_NE(nullptr, build_base);
RoseBuildImpl &build = static_cast<RoseBuildImpl &>(*build_base);