mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- use the immediate versions for loading integer constants when possible.
This commit is contained in:
parent
77192fa9dd
commit
719be058e5
1 changed files with 19 additions and 3 deletions
|
@ -2304,14 +2304,29 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
||||||
ExpEmit pointer = Base->Emit(build);
|
ExpEmit pointer = Base->Emit(build);
|
||||||
Address = pointer;
|
Address = pointer;
|
||||||
|
|
||||||
ExpEmit result = Right->Emit(build);
|
ExpEmit result;
|
||||||
|
bool intconst = false;
|
||||||
|
int intconstval;
|
||||||
|
|
||||||
|
if (Right->isConstant() && Right->ValueType->GetRegType() == REGT_INT)
|
||||||
|
{
|
||||||
|
intconst = true;
|
||||||
|
intconstval = static_cast<FxConstant*>(Right)->GetValue().GetInt();
|
||||||
|
result.Konst = true;
|
||||||
|
result.RegType = REGT_INT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = Right->Emit(build);
|
||||||
|
}
|
||||||
assert(result.RegType <= REGT_TYPE);
|
assert(result.RegType <= REGT_TYPE);
|
||||||
|
|
||||||
if (pointer.Target)
|
if (pointer.Target)
|
||||||
{
|
{
|
||||||
if (result.Konst)
|
if (result.Konst)
|
||||||
{
|
{
|
||||||
build->Emit(loadops[result.RegType], pointer.RegNum, result.RegNum);
|
if (intconst) build->EmitLoadInt(pointer.RegNum, intconstval);
|
||||||
|
else build->Emit(loadops[result.RegType], pointer.RegNum, result.RegNum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2323,7 +2338,8 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
||||||
if (result.Konst)
|
if (result.Konst)
|
||||||
{
|
{
|
||||||
ExpEmit temp(build, result.RegType);
|
ExpEmit temp(build, result.RegType);
|
||||||
build->Emit(loadops[result.RegType], temp.RegNum, result.RegNum);
|
if (intconst) build->EmitLoadInt(temp.RegNum, intconstval);
|
||||||
|
else build->Emit(loadops[result.RegType], temp.RegNum, result.RegNum);
|
||||||
result.Free(build);
|
result.Free(build);
|
||||||
result = temp;
|
result = temp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue