Class TypeConversion


  • public final class TypeConversion
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TypeConversion.ConstCast
      Constant operands casting types.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Node castConstants​(Node node)
      Casts constant sub-...operands of the specified node supposing that casting is unsigned.
      static Node castConstants​(Node node, java.lang.Enum<?> constCastKind)
      Casts constant sub-...operands of the specified node through the specified casting type.
      static Node castIntToBitVec​(Node node)
      Casts all sub-...operands of the Int type to BitVec of 32 length
      static Node castIntToBitVec​(Node node, java.lang.Integer intBitLength)
      Casts all sub-...operands of the Int type to BitVec of intBitLength length
      static Node coerce​(Node node, DataType type)
      Converts the specified node to the specified data type producing a new node.
      static Node coerce​(Node node, DataType type, java.lang.Enum<?> constCastType)
      Converts the specified node to the specified data type with some constant casting if needed.
      static java.math.BigInteger integerValue​(NodeValue value, boolean signed)
      Returns the integer value of the specified object (signed or unsigned).
      static boolean isIntegral​(DataType type)  
      static boolean isIntegral​(Node node)  
      static NodeValue valueOf​(java.math.BigInteger value, DataType type)
      Returns the value of the specified object that is casted to the specified type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • castConstants

        public static Node castConstants​(Node node,
                                         java.lang.Enum<?> constCastKind)
        Casts constant sub-...operands of the specified node through the specified casting type.
        Parameters:
        node - Node to be processed.
        constCastKind - Constant casting type descriptor (signed, unsigned, etc.).
        Returns:
        Node every constant sub-..node of that is casted to be a correct operand of related operation.
        Throws:
        java.lang.IllegalArgumentException - when node argument is null.
      • castConstants

        public static Node castConstants​(Node node)
        Casts constant sub-...operands of the specified node supposing that casting is unsigned.
        Parameters:
        node - Node to be processed.
        Returns:
        A new node, every constant sub-...operand of that is casted to be a correct operand of related operation.
      • castIntToBitVec

        public static Node castIntToBitVec​(Node node,
                                           java.lang.Integer intBitLength)
        Casts all sub-...operands of the Int type to BitVec of intBitLength length
        Parameters:
        node - Node to be processed.
        intBitLength - length of BitVectors that represent Int type
        Returns:
        Node every Int-oriented operations, Int variables and Int values sub-..node of that is casted to use BitVector
        Throws:
        java.lang.IllegalArgumentException - when node argument is null.
      • castIntToBitVec

        public static Node castIntToBitVec​(Node node)
        Casts all sub-...operands of the Int type to BitVec of 32 length
        Parameters:
        node - Node to be processed.
        Returns:
        Node every Int-oriented operations, Int variables and Int values * sub-..node of that is casted to use BitVector
      • coerce

        public static Node coerce​(Node node,
                                  DataType type)
        Converts the specified node to the specified data type producing a new node.
        Parameters:
        node - Node to be converted.
        type - Data type of the new node to be produced.
        Returns:
        A new node that has the specified data type but the rest of it's data are taken from the specified node.
      • coerce

        public static Node coerce​(Node node,
                                  DataType type,
                                  java.lang.Enum<?> constCastType)
        Converts the specified node to the specified data type with some constant casting if needed.

        If the specified node has the same data type as specified, no constant casting is applied.

        Parameters:
        node - Node to be converted.
        type - Data type of the new node to be produced.
        constCastType - Constant operands casting mode.
        Returns:
        A new node that has the specified data type but the rest of it's data are taken from the specified node. Constant sub-...operands are casted in correspondence with the specified mode.
        Throws:
        java.lang.IllegalArgumentException - when either node or data type argument is null.
      • valueOf

        public static NodeValue valueOf​(java.math.BigInteger value,
                                        DataType type)
        Returns the value of the specified object that is casted to the specified type.
        Parameters:
        value - The object that value is used.
        type - The target value type.
        Returns:
        The value of the specified object that is casted to the specified type.
      • integerValue

        public static java.math.BigInteger integerValue​(NodeValue value,
                                                        boolean signed)
        Returns the integer value of the specified object (signed or unsigned).
        Parameters:
        value - The object that value is used.
        signed - The signed flag.
        Returns:
        The integer value of the specified object (signed or unsigned).
      • isIntegral

        public static boolean isIntegral​(Node node)
      • isIntegral

        public static boolean isIntegral​(DataType type)