mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-07 23:18:10 +01:00
Optimization: Make SVC use RSB
This commit is contained in:
parent
6c45619aa1
commit
7d7ac0af71
8 changed files with 30 additions and 7 deletions
|
|
@ -166,6 +166,7 @@ struct LinkBlockFast {
|
|||
struct PopRSBHint {};
|
||||
|
||||
struct If;
|
||||
struct CheckHalt;
|
||||
/// A Terminal is the terminal instruction in a MicroBlock.
|
||||
using Terminal = boost::variant<
|
||||
Invalid,
|
||||
|
|
@ -174,7 +175,8 @@ using Terminal = boost::variant<
|
|||
LinkBlock,
|
||||
LinkBlockFast,
|
||||
PopRSBHint,
|
||||
boost::recursive_wrapper<If>
|
||||
boost::recursive_wrapper<If>,
|
||||
boost::recursive_wrapper<CheckHalt>
|
||||
>;
|
||||
|
||||
/**
|
||||
|
|
@ -188,6 +190,15 @@ struct If {
|
|||
Terminal else_;
|
||||
};
|
||||
|
||||
/**
|
||||
* This terminal instruction checks if a halt was requested. If it wasn't, else_ is
|
||||
* executed.
|
||||
*/
|
||||
struct CheckHalt {
|
||||
CheckHalt(Terminal else_) : else_(else_) {}
|
||||
Terminal else_;
|
||||
};
|
||||
|
||||
} // namespace Term
|
||||
|
||||
using Term::Terminal;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@ bool ArmTranslatorVisitor::arm_SVC(Cond cond, Imm24 imm24) {
|
|||
u32 imm32 = imm24;
|
||||
// SVC<c> #<imm24>
|
||||
if (ConditionPassed(cond)) {
|
||||
ir.PushRSB(ir.current_location.AdvancePC(4));
|
||||
ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 4));
|
||||
ir.CallSupervisor(ir.Imm32(imm32));
|
||||
ir.SetTerm(IR::Term::ReturnToDispatch{});
|
||||
ir.SetTerm(IR::Term::CheckHalt{IR::Term::PopRSBHint{}});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -773,8 +773,9 @@ struct ThumbTranslatorVisitor final {
|
|||
u32 imm32 = imm8;
|
||||
// SVC #<imm8>
|
||||
ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 2));
|
||||
ir.PushRSB(ir.current_location.AdvancePC(2));
|
||||
ir.CallSupervisor(ir.Imm32(imm32));
|
||||
ir.SetTerm(IR::Term::ReturnToDispatch{});
|
||||
ir.SetTerm(IR::Term::CheckHalt{IR::Term::PopRSBHint{}});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue