Merge branch 'hamed' of ssh://plrg.eecs.uci.edu/home/git/constraint_compiler
authorbdemsky <bdemsky@uci.edu>
Tue, 22 Aug 2017 05:22:14 +0000 (22:22 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 22 Aug 2017 05:22:14 +0000 (22:22 -0700)
src/Encoders/orderencoder.c
src/Tuner/tunable.h

index 084995b1126b4823c93eae99da7e0fc8432cbfa8..e97a17b2dcf1d064f1ebceb4c70a5dd61877e1f2 100644 (file)
@@ -7,6 +7,7 @@
 #include "ordernode.h"
 #include "rewriter.h"
 #include "mutableset.h"
+#include "tunable.h"
 
 OrderGraph *buildOrderGraph(Order *order) {
        OrderGraph *orderGraph = allocOrderGraph(order);
@@ -397,6 +398,11 @@ void orderAnalysis(CSolver *This) {
        uint size = getSizeVectorOrder(This->allOrders);
        for (uint i = 0; i < size; i++) {
                Order *order = getVectorOrder(This->allOrders, i);
+               TunableDesc onoff={9, 1, 1};
+               bool doDecompose=GETVARTUNABLE(This->tuner, order->type, DECOMPOSEORDER, &onoff);
+               if (!doDecompose)
+                       continue;
+               
                OrderGraph *graph = buildOrderGraph(order);
                if (order->type == PARTIAL) {
                        //Required to do SCC analysis for partial order graphs.  It
@@ -405,24 +411,33 @@ void orderAnalysis(CSolver *This) {
                        completePartialOrderGraph(graph);
                }
 
-               //This analysis is completely optional
-               reachMustAnalysis(This, graph, false);
 
-               //This pair of analysis is also optional
-               if (order->type == PARTIAL) {
-                       localMustAnalysisPartial(This, graph);
-               } else {
-                       localMustAnalysisTotal(This, graph);
-               }
+               bool mustReachGlobal=GETVARTUNABLE(This->tuner, order->type, MUSTREACHGLOBAL, &onoff);
+
+               if (mustReachGlobal)
+                       reachMustAnalysis(This, graph, false);
 
-               //This optimization is completely optional
-               removeMustBeTrueNodes(graph);
+               bool mustReachLocal=GETVARTUNABLE(This->tuner, order->type, MUSTREACHLOCAL, &onoff);
+               
+               if (mustReachLocal) {
+                       //This pair of analysis is also optional
+                       if (order->type == PARTIAL) {
+                               localMustAnalysisPartial(This, graph);
+                       } else {
+                               localMustAnalysisTotal(This, graph);
+                       }
+               }
 
+               bool mustReachPrune=GETVARTUNABLE(This->tuner, order->type, MUSTREACHPRUNE, &onoff);
+               
+               if (mustReachPrune)
+                       removeMustBeTrueNodes(graph);
+               
                //This is needed for splitorder
                computeStronglyConnectedComponentGraph(graph);
-
+               
                decomposeOrder(This, order, graph);
-
+               
                deleteOrderGraph(graph);
        }
 }
index 45744b06d024a13642eb2b930f3d26f7e8cb8966..66c46381f5f2aa63a80751e7176507e82bd962e3 100644 (file)
@@ -18,7 +18,9 @@ void deleteTuner(Tuner *This);
 int getTunable(Tuner *This, TunableParam param, TunableDesc * descriptor);
 int getVarTunable(Tuner *This, VarType vartype, TunableParam param, TunableDesc * descriptor);
 
-#define GETTUNABLE(This, param, descriptor) getTunable(This, param, descriptor);
-#define GETVARTUNABLE(This, vartype, param, descriptor) getTunable(This, param, descriptor);
+#define GETTUNABLE(This, param, descriptor) getTunable(This, param, descriptor)
+#define GETVARTUNABLE(This, vartype, param, descriptor) getTunable(This, param, descriptor)
 
+enum Tunables {DECOMPOSEORDER, MUSTREACHGLOBAL, MUSTREACHLOCAL, MUSTREACHPRUNE};
+typedef enum Tunables Tunables;
 #endif