Skip to content
Snippets Groups Projects
Verified Commit b2323713 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

FINAL

parent 0685fda6
No related branches found
No related tags found
No related merge requests found
Pipeline #396 passed with warnings with stages
in 17 minutes and 56 seconds
......@@ -183,8 +183,6 @@ public class CodeGenImpl extends CodeGenBase {
emitPush(tmpReg, null);
backend.emitMV(tmpReg, SP, "Return STR OBJ address.");
}
}
// Every function needs a register manager.
......@@ -466,13 +464,8 @@ public class CodeGenImpl extends CodeGenBase {
epilogue = generateLocalLabel();
}
// FIXME: Example of statement.
@Override
public RiscVBackend.Register analyze(ReturnStmt node) {
// FIXME: Here, we emit an instruction that does nothing. Clearly,
// this is wrong, and you'll have to fix it.
// This is here just to demonstrate how to emit a
// RISC-V instruction.
RiscVBackend.Register returnValReg = node.value.dispatch(this);
if (returnValReg == null)
return null;
......@@ -505,7 +498,8 @@ public class CodeGenImpl extends CodeGenBase {
@Override
public RiscVBackend.Register analyze(ExprStmt node) {
node.expr.dispatch(this);
RiscVBackend.Register ret = node.expr.dispatch(this);
regMgr.returnOne(ret);
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment