mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 16:00:44 +02:00
OpcodeDispatcher: Optimize calls with push
InstCountCI doesn't cover branch instructions so needs manual inspection.
This commit is contained in:
1 parent
d738538a34
commit
b20c518bf0
1 file changed
+4
-9
@@ -789,17 +789,14 @@ void OpDispatchBuilder::CALLOp(OpcodeArgs) {
|
||||
OrderedNode *JMPPCOffset = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags, -1);
|
||||
|
||||
OrderedNode *NewRIP = _Add(IR::SizeToOpSize(GPRSize), ConstantPC, JMPPCOffset);
|
||||
auto ConstantPCReturn = GetRelocatedPC(Op);
|
||||
|
||||
auto ConstantSize = _Constant(GPRSize);
|
||||
// Push the return address.
|
||||
auto OldSP = LoadGPRRegister(X86State::REG_RSP);
|
||||
auto NewSP = _Sub(OpSize::i64Bit, OldSP, ConstantSize);
|
||||
auto NewSP = _Push(GPRSize, GPRSize, ConstantPC, OldSP);
|
||||
|
||||
// Store the new stack pointer
|
||||
StoreGPRRegister(X86State::REG_RSP, NewSP);
|
||||
|
||||
_StoreMem(GPRClass, GPRSize, NewSP, ConstantPCReturn, GPRSize);
|
||||
|
||||
const uint64_t NextRIP = Op->PC + Op->InstSize;
|
||||
LOGMAN_THROW_A_FMT(Op->Src[0].IsLiteral(), "Had wrong operand type");
|
||||
const uint64_t TargetRIP = Op->PC + Op->InstSize + Op->Src[0].Data.Literal.Value;
|
||||
@@ -825,15 +822,13 @@ void OpDispatchBuilder::CALLAbsoluteOp(OpcodeArgs) {
|
||||
|
||||
auto ConstantPCReturn = GetRelocatedPC(Op);
|
||||
|
||||
auto ConstantSize = _Constant(Size);
|
||||
// Push the return address.
|
||||
auto OldSP = LoadGPRRegister(X86State::REG_RSP);
|
||||
auto NewSP = _Sub(OpSize::i64Bit, OldSP, ConstantSize);
|
||||
auto NewSP = _Push(Size, Size, ConstantPCReturn, OldSP);
|
||||
|
||||
// Store the new stack pointer
|
||||
StoreGPRRegister(X86State::REG_RSP, NewSP);
|
||||
|
||||
_StoreMem(GPRClass, Size, NewSP, ConstantPCReturn, Size);
|
||||
|
||||
// Store the RIP
|
||||
CalculateDeferredFlags();
|
||||
_ExitFunction(JMPPCOffset); // If we get here then leave the function now
|
||||
|
||||
Reference in new issue
Block a user