mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-21 14:30:21 +00:00
#815 working on moving control flow graphs into procedure compilation.
This commit is contained in:
parent
dfbeba7805
commit
40182a6ad6
@ -5,6 +5,7 @@ import dk.camelot64.kickc.model.iterator.ProgramValue;
|
||||
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
|
||||
import dk.camelot64.kickc.model.statements.*;
|
||||
import dk.camelot64.kickc.model.symbols.Label;
|
||||
import dk.camelot64.kickc.model.symbols.Procedure;
|
||||
import dk.camelot64.kickc.model.symbols.Scope;
|
||||
import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.values.*;
|
||||
@ -285,7 +286,15 @@ public class Unroller {
|
||||
// Create the new block
|
||||
LabelRef newBlockLabel = blocksOriginalToCopied.get(origBlock.getLabel());
|
||||
ControlFlowBlock newBlock = new ControlFlowBlock(newBlockLabel, origBlock.getScope());
|
||||
program.getGraph().addBlock(newBlock);
|
||||
|
||||
// Add the new graph to the appropriate procedure
|
||||
final Procedure containingProcedure = program.getScope().getSymbol(origBlock.getLabel()).getContainingProcedure();
|
||||
final ProcedureCompilation procedureCompilation = program.getProcedureCompilation(containingProcedure.getRef());
|
||||
final List<Graph.Block> procedureBlocks = new ArrayList<>(procedureCompilation.getGraph().getAllBlocks());
|
||||
procedureBlocks.add(newBlock);
|
||||
procedureCompilation.setGraph(new ControlFlowGraph(procedureBlocks));
|
||||
|
||||
|
||||
for(Statement origStatement : origBlock.getStatements()) {
|
||||
Statement newStatement = unrollStatement(origStatement, origBlock.getLabel());
|
||||
newBlock.addStatement(newStatement);
|
||||
|
Loading…
Reference in New Issue
Block a user