Open xiacijie opened 3 years ago
@xiacijie if there is a need to implement additional operations on the VP constraints then a motivation and contributions will be welcome. Note that the constraints you mentioned are actually abstract types and each has a Const and Range derived type representing a single value and a range of values. If any of these APIs are added to the root class they would need support to be added on the two derived classes since the behavior will be different. Note that supporting some may become quite tricky due to having to consider potential overflow conditions and the various combinations of ranges and consts.
Do you have a particular use case in mind that requires all of these operations?
@andrewcraik The current use case of VPConstraint
is doing abstract interpretation for java bytecode. Abstract interpretation produces abstract values. So TR::VPConstraint
is used as constraints for those abstract values. For example, when encountering an iconst1
, we create an abstract value with constraint VPIntConst(1)
. For other byte code such as ineg
, a negation of the constraint is required. imul
,idiv
requires performing multiplication and divisions on the constraints.
For a VPConst constraint you can do the operation on the constant and then create a new VPConst even without implementing it on the constraint. Doing it on a range can be more tricky - we could if it was sufficiently useful.
Hello,
The currently available arithmetic operations for those constraints are only
add
andsubtract
. I am thinking is it possible or will it be necessary to extend the operations to include operations such asnegation
,shift
,multiply
,division
,rem
,convertion
and other possible operations? @andrewcraik @0xdarylThanks