1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-02 07:49:37 +00:00

Working in classic structs. #197

This commit is contained in:
jespergravgaard 2021-07-25 22:30:22 +02:00
parent 6d39582e5f
commit 47d6ea3f9a
2 changed files with 17 additions and 10 deletions

View File

@ -553,6 +553,7 @@ public class Compiler {
private void pass3Analysis() { private void pass3Analysis() {
if(program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic()) { if(program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic()) {
new Pass1UnwindStructValues(program).execute();
new PassNStructUnwoundPlaceholderRemoval(program).execute(); new PassNStructUnwoundPlaceholderRemoval(program).execute();
} }

View File

@ -2,7 +2,10 @@ package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.*; import dk.camelot64.kickc.model.*;
import dk.camelot64.kickc.model.statements.*; import dk.camelot64.kickc.model.statements.*;
import dk.camelot64.kickc.model.symbols.*; import dk.camelot64.kickc.model.symbols.Procedure;
import dk.camelot64.kickc.model.symbols.ProgramScope;
import dk.camelot64.kickc.model.symbols.Scope;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.types.SymbolType; import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.types.SymbolTypeStruct; import dk.camelot64.kickc.model.types.SymbolTypeStruct;
import dk.camelot64.kickc.model.values.*; import dk.camelot64.kickc.model.values.*;
@ -117,7 +120,10 @@ public class Pass1CallPhiParameters {
LValue procReturnVarRef = null; LValue procReturnVarRef = null;
if(procReturnVar != null) { if(procReturnVar != null) {
procReturnVarRef = (LValue) procReturnVar.getRef(); procReturnVarRef = (LValue) procReturnVar.getRef();
// Special handing of struct value returns // Special handing of struct value returns
if(!program.getTargetPlatform().getVariableBuilderConfig().isStructModelClassic())
if(procReturnVar.getType() instanceof SymbolTypeStruct) { if(procReturnVar.getType() instanceof SymbolTypeStruct) {
StructVariableMemberUnwinding.VariableUnwinding returnVarUnwinding = program.getStructVariableMemberUnwinding().getVariableUnwinding((VariableRef) procReturnVarRef); StructVariableMemberUnwinding.VariableUnwinding returnVarUnwinding = program.getStructVariableMemberUnwinding().getVariableUnwinding((VariableRef) procReturnVarRef);
if(returnVarUnwinding != null) { if(returnVarUnwinding != null) {