1 package org.simantics.scl.compiler.internal.codegen.utils;
3 import org.simantics.scl.compiler.common.names.Name;
4 import org.simantics.scl.compiler.constants.SCLConstant;
5 import org.simantics.scl.compiler.environment.Environment;
6 import org.simantics.scl.compiler.internal.codegen.ssa.SSAModule;
7 import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
9 public class SSASimplificationContext {
11 Environment environment;
12 boolean modified = false;
13 public static int modiId = 0;
16 public SSASimplificationContext(SSAModule module, Environment environment, int phase) {
18 this.environment = environment;
22 public void markModified(String description) {
23 if(SCLCompilerConfiguration.PRINT_OPTIMIZATION_TRANSFORMATIONS)
24 System.out.println("(" + modiId + ") DID " + description);
26 if(SCLCompilerConfiguration.VALIDATE_AFTER_OPTIMIZATIONS)
31 public boolean didModify() {
35 public Environment getEnvironment() {
39 public int getPhase() {
43 static int tempNameCount = 0;
45 public void addConstant(SCLConstant constant) {
46 module.put(constant.getName(), constant);
49 public SCLConstant removeConstant(Name name) {
50 return module.remove(name);
53 public void printConstant(Name name) {
54 System.out.println("--- " + name + " ---------------------------");
55 System.out.println(module.get(name));
58 public void validate() {