bill 4 years ago
commit 090a658876

@ -805,9 +805,25 @@ public class CodeGenImpl extends CodeGenBase
sp_off -= 2; sp_off -= 2;
backend.emitADDI(SP, FP, -sp_off*wordSize, "restore sp"); backend.emitADDI(SP, FP, -sp_off*wordSize, "restore sp");
} }
else if(operator.equals("!="))
{
incSp(2);
backend.emitSW(node.left.dispatch(this), FP, (1 - sp_off) *wordSize, "Push argument 0 from last.");
backend.emitSW(node.right.dispatch(this), FP, ( - sp_off) *wordSize, "Push argument 1 from last.");
backend.emitADDI(SP, FP, -sp_off * wordSize, "Set SP to last argument.");
backend.emitJAL(strneqlLabel, "Invoke method:strneql");
sp_off -= 2;
backend.emitADDI(SP, FP, -sp_off*wordSize, "restore sp");
}
else if(operator.equals("+")) else if(operator.equals("+"))
{ {
incSp(2);
backend.emitSW(node.left.dispatch(this), FP, (1 - sp_off) *wordSize, "Push argument 0 from last.");
backend.emitSW(node.right.dispatch(this), FP, ( - sp_off) *wordSize, "Push argument 1 from last.");
backend.emitADDI(SP, FP, -sp_off * wordSize, "Set SP to last argument.");
backend.emitJAL(strcatLabel, "Invoke method:strcat");
sp_off -= 2;
backend.emitADDI(SP, FP, -sp_off*wordSize, "restore sp");
} }
else else
backend.emitJAL(errorNI, "Operator not implemented for String operands"); backend.emitJAL(errorNI, "Operator not implemented for String operands");

Loading…
Cancel
Save