File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/main/pt/up/fe/comp2023/ollir Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,14 @@ public OllirResult toOllir(JmmSemanticsResult semanticsResult) {
33
33
34
34
@ Override
35
35
public JmmSemanticsResult optimize (JmmSemanticsResult semanticsResult ) {
36
- ConstantPropagation constantPropagation = new ConstantPropagation ( semanticsResult );
37
- ConstantFolding constantFolding = new ConstantFolding (semanticsResult );
38
- boolean codeModified = constantPropagation . apply () || constantFolding . apply ( );
36
+ if ( Boolean . parseBoolean ( semanticsResult . getConfig (). get ( "optimize" ))) {
37
+ ConstantPropagation constantPropagation = new ConstantPropagation (semanticsResult );
38
+ ConstantFolding constantFolding = new ConstantFolding ( semanticsResult );
39
39
40
- while (codeModified ){
41
- codeModified = constantPropagation .apply () || constantFolding .apply ();
40
+ boolean codeModified = constantPropagation .apply () || constantFolding .apply ();
41
+ while (codeModified ) {
42
+ codeModified = constantPropagation .apply () || constantFolding .apply ();
43
+ }
42
44
}
43
45
return semanticsResult ;
44
46
}
You can’t perform that action at this time.
0 commit comments