master
bill 4 years ago
parent a7e34238a2
commit 3b92cea6c2

@ -724,7 +724,13 @@ public class CodeGenImpl extends CodeGenBase
}
else if(node.left.getInferredType().equals(Type.STR_TYPE) && node.right.getInferredType().equals(Type.STR_TYPE))
{
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(streqlLablel, "Invoke method:streql");
sp_off -= 2;
backend.emitADDI(SP, FP, -sp_off*wordSize, "restore sp");
}
else
{
@ -755,7 +761,7 @@ public class CodeGenImpl extends CodeGenBase
@Override
public Register analyze(Identifier node)
{
backend.emitLW(T6, FP, 0, "Inside Identifier: ");
backend.emitLW(T6, FP, 0, "Inside Identifier: ");
if (sym.getParent() == null)
{
GlobalVarInfo gvi=(GlobalVarInfo) sym.get(node.name);
@ -768,7 +774,7 @@ public class CodeGenImpl extends CodeGenBase
// int loc = offsetMap.get(svi);
// backend.emitLW(Register.A0, Register.FP, -loc*4, "Load local variable: "+svi.getVarName());
}
return null;
return A0;
}
@Override

Loading…
Cancel
Save