Commit 1b1bca9a authored by Alexandru Dura's avatar Alexandru Dura
Browse files

Print source location for ret IR instructions

parent 8ec98cef
......@@ -465,7 +465,9 @@ aspect IRGen {
// copy this to the return value
ctx.addInsn(new IRCopyInsn(new IRVarRef(ctx.getReturnVar()), retVal));
IRCodeBB currentBB = ctx.getCurrentBB();
currentBB.setIRCodeExit(new IRReturn(new IRVarRef(ctx.getReturnVar())));
IRReturn ret = new IRReturn(new IRVarRef(ctx.getReturnVar()));
ret.setSourceLocation(sourceLocation());
currentBB.setIRCodeExit(ret);
// ctx will auto-start a new basic block to hold the translation
// of any (unreachable) statements following the return if needed.
ctx.endBB();
......
......@@ -131,6 +131,11 @@ aspect IRPrint {
public void IRReturn.print(PrintStream out) {
out.print("ret ");
getIRVarRef().print(out);
if (IRProgram.printSourceLocations) {
out.print("\t");
getSourceLocation().print(out);
}
}
public void IRJump.print(PrintStream out) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment