|
|
@ -718,13 +718,13 @@ public class CodeGenImpl extends CodeGenBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Label startLoop = generateLocalLabel();
|
|
|
|
Label startLoop = generateLocalLabel();
|
|
|
|
backend.emitLocalLabel(startLoop, "Beginning of while loop");
|
|
|
|
backend.emitLocalLabel(startLoop, "Beginning of while loop");
|
|
|
|
node.condition.dispatch(this);
|
|
|
|
Register result = node.condition.dispatch(this);
|
|
|
|
Label endLoop = elseBlock;
|
|
|
|
Label endLoop = elseBlock;
|
|
|
|
|
|
|
|
backend.emitBEQZ(result, endLoop,"Jump to beginning of loop");
|
|
|
|
for(Stmt stmt:node.body)
|
|
|
|
for(Stmt stmt:node.body)
|
|
|
|
stmt.dispatch(this);
|
|
|
|
stmt.dispatch(this);
|
|
|
|
backend.emitJ(startLoop, "Jump to beginning of loop");
|
|
|
|
backend.emitJ(startLoop, "Jump to beginning of loop");
|
|
|
|
backend.emitLocalLabel(endLoop, "End of while loop");
|
|
|
|
backend.emitLocalLabel(endLoop, "End of while loop");
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|