Navigation Menu

Skip to content

Commit

Permalink
Improve TupleOperation so that profile node is inserted only when
Browse files Browse the repository at this point in the history
enabled.
  • Loading branch information
XiaowenHu96 committed Jul 27, 2020
1 parent b0e1727 commit 216dadc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/InterpreterGenerator.h
Expand Up @@ -57,7 +57,9 @@ class NodeGenerator : public RamVisitor<std::unique_ptr<InterpreterNode>> {
using RelationHandle = std::unique_ptr<InterpreterRelation>;

public:
NodeGenerator(RamIndexAnalysis* isa) : isa(isa), isProvenance(Global::config().has("provenance")) {}
NodeGenerator(RamIndexAnalysis* isa)
: isa(isa), isProvenance(Global::config().has("provenance")),
profileEnabled(Global::config().has("profile")) {}

/**
* @brief Generate the tree based on given entry.
Expand Down Expand Up @@ -205,9 +207,12 @@ class NodeGenerator : public RamVisitor<std::unique_ptr<InterpreterNode>> {
}

NodePtr visitTupleOperation(const RamTupleOperation& search) override {
NodePtrVec children;
children.push_back(visit(search.getOperation()));
return std::make_unique<InterpreterNode>(I_TupleOperation, &search, std::move(children));
if (profileEnabled) {
NodePtrVec children;
children.push_back(visit(search.getOperation()));
return std::make_unique<InterpreterNode>(I_TupleOperation, &search, std::move(children));
}
return visit(search.getOperation());
}

NodePtr visitScan(const RamScan& scan) override {
Expand Down Expand Up @@ -584,6 +589,8 @@ class NodeGenerator : public RamVisitor<std::unique_ptr<InterpreterNode>> {
}

private:
/** If profile is enable in this program */
const bool profileEnabled;
/** Environment encoding, store a mapping from RamNode to its operation index id. */
std::unordered_map<const RamNode*, size_t> indexTable;
/** Used by index encoding */
Expand Down

0 comments on commit 216dadc

Please sign in to comment.