示例#1
0
void PSIVisitor::visit_constraint_if_stmt(IConstraintIf *c) {
	visit_expr(c->getCond());

	visit_constraint_stmt(c->getTrue());

	if (c->getFalse()) {
		visit_constraint_stmt(c->getFalse());
	}
}
示例#2
0
void PSIVisitor::visit_constraint_block(IConstraintBlock *block) {
	std::vector<IConstraint *>::const_iterator it = block->getConstraints().begin();

	for (; it!=block->getConstraints().end(); it++) {
		IConstraint *c = *it;
		visit_constraint_stmt(c);
	}
}
示例#3
0
void PSIVisitor::visit_constraint_stmt(IConstraint *c) {
	switch (c->getConstraintType()) {
	case IConstraint::ConstraintType_Block: {

		visit_constraint_block(static_cast<IConstraintBlock *>(c));
	} break;

	case IConstraint::ConstraintType_Expr:
		visit_constraint_expr_stmt(static_cast<IConstraintExpr *>(c));
		break;

	case IConstraint::ConstraintType_If: {
		IConstraintIf *c_if = static_cast<IConstraintIf *>(c);

		visit_expr(c_if->getCond());

		visit_constraint_stmt(c_if->getTrue());

		if (c_if->getFalse()) {
			visit_constraint_stmt(c_if->getFalse());
		}
		} break;
	}
}
示例#4
0
void PSIVisitor::visit_graph_stmt(IGraphStmt *stmt) {
	switch (stmt->getStmtType()) {
	case IGraphStmt::GraphStmt_Block: {
		visit_graph_block_stmt(static_cast<IGraphBlockStmt *>(stmt));
	} break;

	case IGraphStmt::GraphStmt_IfElse: {
		fprintf(stdout, "TODO: GraphStmt_IfElse\n");
	} break;

	case IGraphStmt::GraphStmt_Parallel: {
		visit_graph_block_stmt(static_cast<IGraphBlockStmt *>(stmt));
	} break;

	case IGraphStmt::GraphStmt_Schedule: {
		visit_graph_block_stmt(static_cast<IGraphBlockStmt *>(stmt));
	} break;

	case IGraphStmt::GraphStmt_Select: {
		visit_graph_block_stmt(static_cast<IGraphBlockStmt *>(stmt));
	} break;

	case IGraphStmt::GraphStmt_Repeat: {
		IGraphRepeatStmt *r = static_cast<IGraphRepeatStmt *>(stmt);

		// TODO: handle non-forever versions
		visit_graph_stmt(r->getBody());

	} break;

	case IGraphStmt::GraphStmt_Traverse: {
		IGraphTraverseStmt *t = static_cast<IGraphTraverseStmt *>(stmt);

		if (t->getWith()) {
			visit_constraint_stmt(t->getWith());
		}
	} break;

	default: fprintf(stdout, "TODO: handle graph stmt %d\n", stmt->getStmtType());

	}
}
示例#5
0
void PSIVisitor::visit_graph_traverse_stmt(IGraphTraverseStmt *t) {
	if (t->getWith()) {
		visit_constraint_stmt(t->getWith());
	}
}
示例#6
0
void PSIVisitor::visit_constraint(IConstraintBlock *c) {
	for (std::vector<IConstraint *>::const_iterator it=c->getConstraints().begin();
			it!=c->getConstraints().end(); it++) {
		visit_constraint_stmt(*it);
	}
}