X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FMain%2FMain.java;h=cb8bf768501a1bda095d1cabb30f4c949a924c5f;hb=18ba60849200d7a58a47baa07074b90cdcfb7382;hp=0430dd0ef6c1a13a9da35e5fb76c34b23099b159;hpb=36bac4fbcfabb5d2d2cbba32f6d42cd1f1c20f10;p=IRC.git diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 0430dd0e..cb8bf768 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -40,6 +40,10 @@ import Analysis.Locality.GenerateConversions; import Analysis.Prefetch.PrefetchAnalysis; import Analysis.FlatIRGraph.FlatIRGraph; import Analysis.OwnershipAnalysis.OwnershipAnalysis; +import Analysis.MLP.MLPAnalysis; +import Analysis.Loops.*; +import IR.MethodDescriptor; +import IR.Flat.FlatMethod; import Interface.*; import Util.GraphNode; import Util.GraphNode.DFS; @@ -127,6 +131,8 @@ public class Main { state.OWNERSHIPALIASFILE=args[++i]; else if (option.equals("-optional")) state.OPTIONAL=true; + else if (option.equals("-optimize")) + state.OPTIMIZE=true; else if (option.equals("-raw")) state.RAW=true; else if (option.equals("-scheduling")) @@ -139,21 +145,29 @@ public class Main { state.THREAD=true; else if (option.equals("-dsm")) state.DSM=true; + else if (option.equals("-singleTM")) + state.SINGLETM=true; else if (option.equals("-webinterface")) state.WEBINTERFACE=true; else if (option.equals("-instructionfailures")) state.INSTRUCTIONFAILURE=true; else if (option.equals("-abcclose")) state.ARRAYBOUNDARYCHECK=false; - else if (option.equals("-mlp")) + else if (option.equals("-mlp")) { state.MLP=true; - else if (option.equals("-help")) { + state.OWNERSHIP=true; + } else if (option.equals("-mlpdebug")) { + state.MLP=true; + state.MLPDEBUG=true; + state.OWNERSHIP=true; + } else if (option.equals("-help")) { System.out.println("-classlibrary classlibrarydirectory -- directory where classlibrary is located"); System.out.println("-selfloop task -- this task doesn't self loop its parameters forever"); System.out.println("-dir outputdirectory -- output code in outputdirectory"); System.out.println("-struct structfile -- output structure declarations for repair tool"); System.out.println("-mainclass -- main function to call"); System.out.println("-dsm -- distributed shared memory support"); + System.out.println("-singleTM -- single machine committing transactions"); System.out.println("-abortreaders -- abort readers"); System.out.println("-precise -- use precise garbage collection"); System.out.println("-conscheck -- turn on consistency checking"); @@ -172,10 +186,12 @@ public class Main { System.out.println("-ownallocdepth -- set allocation depth for ownership analysis"); System.out.println("-ownwritedots -- write ownership graphs; can be all results or just final results"); System.out.println("-ownaliasfile -- write a text file showing all detected aliases in program tasks"); + System.out.println("-optimize -- enable optimizations"); System.out.println("-optional -- enable optional arguments"); System.out.println("-abcclose close the array boundary check"); System.out.println("-scheduling do task scheduling"); System.out.println("-mlp build mlp code"); + System.out.println("-mlp build mlp code, report progress and interim results"); System.out.println("-multicore generate multi-core version binary"); System.out.println("-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"); System.out.println("-raw generate raw version binary (should be used together with -multicore)"); @@ -219,8 +235,8 @@ public class Main { if (state.TASK) { sc.getClass("TagDescriptor"); } - if (state.THREAD||state.DSM) { - sc.getClass("Thread"); + if (state.THREAD||state.DSM||state.SINGLETM) { + sc.getClass("Thread"); } sc.semanticCheck(); @@ -232,6 +248,66 @@ public class Main { SafetyAnalysis sa=null; PrefetchAnalysis pa=null; + if (state.OPTIMIZE) { + CallGraph callgraph=new CallGraph(state); + CopyPropagation cp=new CopyPropagation(); + DeadCode dc=new DeadCode(); + GlobalFieldType gft=new GlobalFieldType(callgraph, state, tu.getMain()); + CSE cse=new CSE(gft, tu); + localCSE lcse=new localCSE(gft, tu); + LoopOptimize lo=new LoopOptimize(gft, tu); + Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); + while(classit.hasNext()) { + ClassDescriptor cn=(ClassDescriptor)classit.next(); + Iterator methodit=cn.getMethods(); + while(methodit.hasNext()) { + /* Classify parameters */ + MethodDescriptor md=(MethodDescriptor)methodit.next(); + FlatMethod fm=state.getMethodFlat(md); + cp.optimize(fm); + dc.optimize(fm); + lo.optimize(fm); + lcse.doAnalysis(fm); + cse.doAnalysis(fm); + cp.optimize(fm); + dc.optimize(fm); + } + } + } + + if (state.FLATIRGRAPH) { + FlatIRGraph firg = new FlatIRGraph(state, + state.FLATIRGRAPHTASKS, + state.FLATIRGRAPHUSERMETHODS, + state.FLATIRGRAPHLIBMETHODS); + } + + if (state.OWNERSHIP && !state.MLP) { + CallGraph callGraph = new CallGraph(state); + OwnershipAnalysis oa = new OwnershipAnalysis(state, + tu, + callGraph, + state.OWNERSHIPALLOCDEPTH, + state.OWNERSHIPWRITEDOTS, + state.OWNERSHIPWRITEALL, + state.OWNERSHIPALIASFILE); + } + + if (state.MLP) { + CallGraph callGraph = new CallGraph(state); + OwnershipAnalysis oa = new OwnershipAnalysis(state, + tu, + callGraph, + state.OWNERSHIPALLOCDEPTH, + state.OWNERSHIPWRITEDOTS, + state.OWNERSHIPWRITEALL, + state.OWNERSHIPALIASFILE); + MLPAnalysis mlpa = new MLPAnalysis(state, + tu, + callGraph, + oa); + } + if (state.TAGSTATE) { CallGraph callgraph=new CallGraph(state); TagAnalysis taganalysis=new TagAnalysis(state, callgraph); @@ -265,13 +341,13 @@ public class Main { if (state.SCHEDULING) { // Use ownership analysis to get alias information CallGraph callGraph = new CallGraph(state); - OwnershipAnalysis oa = null;/*new OwnershipAnalysis(state, + OwnershipAnalysis oa = new OwnershipAnalysis(state, tu, callGraph, state.OWNERSHIPALLOCDEPTH, state.OWNERSHIPWRITEDOTS, state.OWNERSHIPWRITEALL, - state.OWNERSHIPALIASFILE);*/ + state.OWNERSHIPALIASFILE); // synthesis a layout according to target multicore processor MCImplSynthesis mcImplSynthesis = new MCImplSynthesis(state, @@ -280,10 +356,15 @@ public class Main { if(isDistributeInfo) { mcImplSynthesis.distribution(); } else { + //double timeStartAnalysis = (double) System.nanoTime(); mcImplSynthesis.setScheduleThreshold(20); mcImplSynthesis.setProbThreshold(0); mcImplSynthesis.setGenerateThreshold(30); Vector scheduling = mcImplSynthesis.synthesis(); + + //double timeEndAnalysis = (double) System.nanoTime(); + //double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) ); + //System.err.println("The analysis took" + dt + "sec."); // generate multicore codes if(state.MULTICORE) { @@ -302,16 +383,14 @@ public class Main { } } } - if(!state.MULTICORE) { - if (state.DSM) { + if (state.DSM||state.SINGLETM) { CallGraph callgraph=new CallGraph(state); if (state.PREFETCH) { //speed up prefetch generation using locality analysis results LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu); pa=new PrefetchAnalysis(state, callgraph, tu, la); } - LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu); GenerateConversions gc=new GenerateConversions(la, state); BuildCode bc=new BuildCode(state, bf.getMap(), tu, la, pa); @@ -322,25 +401,6 @@ public class Main { } } - if (state.FLATIRGRAPH) { - FlatIRGraph firg = new FlatIRGraph(state, - state.FLATIRGRAPHTASKS, - state.FLATIRGRAPHUSERMETHODS, - state.FLATIRGRAPHLIBMETHODS); - } - - if (state.OWNERSHIP) { - CallGraph callGraph = new CallGraph(state); - OwnershipAnalysis oa = new OwnershipAnalysis(state, - tu, - callGraph, - state.OWNERSHIPALLOCDEPTH, - state.OWNERSHIPWRITEDOTS, - state.OWNERSHIPWRITEALL, - state.OWNERSHIPALIASFILE); - } - - System.out.println("Lines="+state.lines); System.exit(0); } @@ -360,7 +420,7 @@ public class Main { g = new Parse.Parser(l); ParseNode p=null; try { - p=(ParseNode) g./*debug_*/ parse().value; + p=(ParseNode) g./*debug_*/parse().value; } catch (Exception e) { System.err.println("Error parsing file:"+sourcefile); e.printStackTrace();