-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrating SLIFO task in BuildzTranspilerFlowgraphTask, but it does …
…not influence CFG building yet
- Loading branch information
1 parent
62f5384
commit f891f00
Showing
5 changed files
with
70 additions
and
45 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
smojol-core/src/main/java/org/smojol/common/transpiler/TranspilerFlowgraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
package org.smojol.common.transpiler; | ||
|
||
import org.apache.commons.lang3.tuple.Pair; | ||
import org.jgrapht.Graph; | ||
import org.jgrapht.graph.DefaultEdge; | ||
import org.smojol.common.pseudocode.BasicBlock; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public record TranspilerFlowgraph(Graph<BasicBlock<TranspilerInstruction>, DefaultEdge> basicBlockFlowgraph, | ||
Graph<TranspilerInstruction, DefaultEdge> instructionFlowgraph, | ||
TranspilerNode transpilerTree, List<TranspilerInstruction> instructions, | ||
List<BasicBlock<TranspilerInstruction>> basicBlocks) { | ||
List<BasicBlock<TranspilerInstruction>> basicBlocks, | ||
Pair<Set<InvokingProcedureRange>, Set<InvokingProcedureRange>> categorisedRanges) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
...rg/smojol/toolkit/analysis/task/transpiler/BuildTranspilerInstructionsFromRawASTTask.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
smojol-toolkit/src/main/java/org/smojol/toolkit/examples/qa/SLIFORangeMainForQA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.smojol.toolkit.examples.qa; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import org.apache.commons.lang3.tuple.Pair; | ||
import org.smojol.common.dialect.LanguageDialect; | ||
import org.smojol.common.flowchart.FlowchartOutputFormat; | ||
import org.smojol.common.id.UUIDProvider; | ||
import org.smojol.common.resource.LocalFilesystemOperations; | ||
import org.smojol.common.transpiler.InvokingProcedureRange; | ||
import org.smojol.common.transpiler.TranspilerFlowgraph; | ||
import org.smojol.toolkit.analysis.pipeline.ProgramSearch; | ||
import org.smojol.toolkit.analysis.task.analysis.CodeTaskRunner; | ||
import org.smojol.toolkit.interpreter.FullProgram; | ||
import org.smojol.toolkit.interpreter.structure.OccursIgnoringFormat1DataStructureBuilder; | ||
import org.smojol.toolkit.task.AnalysisTaskResult; | ||
import org.smojol.toolkit.task.AnalysisTaskResultOK; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import static org.smojol.toolkit.task.CommandLineAnalysisTask.BUILD_BASE_ANALYSIS; | ||
import static org.smojol.toolkit.task.CommandLineAnalysisTask.BUILD_TRANSPILER_FLOWGRAPH; | ||
|
||
public class SLIFORangeMainForQA { | ||
public static void main(String[] args) throws IOException, InterruptedException { | ||
String programName = "test-irreducible-simplified.cbl"; | ||
UUIDProvider idProvider = new UUIDProvider(); | ||
Map<String, List<AnalysisTaskResult>> result = new CodeTaskRunner("/Users/asgupta/code/qa-codebase/Missing Programs", | ||
"/Users/asgupta/code/smojol/out/report", | ||
ImmutableList.of(new File("/Users/asgupta/code/qa-codebase/Missing Programs")), | ||
"/Users/asgupta/code/smojol/che-che4z-lsp-for-cobol-integration/server/dialect-idms/target/dialect-idms.jar", | ||
LanguageDialect.COBOL, new FullProgram(FlowchartOutputFormat.MERMAID, idProvider), idProvider, new OccursIgnoringFormat1DataStructureBuilder(), new ProgramSearch(), new LocalFilesystemOperations()) | ||
.runForPrograms(ImmutableList.of(BUILD_BASE_ANALYSIS, BUILD_TRANSPILER_FLOWGRAPH), ImmutableList.of(programName)); | ||
List<AnalysisTaskResult> results = result.get(programName); | ||
TranspilerFlowgraph transpilerFlowgraph = ((AnalysisTaskResultOK) results.get(1)).getDetail(); | ||
Pair<Set<InvokingProcedureRange>, Set<InvokingProcedureRange>> categorisedRanges = transpilerFlowgraph.categorisedRanges(); | ||
Set<InvokingProcedureRange> allSLIFORanges = categorisedRanges.getLeft(); | ||
System.out.println("SLIFO Ranges\n----------------------"); | ||
allSLIFORanges.forEach(range -> System.out.println(range.range())); | ||
Set<InvokingProcedureRange> nonSLIFORanges = categorisedRanges.getRight(); | ||
System.out.println("Non-SLIFO Ranges\n----------------------"); | ||
nonSLIFORanges.forEach(range -> System.out.println(range.range())); | ||
System.out.println("Total ranges = " + (categorisedRanges.getLeft().size() + categorisedRanges.getRight().size())); | ||
System.out.println("SLIFO ranges = " + allSLIFORanges.size()); | ||
System.out.println("Non-SLIFO ranges = " + nonSLIFORanges.size()); | ||
|
||
System.out.println("DONE"); | ||
} | ||
} |