Change to the spec...missed a consistency property. Adding timing option.
[repair.git] / Repair / RepairCompiler / MCC / Compiler.java
index c2d16124949e68e7e20c68ec03a2d55d3fbd9e63..04ad0bad552606b1f42f608d689d717009a34272 100755 (executable)
@@ -19,7 +19,16 @@ import MCC.IR.*;
 public class Compiler {
     /* Set this flag to false to turn repairs off */
     public static boolean REPAIR=true;
+    public static boolean AGGRESSIVESEARCH=false;
+    public static boolean PRUNEQUANTIFIERS=false;
+    public static boolean GENERATEDEBUGHOOKS=false;
+    public static boolean GENERATEDEBUGPRINT=false;
+    public static boolean GENERATEINSTRUMENT=false;
+    public static boolean ALLOCATECPLUSPLUS=false;
+    public static boolean TIME=false;
     
+    public static Vector debuggraphs=new Vector();
+
     public static void main(String[] args) {
         State state = null;
         boolean success = true;
@@ -39,118 +48,79 @@ public class Compiler {
          * specified at command line
          */
 
-        System.out.println("\nMCC v0.0.1 - MIT LCS (Author: Daniel Roy, Brian Demsky)");
+        System.out.println("MCC v0.0.1 - MIT LCS (Author: Daniel Roy, Brian Demsky)\n");
 
        if (cli.infile == null) {
            System.err.println("\nError: no input file specified");
            System.exit(-1);
        }
         
-       if (cli.target == CLI.ASSEMBLY || cli.target == CLI.DEFAULT) {
-           if (state.debug) {
-               System.out.println("Compiling " + cli.infile + ".");
-           }
-
-           success = scan(state) || error(state, "Scanning failed, not attempting to parse.");
-           success = parse(state) || error(state, "Parsing failed, not attempting semantic analysis.");
-           success = semantics(state) || error(state, "Semantic analysis failed, not attempting variable initialization.");
-
-
-           Termination termination=null;
-           /* Check partition constraints */
-           (new ImplicitSchema(state)).update();
-           termination=new Termination(state);
-
-            state.printall();
-            (new DependencyBuilder(state)).calculate();
-            
-            try {
-                Vector nodes = new Vector(state.constraintnodes.values());
-                nodes.addAll(state.rulenodes.values());
-
-                FileOutputStream dotfile;
-                dotfile = new FileOutputStream(cli.infile + ".dependencies.edgelabels.dot");
-                GraphNode.useEdgeLabels = true;
-                GraphNode.DOTVisitor.visit(dotfile, nodes);
-                dotfile.close();
-
-                dotfile = new FileOutputStream(cli.infile + ".dependencies.dot");
-                GraphNode.useEdgeLabels = false;
-                GraphNode.DOTVisitor.visit(dotfile, nodes);                
-                dotfile.close();
-            } catch (Exception e) {
-                e.printStackTrace();
-                System.exit(-1);
-            }
-            
-            try {
-                FileOutputStream gcode = new FileOutputStream(cli.infile + ".cc");
-
-
-                // do model optimizations
-                //(new Optimizer(state)).optimize();
-
-
-
-               FileOutputStream gcode2 = new FileOutputStream(cli.infile + "_aux.cc");
-               FileOutputStream gcode3 = new FileOutputStream(cli.infile + "_aux.h");
-               RepairGenerator wg = new RepairGenerator(state,termination);
-               wg.generate(gcode,gcode2,gcode3, cli.infile + "_aux.h");
-               gcode2.close();
-               gcode3.close();
-               /*              } else {
-                   WorklistGenerator ng = new WorklistGenerator(state);
+       if (state.debug) {
+           System.out.println("Compiling " + cli.infile + ".");
+       }
+       
+       success = scan(state) || error(state, "Scanning failed, not attempting to parse.");
+       success = parse(state) || error(state, "Parsing failed, not attempting semantic analysis.");
+       success = semantics(state) || error(state, "Semantic analysis failed, not attempting variable initialization.");
+       
+       
+       state.setanalysis=new SetAnalysis(state);
+       Termination termination=null;
+       /* Check partition constraints */
+       (new ImplicitSchema(state)).update();
+       termination=new Termination(state);
+       
+       state.printall();
+       (new DependencyBuilder(state)).calculate();
+       
+       try {
+           Vector nodes = new Vector(state.constraintnodes.values());
+           nodes.addAll(state.rulenodes.values());
+           
+           FileOutputStream dotfile;
+           dotfile = new FileOutputStream(cli.infile + ".dependencies.edgelabels.dot");
+           GraphNode.useEdgeLabels = true;
+           GraphNode.DOTVisitor.visit(dotfile, nodes);
+           dotfile.close();
+           
+           dotfile = new FileOutputStream(cli.infile + ".dependencies.dot");
+           GraphNode.useEdgeLabels = false;
+           GraphNode.DOTVisitor.visit(dotfile, nodes);                
+           dotfile.close();
+       } catch (Exception e) {
+           e.printStackTrace();
+           System.exit(-1);
+       }
+       
+       try {
+           FileOutputStream gcode = new FileOutputStream(cli.infile + ".cc");
+           
+           
+           // do model optimizations
+           //(new Optimizer(state)).optimize();
+           
+           FileOutputStream gcode2 = new FileOutputStream(cli.infile + "_aux.cc");
+           FileOutputStream gcode3 = new FileOutputStream(cli.infile + "_aux.h");
+           RepairGenerator wg = new RepairGenerator(state,termination);
+           wg.generate(gcode,gcode2,gcode3, cli.infile + "_aux.h");
+           gcode2.close();
+           gcode3.close();
+           /*          } else {
+                       WorklistGenerator ng = new WorklistGenerator(state);
                    SetInclusion.worklist=true;
                    RelationInclusion.worklist=true;
                    ng.generate(gcode);
                    }*/
-                gcode.close();
-            } catch (Exception e) {
-                e.printStackTrace();
-                System.exit(-1);
-            }
-            
-           if (state.debug) {
-               System.out.println("Compilation of " + state.infile + " successful.");
-               System.out.println("#SUCCESS#");
-           }
-       } else if (cli.target == CLI.INTER) {
-           if (state.debug) {
-               System.out.println("Semantic analysis for " + cli.infile + ".");
-           }
-
-           success = scan(state) || error(state, "Scanning failed, not attempting to parse.");
-           success = parse(state) || error(state, "Parsing failed, not attempting semantic analysis.");
-           success = semantics(state) || error(state, "Semantic analysis failed.");
-
-           if (state.debug) {
-               System.out.println("Semantic analysis of " + state.infile + " successful.");
-               System.out.println("#SUCCESS#");
-           }
-       } else if (cli.target == CLI.PARSE) {
-           if (state.debug) {
-               System.out.println("Parsing " + cli.infile + ".");
-           }
-
-           success = scan(state) || error(state, "Scanning failed, not attempting to parse.");
-           success = parse(state) || error(state, "Parsing failed.");
-
-           if (state.debug) {
-               System.out.println("Parsing of " + state.infile + " successful.");
-               System.out.println("#SUCCESS#");
-           }
-        } else if (cli.target == CLI.SCAN) {
-           if (state.debug) {
-               System.out.println("Scanning " + cli.infile + ".");
-           }
-
-           success = scan(state) || error(state, "Scanning failed.");
-
-           if (state.debug) {
-               System.out.println("Scanning of " + state.infile + " successful.");
-               System.out.println("#SUCCESS#");
-           }
-        }
+           gcode.close();
+       } catch (Exception e) {
+           e.printStackTrace();
+           System.exit(-1);
+       }
+       
+       if (state.debug) {
+           System.out.println("Compilation of " + state.infile + " successful.");
+           System.out.println("#SUCCESS#");
+       }
     }
 
     private static void printArgInfo(CLI cli) {
@@ -158,31 +128,6 @@ public class Compiler {
             System.out.println("Printing debugging information...");
             System.out.println("Input filename: " + cli.infile);
             System.out.println("Output filename: " + cli.outfile);
-            System.out.print("Target: ");
-
-            switch(cli.target) {
-            case CLI.ASSEMBLY:
-                System.out.println("ASSEMBLY");
-                break;
-            case CLI.DEFAULT:
-                System.out.println("DEFAULT");
-                break;
-            case CLI.INTER:
-                System.out.println("INTER");
-                break;
-            case CLI.LOWIR:
-                System.out.println("LOWIR");
-                break;
-            case CLI.PARSE:
-                System.out.println("PARSE");
-                break;
-            case CLI.SCAN:
-                System.out.println("SCAN");
-                break;
-            default:
-                System.out.println("not recognized");
-                break;
-            }
 
             for (int i = 0; i < cli.opts.length; i++) {
                 if (cli.opts[i]) {
@@ -256,8 +201,8 @@ public class Compiler {
             System.err.println("Unable to open file: " + state.infile + ".struct");
             System.exit(-1);
        } catch (Exception e) {
-           //      System.out.println(e);
-           //      e.printStackTrace();
+           System.out.println(e);
+           e.printStackTrace();
            return false;
        }
 
@@ -274,8 +219,8 @@ public class Compiler {
             System.err.println("Unable to open file: " + state.infile + ".model");
             System.exit(-1);
        } catch (Exception e) {
-           //      System.out.println(e);
-           //      e.printStackTrace();
+           System.out.println(e);
+           e.printStackTrace();
            return false;
        }
 
@@ -310,8 +255,8 @@ public class Compiler {
             System.err.println("Unable to open file: " + state.infile + ".constraints");
             System.exit(-1);
        } catch (Exception e) {
-           //      System.out.println(e);
-           //      e.printStackTrace();
+           System.out.println(e);
+           e.printStackTrace();
            return false;
        }