libevmasm: generalize ADDPOP optimization into ADDMODPOP etc

This commit is contained in:
Yoichi Hirai 2016-11-24 18:21:57 +01:00
parent c0fe5fbe9b
commit b6ffb6c8b7
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -68,14 +68,15 @@ struct AddPop
{ {
Instruction i0 = _in[0].instruction(); Instruction i0 = _in[0].instruction();
if (instructionInfo(i0).ret == 1 && if (instructionInfo(i0).ret == 1 &&
instructionInfo(i0).args == 2 &&
!SemanticInformation::invalidatesMemory(i0) && !SemanticInformation::invalidatesMemory(i0) &&
!SemanticInformation::invalidatesStorage(i0) !SemanticInformation::invalidatesStorage(i0) &&
!SemanticInformation::altersControlFlow(i0) &&
!instructionInfo(i0).sideEffects
) )
{ {
*_out = Instruction::POP; for (int j = 0; j < instructionInfo(i0).args; j++)
*_out = Instruction::POP; *_out = Instruction::POP;
return true; return true;
} }
} }
return false; return false;