script optimization support for "add" and "delete" being expressions

This commit is contained in:
Vern Paxson 2024-05-16 14:37:30 -07:00 committed by Tim Wojtulewicz
parent 0e5bece385
commit 37c1f6641c
11 changed files with 132 additions and 144 deletions

View file

@ -157,17 +157,6 @@ TraversalCode ProfileFunc::PreStmt(const Stmt* s) {
expr_switches.insert(sw);
} break;
case STMT_ADD:
case STMT_DELETE: {
auto ad_stmt = static_cast<const AddDelStmt*>(s);
auto ad_e = ad_stmt->StmtExpr();
auto lhs = ad_e->GetOp1();
if ( lhs )
aggr_mods.insert(lhs->GetType().get());
else
aggr_mods.insert(ad_e->GetType().get());
} break;
default: break;
}
@ -339,6 +328,15 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e) {
}
} break;
case EXPR_AGGR_ADD:
case EXPR_AGGR_DEL: {
auto lhs = e->GetOp1();
if ( lhs )
aggr_mods.insert(lhs->GetType().get());
else
aggr_mods.insert(e->GetType().get());
} break;
case EXPR_CALL: {
auto c = e->AsCallExpr();
auto args = c->Args();