1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00

Working in classic structs. #197

This commit is contained in:
jespergravgaard 2021-07-25 22:06:49 +02:00
parent 08bb1aa9a0
commit 6d39582e5f
2 changed files with 19 additions and 8 deletions

View File

@ -248,9 +248,11 @@ public class Compiler {
new PassNAssertTypeMatch(program).check(); new PassNAssertTypeMatch(program).check();
new Pass1UnwindStructPrepare(program).execute(); if(!program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic()) {
new Pass1UnwindStructVariables(program).execute(); new Pass1UnwindStructPrepare(program).execute();
new Pass1UnwindStructValues(program).execute(); new Pass1UnwindStructVariables(program).execute();
new Pass1UnwindStructValues(program).execute();
}
if(getLog().isVerbosePass1CreateSsa()) { if(getLog().isVerbosePass1CreateSsa()) {
getLog().append("CONTROL FLOW GRAPH AFTER UNWIND"); getLog().append("CONTROL FLOW GRAPH AFTER UNWIND");
@ -312,10 +314,9 @@ public class Compiler {
new Pass1CallPhiReturn(program).execute(); new Pass1CallPhiReturn(program).execute();
new PassNUnwindLValueLists(program).execute(); new PassNUnwindLValueLists(program).execute();
new Pass1UnwindStructValues(program).execute(); if(!program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic()) {
new PassNStructUnwoundPlaceholderRemoval(program).execute(); new PassNStructUnwoundPlaceholderRemoval(program).execute();
}
getLog().append("\nCONTROL FLOW GRAPH SSA"); getLog().append("\nCONTROL FLOW GRAPH SSA");
getLog().append(program.getGraph().toString(program)); getLog().append(program.getGraph().toString(program));
@ -379,7 +380,6 @@ public class Compiler {
optimizations.add(new Pass2ConditionalJumpSimplification(program)); optimizations.add(new Pass2ConditionalJumpSimplification(program));
optimizations.add(new Pass2ConditionalAndOrRewriting(program)); optimizations.add(new Pass2ConditionalAndOrRewriting(program));
optimizations.add(new PassNAddBooleanCasts(program, false)); optimizations.add(new PassNAddBooleanCasts(program, false));
optimizations.add(new PassNStructUnwoundPlaceholderRemoval(program));
optimizations.add(new PassNArrayElementAddressOfRewriting(program)); optimizations.add(new PassNArrayElementAddressOfRewriting(program));
optimizations.add(new Pass2ConditionalJumpSequenceImprovement(program)); optimizations.add(new Pass2ConditionalJumpSequenceImprovement(program));
optimizations.add(new Pass2ConstantRValueConsolidation(program)); optimizations.add(new Pass2ConstantRValueConsolidation(program));
@ -552,6 +552,10 @@ public class Compiler {
private void pass3Analysis() { private void pass3Analysis() {
if(program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic()) {
new PassNStructUnwoundPlaceholderRemoval(program).execute();
}
if(getLog().isVerboseSizeInfo()) { if(getLog().isVerboseSizeInfo()) {
getLog().append(program.getSizeInfo()); getLog().append(program.getSizeInfo());
} }

View File

@ -294,6 +294,13 @@ public class Pass1UnwindStructValues extends Pass1Base {
program.getLog().append("Adding value simple copy " + copyStmt.toString(program, false)); program.getLog().append("Adding value simple copy " + copyStmt.toString(program, false));
return true; return true;
} else if(lValueSource.isBulkCopyable() && rValueSource.isBulkCopyable()) { } else if(lValueSource.isBulkCopyable() && rValueSource.isBulkCopyable()) {
/* TODO: Attempt to mix struct mode classic with unwinding
if(lValueSource instanceof ValueSourceVariable && rValueSource instanceof ValueSourceVariable)
if(((ValueSourceVariable) lValueSource).getVariable().isStructClassic() && ((ValueSourceVariable) rValueSource).getVariable().isStructClassic())
return false;
*/
// Use bulk unwinding for a struct member that is an array // Use bulk unwinding for a struct member that is an array
stmtIt.previous(); stmtIt.previous();
if(lValueSource.getArraySpec() != null) if(lValueSource.getArraySpec() != null)