mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
Added EmitParamInt to VMFunctionBuilder
This commit is contained in:
parent
57bb9c2f7a
commit
0603295822
2 changed files with 23 additions and 0 deletions
|
@ -468,6 +468,28 @@ size_t VMFunctionBuilder::Emit(int opcode, int opabc)
|
||||||
return Code.Push(op);
|
return Code.Push(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// VMFunctionBuilder :: EmitParamInt
|
||||||
|
//
|
||||||
|
// Passes a constant integer parameter, using either PARAMI and an immediate
|
||||||
|
// value or PARAM and a constant register, as appropriate.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
size_t VMFunctionBuilder::EmitParamInt(int value)
|
||||||
|
{
|
||||||
|
// Immediates for PARAMI must fit in 24 bits.
|
||||||
|
if (((value << 8) >> 8) == value)
|
||||||
|
{
|
||||||
|
return Emit(OP_PARAMI, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Emit(OP_PARAM, 0, REGT_INT | REGT_KONST, GetConstantInt(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// VMFunctionBuilder :: EmitLoadInt
|
// VMFunctionBuilder :: EmitLoadInt
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
size_t Emit(int opcode, int opa, int opb, int opc);
|
size_t Emit(int opcode, int opa, int opb, int opc);
|
||||||
size_t Emit(int opcode, int opa, VM_SHALF opbc);
|
size_t Emit(int opcode, int opa, VM_SHALF opbc);
|
||||||
size_t Emit(int opcode, int opabc);
|
size_t Emit(int opcode, int opabc);
|
||||||
|
size_t EmitParamInt(int value);
|
||||||
size_t EmitLoadInt(int regnum, int value);
|
size_t EmitLoadInt(int regnum, int value);
|
||||||
size_t EmitRetInt(int retnum, bool final, int value);
|
size_t EmitRetInt(int retnum, bool final, int value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue