Scaffolding for convertToCFG pass that replaces all instances of ML functions with equivalent CFG functions. Traverses module MLIR, generates CFG functions (empty for now) and removes ML functions. Adds Transforms library and tests.
PiperOrigin-RevId: 205848367
diff --git a/lib/IR/Statement.cpp b/lib/IR/Statement.cpp
index dd73a87..b469482 100644
--- a/lib/IR/Statement.cpp
+++ b/lib/IR/Statement.cpp
@@ -30,16 +30,16 @@
}
/// Destroy this statement or one of its subclasses.
-void Statement::destroy(Statement *stmt) {
- switch (stmt->getKind()) {
+void Statement::destroy() {
+ switch (this->getKind()) {
case Kind::Operation:
- delete cast<OperationStmt>(stmt);
+ delete cast<OperationStmt>(this);
break;
case Kind::For:
- delete cast<ForStmt>(stmt);
+ delete cast<ForStmt>(this);
break;
case Kind::If:
- delete cast<IfStmt>(stmt);
+ delete cast<IfStmt>(this);
break;
}
}
@@ -102,7 +102,6 @@
//===----------------------------------------------------------------------===//
IfStmt::~IfStmt() {
- // TODO: correctly delete StmtBlocks under then and else clauses
delete thenClause;
if (elseClause != nullptr)
delete elseClause;