Skip to content

Commit ffa8f6d

Browse files
committed
Don't pretend that we will IR print Stmts.
1 parent 120d258 commit ffa8f6d

2 files changed

Lines changed: 7 additions & 23 deletions

File tree

src/IRGraphCXXPrinter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ std::string IRGraphCXXPrinter::to_cpp_arg<Expr>(const Expr &e) {
4040
return node_names.at(e.get());
4141
}
4242

43+
// Not used, but leaving in place in case we ever want to expand this to Stmts.
4344
template<>
4445
std::string IRGraphCXXPrinter::to_cpp_arg<Stmt>(const Stmt &s) {
4546
if (!s.defined()) {
@@ -60,6 +61,8 @@ template<>
6061
std::string IRGraphCXXPrinter::to_cpp_arg<std::string>(const std::string &s) {
6162
return "\"" + s + "\"";
6263
}
64+
65+
// Not used, but leaving in place in case we ever want to expand this to Stmts.
6366
template<>
6467
std::string IRGraphCXXPrinter::to_cpp_arg<ForType>(const ForType &f) {
6568
switch (f) {
@@ -210,6 +213,7 @@ VISIT_NODE(Call, op->type, op->name, op->args, op->call_type, op->func, op->valu
210213
VISIT_NODE(Let, op->name, op->value, op->body)
211214
VISIT_NODE(VectorReduce, op->op, op->value, op->type.lanes())
212215

216+
#if 0 // Currently no support yet for Stmts, however, the macros below are already correct. We just can't print everything yet.
213217
// --- 6. Core Statements ---
214218
VISIT_NODE(LetStmt, op->name, op->value, op->body)
215219
VISIT_NODE(AssertStmt, op->condition, op->message)
@@ -232,6 +236,7 @@ VISIT_NODE(ProducerConsumer, op->name, op->is_producer, op->body)
232236
VISIT_NODE(Acquire, op->semaphore, op->count, op->body)
233237
VISIT_NODE(Fork, op->first, op->rest)
234238
VISIT_NODE(Atomic, op->producer_name, op->mutex_name, op->body)
239+
#endif
235240

236241
void IRGraphCXXPrinter::test() {
237242
// This:

src/IRGraphCXXPrinter.h

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ class IRGraphCXXPrinter : public IRGraphVisitor {
3030
}
3131
}
3232

33-
void print(const Stmt &s) {
34-
if (s.defined()) {
35-
s.accept(this);
36-
}
37-
}
38-
3933
private:
4034
template<typename T, typename... Args>
4135
void emit_node(const char *node_type_str, const T *op, Args &&...args);
@@ -47,6 +41,8 @@ class IRGraphCXXPrinter : public IRGraphVisitor {
4741
std::string to_cpp_arg(const std::vector<T> &vec);
4842

4943
protected:
44+
using IRGraphVisitor::visit;
45+
5046
void visit(const IntImm *) override;
5147
void visit(const UIntImm *) override;
5248
void visit(const FloatImm *) override;
@@ -74,26 +70,9 @@ class IRGraphCXXPrinter : public IRGraphVisitor {
7470
void visit(const Ramp *) override;
7571
void visit(const Broadcast *) override;
7672
void visit(const Let *) override;
77-
void visit(const LetStmt *) override;
78-
void visit(const AssertStmt *) override;
79-
void visit(const ProducerConsumer *) override;
80-
void visit(const Store *) override;
81-
void visit(const Provide *) override;
82-
void visit(const Allocate *) override;
83-
void visit(const Free *) override;
84-
void visit(const Realize *) override;
85-
void visit(const Block *) override;
86-
void visit(const Fork *) override;
87-
void visit(const IfThenElse *) override;
88-
void visit(const Evaluate *) override;
8973
void visit(const Call *) override;
9074
void visit(const Variable *) override;
91-
void visit(const For *) override;
92-
void visit(const Acquire *) override;
9375
void visit(const Shuffle *) override;
94-
void visit(const Prefetch *) override;
95-
void visit(const HoistedStorage *) override;
96-
void visit(const Atomic *) override;
9776
void visit(const VectorReduce *) override;
9877

9978
public:

0 commit comments

Comments
 (0)