VarAction2: Detect and replace operations which always produce 0

This commit is contained in:
Jonathan G Rennison
2022-05-25 20:04:36 +01:00
parent a21ae12c90
commit 3b5eede3fc
2 changed files with 47 additions and 0 deletions

View File

@@ -186,6 +186,32 @@ inline bool IsEvalAdjustWithZeroRemovable(DeterministicSpriteGroupAdjustOperatio
}
}
inline bool IsEvalAdjustWithZeroAlwaysZero(DeterministicSpriteGroupAdjustOperation op)
{
switch (op) {
case DSGA_OP_UMIN:
case DSGA_OP_MUL:
case DSGA_OP_AND:
case DSGA_OP_RST:
return true;
default:
return false;
}
}
inline bool IsEvalAdjustWithSideEffects(DeterministicSpriteGroupAdjustOperation op)
{
switch (op) {
case DSGA_OP_STO:
case DSGA_OP_STOP:
return true;
default:
return false;
}
}
inline bool IsEvalAdjustUsableForConstantPropagation(DeterministicSpriteGroupAdjustOperation op)
{
switch (op) {