Class OperatorMapper
- java.lang.Object
-
- com.tonic.analysis.source.recovery.OperatorMapper
-
public final class OperatorMapper extends Object
Maps IR operators to source-level operators.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetConversionTargetType(UnaryOp op)Gets the target type descriptor for a type conversion operator.static booleanisFloatComparison(BinaryOp op)Reports whether a binary operation is a float or double comparison.static booleanisLongComparison(BinaryOp op)Reports whether a binary operation is a long comparison.static booleanisNullCheck(CompareOp op)Reports whether a comparison tests a reference against null.static booleanisSingleOperandCheck(CompareOp op)Reports whether a comparison takes its second operand implicitly (zero or null).static booleanisTypeConversion(UnaryOp op)Reports whether a unary operator widens or narrows a primitive rather than computing a value.static BinaryOperatormapBinaryOp(BinaryOp op)Maps an IR binary operator to a source binary operator.static BinaryOperatormapCompareOp(CompareOp op)Maps an IR comparison operator to a source binary operator.static UnaryOperatormapUnaryOp(UnaryOp op)Maps an IR unary operator to a source unary operator, if applicable.
-
-
-
Method Detail
-
mapBinaryOp
public static BinaryOperator mapBinaryOp(BinaryOp op)
Maps an IR binary operator to a source binary operator.- Parameters:
op- the IR operator- Returns:
- the corresponding source operator
-
mapCompareOp
public static BinaryOperator mapCompareOp(CompareOp op)
Maps an IR comparison operator to a source binary operator.- Parameters:
op- the IR comparison operator- Returns:
- the corresponding source operator
-
isNullCheck
public static boolean isNullCheck(CompareOp op)
Reports whether a comparison tests a reference against null.- Parameters:
op- the comparison operator- Returns:
- true for IFNULL and IFNONNULL
-
isSingleOperandCheck
public static boolean isSingleOperandCheck(CompareOp op)
Reports whether a comparison takes its second operand implicitly (zero or null).- Parameters:
op- the comparison operator- Returns:
- true for the IFxx forms, false for the IF_ICMPxx and IF_ACMPxx forms
-
mapUnaryOp
public static UnaryOperator mapUnaryOp(UnaryOp op)
Maps an IR unary operator to a source unary operator, if applicable.- Parameters:
op- the IR operator- Returns:
- the corresponding source operator, or null for type conversions
-
isTypeConversion
public static boolean isTypeConversion(UnaryOp op)
Reports whether a unary operator widens or narrows a primitive rather than computing a value.- Parameters:
op- the unary operator- Returns:
- true for every operator except NEG
-
getConversionTargetType
public static String getConversionTargetType(UnaryOp op)
Gets the target type descriptor for a type conversion operator.- Parameters:
op- the conversion operator- Returns:
- the target type descriptor
-
isFloatComparison
public static boolean isFloatComparison(BinaryOp op)
Reports whether a binary operation is a float or double comparison.- Parameters:
op- the binary operator- Returns:
- true for FCMPL, FCMPG, DCMPL and DCMPG
-
isLongComparison
public static boolean isLongComparison(BinaryOp op)
Reports whether a binary operation is a long comparison.- Parameters:
op- the binary operator- Returns:
- true for LCMP
-
-