scale.common
Class Lattice

java.lang.Object
  extended by scale.common.Lattice

public class Lattice
extends java.lang.Object

This class performs lattice arithmetic operations on values wrapped as objects.

$Id: Lattice.java,v 1.52 2007-10-04 19:58:10 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

All the methods are static. This class implements Lattice operations using unique objects as the top and bottom values.


Field Summary
static Literal Bot
          The bottom lattice value.
static Literal Top
          The top lattice value.
 
Method Summary
static Literal abs(Type type, Literal la)
           
static Literal acos(Type type, Literal la)
           
static Literal add(Type type, Literal la, Literal ra)
           
static Literal andCond(Type type, Literal la, Literal ra)
           
static Literal asin(Type type, Literal la)
           
static Literal atan(Type type, Literal la)
           
static Literal atan2(Type type, Literal la, Literal ra)
           
static Literal bitAnd(Type type, Literal la, Literal ra)
           
static Literal bitComplement(Type type, Literal la)
           
static Literal bitOr(Type type, Literal la, Literal ra)
           
static Literal bitXor(Type type, Literal la, Literal ra)
           
static Literal compare(Type type, Literal la, Literal ra)
           
static Literal conjg(Type type, Literal la)
           
static boolean convertToBooleanValue(Literal v)
          Return the boolean value of the object.
static double convertToDoubleValue(Literal v)
          Return the floating point value of the object.
static long convertToLongValue(Literal v)
          Return the integer value of the object.
static Literal cos(Type type, Literal la)
           
static Literal cosh(Type type, Literal la)
           
static Literal dim(Type type, Literal la, Literal ra)
           
static Literal divide(Type type, Literal la, Literal ra)
           
static Literal equal(Type type, Literal la, Literal ra)
           
static Literal exp(Type type, Literal la)
           
static Literal greater(Type type, Literal la, Literal ra)
           
static Literal greaterEqual(Type type, Literal la, Literal ra)
           
static Literal greaterEqualUnsigned(Type type, Literal la, Literal ra)
           
static Literal greaterUnsigned(Type type, Literal la, Literal ra)
           
static boolean isNonZero(Literal la)
          Return true if the value of the argument is zero.
static boolean isZero(Literal la)
          Return true if the value of the argument is zero.
static Literal less(Type type, Literal la, Literal ra)
           
static Literal lessEqual(Type type, Literal la, Literal ra)
           
static Literal lessEqualUnsigned(Type type, Literal la, Literal ra)
           
static Literal lessUnsigned(Type type, Literal la, Literal ra)
           
static Literal log(Type type, Literal la)
           
static Literal log10(Type type, Literal la)
           
static Literal maximum(Type type, Literal la, Literal ra)
           
static Literal meet(Literal X, Literal Y)
          Combine two Lattice values to obtain a new Lattice value.
static Literal minimum(Type type, Literal la, Literal ra)
           
static Literal multiply(Type type, Literal la, Literal ra)
           
static Literal negate(Type type, Literal la)
           
static Literal not(Type type, Literal la)
           
static Literal notEqual(Type type, Literal la, Literal ra)
           
static Literal orCond(Type type, Literal la, Literal ra)
           
static Literal power(Type type, Literal la, Literal ra)
           
static int powerOf2(long value)
          Return x in (value = 2**x) or -1 if value is zero, negative or not a power of two.
static Literal remainder(Type type, Literal la, Literal ra)
           
static Literal shiftLeft(Type type, Literal la, Literal ra)
           
static Literal shiftSignedRight(Type type, Literal la, Literal ra)
           
static Literal shiftUnsignedRight(Type type, Literal la, Literal ra)
           
static Literal sign(Type type, Literal la, Literal ra)
           
static Literal sin(Type type, Literal la)
           
static Literal sinh(Type type, Literal la)
           
static Literal sqrt(Type type, Literal la)
           
static Literal stringCat(Type type, Literal la, Literal ra)
           
static Literal subtract(Type type, Literal la, Literal ra)
           
static Literal tan(Type type, Literal la)
           
static Literal tanh(Type type, Literal la)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Top

public static final Literal Top
The top lattice value.


Bot

public static final Literal Bot
The bottom lattice value.

Method Detail

meet

public static Literal meet(Literal X,
                           Literal Y)
Combine two Lattice values to obtain a new Lattice value.
anymeettop=any
anymeetunknown=unknown
XmeetY=Xif X == Y
XmeetY=unknownif X != Y


convertToLongValue

public static long convertToLongValue(Literal v)
                               throws InvalidException
Return the integer value of the object.

Throws:
InvalidException - if the object is not recognized.

convertToDoubleValue

public static double convertToDoubleValue(Literal v)
                                   throws InvalidException
Return the floating point value of the object.

Throws:
InvalidException - if the object is not recognized.

convertToBooleanValue

public static boolean convertToBooleanValue(Literal v)
                                     throws InvalidException
Return the boolean value of the object.

Throws:
InvalidException - if the object is not recognized.

add

public static Literal add(Type type,
                          Literal la,
                          Literal ra)

subtract

public static Literal subtract(Type type,
                               Literal la,
                               Literal ra)

divide

public static Literal divide(Type type,
                             Literal la,
                             Literal ra)

multiply

public static Literal multiply(Type type,
                               Literal la,
                               Literal ra)

remainder

public static Literal remainder(Type type,
                                Literal la,
                                Literal ra)

abs

public static Literal abs(Type type,
                          Literal la)

negate

public static Literal negate(Type type,
                             Literal la)

bitComplement

public static Literal bitComplement(Type type,
                                    Literal la)

bitAnd

public static Literal bitAnd(Type type,
                             Literal la,
                             Literal ra)

bitOr

public static Literal bitOr(Type type,
                            Literal la,
                            Literal ra)

bitXor

public static Literal bitXor(Type type,
                             Literal la,
                             Literal ra)

not

public static Literal not(Type type,
                          Literal la)

andCond

public static Literal andCond(Type type,
                              Literal la,
                              Literal ra)

orCond

public static Literal orCond(Type type,
                             Literal la,
                             Literal ra)

equal

public static Literal equal(Type type,
                            Literal la,
                            Literal ra)

isZero

public static boolean isZero(Literal la)
Return true if the value of the argument is zero.


isNonZero

public static boolean isNonZero(Literal la)
Return true if the value of the argument is zero.


notEqual

public static Literal notEqual(Type type,
                               Literal la,
                               Literal ra)

less

public static Literal less(Type type,
                           Literal la,
                           Literal ra)

lessUnsigned

public static Literal lessUnsigned(Type type,
                                   Literal la,
                                   Literal ra)

lessEqual

public static Literal lessEqual(Type type,
                                Literal la,
                                Literal ra)

lessEqualUnsigned

public static Literal lessEqualUnsigned(Type type,
                                        Literal la,
                                        Literal ra)

greater

public static Literal greater(Type type,
                              Literal la,
                              Literal ra)

greaterUnsigned

public static Literal greaterUnsigned(Type type,
                                      Literal la,
                                      Literal ra)

greaterEqual

public static Literal greaterEqual(Type type,
                                   Literal la,
                                   Literal ra)

greaterEqualUnsigned

public static Literal greaterEqualUnsigned(Type type,
                                           Literal la,
                                           Literal ra)

compare

public static Literal compare(Type type,
                              Literal la,
                              Literal ra)

minimum

public static Literal minimum(Type type,
                              Literal la,
                              Literal ra)

maximum

public static Literal maximum(Type type,
                              Literal la,
                              Literal ra)

shiftLeft

public static Literal shiftLeft(Type type,
                                Literal la,
                                Literal ra)

shiftSignedRight

public static Literal shiftSignedRight(Type type,
                                       Literal la,
                                       Literal ra)

shiftUnsignedRight

public static Literal shiftUnsignedRight(Type type,
                                         Literal la,
                                         Literal ra)

power

public static Literal power(Type type,
                            Literal la,
                            Literal ra)

atan2

public static Literal atan2(Type type,
                            Literal la,
                            Literal ra)

sign

public static Literal sign(Type type,
                           Literal la,
                           Literal ra)

dim

public static Literal dim(Type type,
                          Literal la,
                          Literal ra)

sqrt

public static Literal sqrt(Type type,
                           Literal la)

exp

public static Literal exp(Type type,
                          Literal la)

log

public static Literal log(Type type,
                          Literal la)

log10

public static Literal log10(Type type,
                            Literal la)

sin

public static Literal sin(Type type,
                          Literal la)

cos

public static Literal cos(Type type,
                          Literal la)

tan

public static Literal tan(Type type,
                          Literal la)

asin

public static Literal asin(Type type,
                           Literal la)

acos

public static Literal acos(Type type,
                           Literal la)

atan

public static Literal atan(Type type,
                           Literal la)

sinh

public static Literal sinh(Type type,
                           Literal la)

cosh

public static Literal cosh(Type type,
                           Literal la)

tanh

public static Literal tanh(Type type,
                           Literal la)

conjg

public static Literal conjg(Type type,
                            Literal la)

stringCat

public static Literal stringCat(Type type,
                                Literal la,
                                Literal ra)

powerOf2

public static int powerOf2(long value)
Return x in (value = 2**x) or -1 if value is zero, negative or not a power of two.