I seem to relearn blr != return once every month or so.

This commit is contained in:
Ben Vanik
2014-02-02 14:35:16 -08:00
parent 2d65bea0ea
commit ef5f59ed0b
15 changed files with 67 additions and 13 deletions

View File

@@ -35,6 +35,7 @@ int InstrEmit_branch(
// be correct for returns.
if (lk) {
Value* return_address = f.LoadConstant(cia + 4);
f.SetReturnAddress(return_address);
f.StoreLR(return_address);
}
@@ -104,6 +105,10 @@ int InstrEmit_branch(
// // TODO(benvanik): evaluate hint here.
// c.je(e.GetReturnLabel(), kCondHintLikely);
//}
#if 0
// This breaks longjump, as that uses blr with a non-return lr.
// It'd be nice to move SET_RETURN_ADDRESS semantics up into context
// so that we can just use this.
if (!lk && nia_is_lr) {
// Return (most likely).
// TODO(benvanik): test? ReturnCheck()?
@@ -116,7 +121,14 @@ int InstrEmit_branch(
f.Return();
}
} else {
#else
{
#endif
// Jump to pointer.
bool likely_return = !lk && nia_is_lr;
if (likely_return) {
call_flags |= CALL_POSSIBLE_RETURN;
}
if (cond) {
if (!expect_true) {
cond = f.IsFalse(cond);