use of de.mirkosertic.bytecoder.ssa.PHIExpression in project Bytecoder by mirkosertic.
the class WASMSSAWriter method writeInitVariableExpression.
private void writeInitVariableExpression(VariableAssignmentExpression aExpression) {
Variable theVariable = aExpression.getVariable();
Value theNewValue = aExpression.getValue();
if (theNewValue instanceof PHIExpression) {
return;
}
if (isStackVariable(theVariable)) {
switch(theVariable.resolveType().resolve()) {
case DOUBLE:
case FLOAT:
{
print("(f32.store offset=");
break;
}
case UNKNOWN:
throw new IllegalStateException();
default:
{
print("(i32.store offset=");
break;
}
}
print(stackOffsetFor(theVariable));
println(" (get_local $SP)");
WASMSSAWriter theChild = withDeeperIndent();
theChild.writeValue(theNewValue);
println();
println(")");
} else {
println(";; setting local variable with type " + theVariable.resolveType().resolve() + " with value of type " + theNewValue.resolveType().resolve());
print("(set_local $");
print(theVariable.getName());
println();
WASMSSAWriter theChild = withDeeperIndent();
theChild.writeValue(theNewValue);
println();
println(")");
}
}
Aggregations