Remove some debug statements

This commit is contained in:
Emi Simpson 2024-03-17 09:47:37 -04:00
parent 864d98638e
commit 482547fea9
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847

5
opt.py
View file

@ -38,21 +38,17 @@ def collapse_constant_additions(expr: Expression) -> Option[Expression]:
def eliminate_identity_operations(expr: Expression) -> Option[Expression]:
match expr:
case Application(Builtin(Builtin.BB_PLUS_CONST(0)), val):
print('BBBBBBBB')
return Some(val)
case Application(MonoFunc(arg, Variable(bod_var)), val):
if arg == bod_var:
print('CCCCCCCCCCCCCcc')
return Some(val)
return None
def identify_constant_additions(expr: Expression):
match expr:
case Application(Builtin(Builtin.BB_PLUS()), Int(x)):
print('AAAααααα')
return Some(Builtin(Builtin.BB_PLUS_CONST(x)))
case Application(Application(Builtin(Builtin.BB_PLUS()), expr1), Int(x)):
print('DDDDDDDDDDD')
return Some(Application(Builtin(Builtin.BB_PLUS_CONST(x)), expr1))
return None
@ -84,7 +80,6 @@ def apply_opts(optimizations: Collection[Optimization], expression: Expression)
optimized_expr = Switch(optimized_branches, optimized_fallback, optimized_switching_on)
case ReplHole(type_bindings, val_bindings):
val_optimizations = tuple((name, *apply_opts(optimizations, val)) for name, val in val_bindings)
print('VAL_OPTS:', val_optimizations)
count = sum(count_val_binding for _, _, count_val_binding in val_optimizations)
optimized_val_bindings = tuple((name, optimized_val_binding) for name, optimized_val_binding, _ in val_optimizations)
optimized_expr = ReplHole(type_bindings, optimized_val_bindings)