Return address handling. Not happy with the design, but it (sorta) works.

This commit is contained in:
Ben Vanik
2013-12-08 13:58:57 -08:00
parent dc0848f7ba
commit 2549292a57
13 changed files with 60 additions and 22 deletions

View File

@@ -32,10 +32,12 @@ int InstrEmit_branch(
// The docs say always, though...
// Note that we do the update before we branch/call as we need it to
// be correct for returns.
Value* return_address = f.LoadConstant(cia + 4);
f.SetReturnAddress(return_address);
if (lk) {
f.StoreLR(f.LoadConstant(cia + 4));
f.StoreLR(return_address);
}
if (!lk) {
// If LR is not set this call will never return here.
call_flags |= CALL_TAIL;
@@ -301,8 +303,8 @@ XEEMITTER(bclrx, 0x4C000020, XL )(PPCFunctionBuilder& f, InstrData& i) {
if (!i.XL.LK && !ok) {
// Return (most likely).
// TODO(benvanik): test? ReturnCheck()?
f.Return();
return 0;
//f.Return();
//return 0;
}
return InstrEmit_branch(