Skip to content

Commit

Permalink
seperate generator into .h and .cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaowen Hu committed Oct 26, 2020
1 parent c9a8dce commit 751f18d
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 713 deletions.
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ souffle_sources = \
interpreter/Engine.cpp \
interpreter/Engine.h \
interpreter/Generator.h \
interpreter/Generator.cpp \
interpreter/BrieIndex.cpp \
interpreter/BTreeIndex.cpp \
interpreter/EqrelIndex.cpp \
Expand Down
8 changes: 4 additions & 4 deletions src/interpreter/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "FunctorOps.h"
#include "Global.h"
#include "interpreter/Context.h"
#include "interpreter/Generator.h"
#include "interpreter/Index.h"
#include "interpreter/Node.h"
#include "interpreter/Relation.h"
Expand Down Expand Up @@ -89,7 +88,7 @@ constexpr RamDomain RAM_BIT_SHIFT_MASK = RAM_DOMAIN_SIZE - 1;
Engine::Engine(ram::TranslationUnit& tUnit)
: profileEnabled(Global::config().has("profile")), isProvenance(Global::config().has("provenance")),
numOfThreads(std::stoi(Global::config().get("jobs"))), tUnit(tUnit),
isa(tUnit.getAnalysis<ram::analysis::IndexAnalysis>()), generator(mk<NodeGenerator>(*this)) {
isa(tUnit.getAnalysis<ram::analysis::IndexAnalysis>()) {
#ifdef _OPENMP
if (numOfThreads > 0) {
omp_set_num_threads(numOfThreads);
Expand Down Expand Up @@ -276,13 +275,14 @@ void Engine::executeMain() {

void Engine::generateIR() {
const ram::Program& program = tUnit.getProgram();
NodeGenerator generator(*this);
if (subroutine.empty()) {
for (const auto& sub : program.getSubroutines()) {
subroutine.push_back(generator->generateTree(*sub.second));
subroutine.push_back(generator.generateTree(*sub.second));
}
}
if (main == nullptr) {
main = generator->generateTree(program.getMain());
main = generator.generateTree(program.getMain());
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/interpreter/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "interpreter/Index.h"
#include "interpreter/Node.h"
#include "interpreter/Relation.h"
#include "interpreter/Generator.h"
#include "ram/Aggregate.h"
#include "ram/AutoIncrement.h"
#include "ram/Break.h"
Expand Down Expand Up @@ -93,7 +94,6 @@
namespace souffle::interpreter {

class ProgInterface;
class NodeGenerator;

/**
* @class Engine
Expand Down Expand Up @@ -228,8 +228,6 @@ class Engine {
RecordTable recordTable;
/** Symbol table for relations */
VecOwn<RelationHandle> relations;
/** Interpreter program generator */
Own<NodeGenerator> generator;
};

} // namespace souffle::interpreter
Loading

0 comments on commit 751f18d

Please sign in to comment.