mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 13:01:19 +00:00
- changed a bunch of manual address additions in string opcodes to leas
This commit is contained in:
parent
3477b22714
commit
69bc39914b
3 changed files with 12 additions and 27 deletions
|
@ -265,8 +265,7 @@ void JitCompiler::Setup()
|
|||
FString regname;
|
||||
regname.Format("regS%d", i);
|
||||
regS[i] = cc.newIntPtr(regname.GetChars());
|
||||
cc.mov(regS[i], frameS);
|
||||
if (i != 0) cc.add(regS[i], (int)(i * sizeof(FString)));
|
||||
cc.lea(regS[i], x86::ptr(frameS, i * sizeof(FString)));
|
||||
}
|
||||
}
|
||||
if (sfunc->NumRegA > 0)
|
||||
|
|
|
@ -50,18 +50,16 @@ void JitCompiler::EmitLKF_R()
|
|||
|
||||
void JitCompiler::EmitLKS_R()
|
||||
{
|
||||
auto base = cc.newIntPtr();
|
||||
cc.mov(base, ToMemAddress(konsts + C));
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, ToMemAddress(konsts + C));
|
||||
auto offset = cc.newIntPtr();
|
||||
cc.mov(offset, regD[B]);
|
||||
#ifdef ASMJIT_ARCH_X64
|
||||
static_assert(sizeof(FString) == 8, "sizeof(FString) needs to be 8");
|
||||
cc.shl(offset, 3);
|
||||
cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 3));
|
||||
#else
|
||||
static_assert(sizeof(FString) == 4, "sizeof(FString) needs to be 4");
|
||||
cc.shl(offset, 2);
|
||||
cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 2));
|
||||
#endif
|
||||
cc.add(ptr, offset);
|
||||
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||
call->setArg(0, regS[A]);
|
||||
|
@ -213,8 +211,7 @@ void JitCompiler::EmitLS()
|
|||
{
|
||||
EmitNullPointerThrow(B, X_READ_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[B]);
|
||||
cc.add(ptr, konstd[C]);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[B], konstd[C]));
|
||||
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||
call->setArg(0, regS[A]);
|
||||
|
@ -225,10 +222,7 @@ void JitCompiler::EmitLS_R()
|
|||
{
|
||||
EmitNullPointerThrow(B, X_READ_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[B]);
|
||||
auto tmp = cc.newIntPtr();
|
||||
cc.mov(tmp, regD[C]);
|
||||
cc.add(ptr, tmp);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[B], regD[C]));
|
||||
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||
call->setArg(0, regS[A]);
|
||||
|
@ -327,8 +321,7 @@ void JitCompiler::EmitLCS()
|
|||
{
|
||||
EmitNullPointerThrow(B, X_READ_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[B]);
|
||||
cc.add(ptr, konstd[C]);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[B], konstd[C]));
|
||||
auto loadLambda = [](FString* to, char** from) -> void {
|
||||
*to = *from;
|
||||
};
|
||||
|
@ -342,10 +335,7 @@ void JitCompiler::EmitLCS_R()
|
|||
{
|
||||
EmitNullPointerThrow(B, X_READ_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[B]);
|
||||
auto tmp = cc.newIntPtr();
|
||||
cc.mov(tmp, regD[C]);
|
||||
cc.add(ptr, tmp);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[B], regD[C]));
|
||||
auto loadLambda = [](FString* to, char** from) -> void {
|
||||
*to = *from;
|
||||
};
|
||||
|
|
|
@ -65,22 +65,18 @@ void JitCompiler::EmitSS()
|
|||
{
|
||||
EmitNullPointerThrow(A, X_WRITE_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[A]);
|
||||
cc.add(ptr, konstd[C]);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[A], konstd[C]));
|
||||
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||
call->setArg(0, ptr);
|
||||
call->setArg(1, regS[B]);
|
||||
}
|
||||
|
||||
|
||||
void JitCompiler::EmitSS_R()
|
||||
{
|
||||
EmitNullPointerThrow(A, X_WRITE_NIL);
|
||||
auto ptr = cc.newIntPtr();
|
||||
cc.mov(ptr, regA[A]);
|
||||
auto tmp = cc.newIntPtr();
|
||||
cc.mov(tmp, regD[C]);
|
||||
cc.add(ptr, tmp);
|
||||
cc.lea(ptr, asmjit::x86::ptr(regA[A], regD[C]));
|
||||
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||
call->setArg(0, ptr);
|
||||
|
|
Loading…
Reference in a new issue