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;
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
11 public class SSASimplificationContext {
12 private static final Logger LOGGER = LoggerFactory.getLogger(SSASimplificationContext.class);
15 Environment environment;
16 boolean modified = false;
17 public static int modiId = 0;
20 public SSASimplificationContext(SSAModule module, Environment environment, int phase) {
22 this.environment = environment;
26 public void markModified(String description) {
27 if(SCLCompilerConfiguration.PRINT_OPTIMIZATION_TRANSFORMATIONS)
28 System.out.println("(" + modiId + ") DID " + description);
30 if(SCLCompilerConfiguration.VALIDATE_AFTER_OPTIMIZATIONS)
35 public boolean didModify() {
39 public Environment getEnvironment() {
43 public int getPhase() {
47 static int tempNameCount = 0;
49 public void addConstant(SCLConstant constant) {
50 module.put(constant.getName(), constant);
53 public SCLConstant removeConstant(Name name) {
54 return module.remove(name);
57 public void printConstant(Name name) {
58 System.out.println("--- " + name + " ---------------------------");
59 System.out.println(module.get(name));
62 public void validate() {