mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-06-02 18:01:38 +00:00
- fixed: RegAvailability never set the number of allocated registers to more than 32.
- fixed register allocation in ?: operator which was quite broken.
This commit is contained in:
parent
7da4e0d03d
commit
b206d19df4
3 changed files with 9 additions and 10 deletions
|
@ -850,7 +850,6 @@ set( NOT_COMPILED_SOURCE_FILES
|
||||||
sc_man_scanner.re
|
sc_man_scanner.re
|
||||||
g_doom/a_bossbrain.cpp
|
g_doom/a_bossbrain.cpp
|
||||||
g_doom/a_doomweaps.cpp
|
g_doom/a_doomweaps.cpp
|
||||||
g_doom/a_lostsoul.cpp
|
|
||||||
g_doom/a_painelemental.cpp
|
g_doom/a_painelemental.cpp
|
||||||
g_doom/a_revenant.cpp
|
g_doom/a_revenant.cpp
|
||||||
g_doom/a_scriptedmarine.cpp
|
g_doom/a_scriptedmarine.cpp
|
||||||
|
|
|
@ -4061,6 +4061,7 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build)
|
||||||
// Test condition.
|
// Test condition.
|
||||||
build->Emit(OP_EQ_K, 1, cond.RegNum, build->GetConstantInt(0));
|
build->Emit(OP_EQ_K, 1, cond.RegNum, build->GetConstantInt(0));
|
||||||
falsejump = build->Emit(OP_JMP, 0);
|
falsejump = build->Emit(OP_JMP, 0);
|
||||||
|
cond.Free(build);
|
||||||
|
|
||||||
// Evaluate true expression.
|
// Evaluate true expression.
|
||||||
if (truex->isConstant() && truex->ValueType->GetRegType() == REGT_INT)
|
if (truex->isConstant() && truex->ValueType->GetRegType() == REGT_INT)
|
||||||
|
@ -4073,6 +4074,7 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build)
|
||||||
ExpEmit trueop = truex->Emit(build);
|
ExpEmit trueop = truex->Emit(build);
|
||||||
if (trueop.Konst)
|
if (trueop.Konst)
|
||||||
{
|
{
|
||||||
|
trueop.Free(build);
|
||||||
if (trueop.RegType == REGT_FLOAT)
|
if (trueop.RegType == REGT_FLOAT)
|
||||||
{
|
{
|
||||||
out = ExpEmit(build, REGT_FLOAT);
|
out = ExpEmit(build, REGT_FLOAT);
|
||||||
|
@ -4113,20 +4115,18 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build)
|
||||||
{
|
{
|
||||||
if (falseop.RegType == REGT_FLOAT)
|
if (falseop.RegType == REGT_FLOAT)
|
||||||
{
|
{
|
||||||
out = ExpEmit(build, REGT_FLOAT);
|
|
||||||
build->Emit(OP_LKF, out.RegNum, falseop.RegNum);
|
build->Emit(OP_LKF, out.RegNum, falseop.RegNum);
|
||||||
}
|
}
|
||||||
else if (falseop.RegType == REGT_POINTER)
|
else if (falseop.RegType == REGT_POINTER)
|
||||||
{
|
{
|
||||||
out = ExpEmit(build, REGT_POINTER);
|
|
||||||
build->Emit(OP_LKP, out.RegNum, falseop.RegNum);
|
build->Emit(OP_LKP, out.RegNum, falseop.RegNum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(falseop.RegType == REGT_STRING);
|
assert(falseop.RegType == REGT_STRING);
|
||||||
out = ExpEmit(build, REGT_STRING);
|
|
||||||
build->Emit(OP_LKS, out.RegNum, falseop.RegNum);
|
build->Emit(OP_LKS, out.RegNum, falseop.RegNum);
|
||||||
}
|
}
|
||||||
|
falseop.Free(build);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,9 +362,9 @@ int VMFunctionBuilder::RegAvailability::Get(int count)
|
||||||
{
|
{
|
||||||
if (firstbit + count <= 32)
|
if (firstbit + count <= 32)
|
||||||
{ // Needed bits all fit in one word, so we got it.
|
{ // Needed bits all fit in one word, so we got it.
|
||||||
if (firstbit + count > MostUsed)
|
if (i * 32 + firstbit + count > MostUsed)
|
||||||
{
|
{
|
||||||
MostUsed = firstbit + count;
|
MostUsed = i * 32 + firstbit + count;
|
||||||
}
|
}
|
||||||
Used[i] |= mask << firstbit;
|
Used[i] |= mask << firstbit;
|
||||||
return i * 32 + firstbit;
|
return i * 32 + firstbit;
|
||||||
|
@ -374,9 +374,9 @@ int VMFunctionBuilder::RegAvailability::Get(int count)
|
||||||
{ // There is a next word.
|
{ // There is a next word.
|
||||||
if (((Used[i + 1]) & (mask >> (32 - firstbit))) == 0)
|
if (((Used[i + 1]) & (mask >> (32 - firstbit))) == 0)
|
||||||
{ // The next word has the needed open space, too.
|
{ // The next word has the needed open space, too.
|
||||||
if (firstbit + count > MostUsed)
|
if (i * 32 + firstbit + count > MostUsed)
|
||||||
{
|
{
|
||||||
MostUsed = firstbit + count;
|
MostUsed = i * 32 + firstbit + count;
|
||||||
}
|
}
|
||||||
Used[i] |= mask << firstbit;
|
Used[i] |= mask << firstbit;
|
||||||
Used[i + 1] |= mask >> (32 - firstbit);
|
Used[i + 1] |= mask >> (32 - firstbit);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue