mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-26 12:49:21 +00:00
Working on catching all declared constants in parse 0. Added hacky handing of phi master.
This commit is contained in:
parent
5b0022a096
commit
9403fe34c8
@ -8,10 +8,12 @@ import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
||||
import dk.camelot64.kickc.model.statements.StatementLValue;
|
||||
import dk.camelot64.kickc.model.symbols.Symbol;
|
||||
import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypePointer;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeStruct;
|
||||
import dk.camelot64.kickc.model.values.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
@ -70,7 +72,18 @@ public class PassNStructAddressOfRewriting extends Pass2SsaOptimization {
|
||||
}
|
||||
|
||||
private RValue rewriteStructAddressOf(VariableRef toSymbol) {
|
||||
StatementLValue toSymbolAssignment = getGraph().getAssignment(toSymbol);
|
||||
Variable variable = getScope().getVariable(toSymbol);
|
||||
// Hacky way to handle PHI-masters
|
||||
if(variable.isKindPhiMaster()) {
|
||||
Collection<Variable> versions = variable.getScope().getVersions(variable);
|
||||
for(Variable version : versions) {
|
||||
if(variable.isVariable())
|
||||
variable = version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StatementLValue toSymbolAssignment = getGraph().getAssignment(variable.getVariableRef());
|
||||
if(toSymbolAssignment instanceof StatementAssignment) {
|
||||
StatementAssignment assignment = (StatementAssignment) toSymbolAssignment;
|
||||
if(assignment.getrValue2() instanceof StructUnwoundPlaceholder) {
|
||||
|
Loading…
Reference in New Issue
Block a user