|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.nyu.cascade.ir.expr.AbstractExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
edu.nyu.cascade.ir.expr.BitVectorExpressionFactory
public class BitVectorExpressionFactory
Field Summary |
---|
Fields inherited from class edu.nyu.cascade.ir.expr.AbstractExpressionFactory |
---|
FUN_ALLOCATED |
Method Summary | ||
---|---|---|
BooleanExpression |
allocated(BitVectorExpression loc,
BitVectorExpression size)
Returns a boolean expression representing the proposition that the memory location identified by ptr represents an allocated block of
storage of size bytes (used in source code annotations). |
|
BooleanExpression |
and(BooleanExpression lhs,
BooleanExpression rhs)
Returns a boolean expression representing the conjunction of the two boolean arguments. |
|
Expression<ArrayType<BitVectorType,BitVectorType>> |
assign(Expression<ArrayType<BitVectorType,BitVectorType>> mem,
BitVectorExpression var,
BitVectorExpression val)
Returns a new program state, representing the assignment of the value rval to the memory location lval in pre-state
state . |
|
BitVectorExpression |
bitwiseAnd(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression representing the bitwise AND of the two integer arguments. |
|
BooleanExpression |
castToBoolean(BitVectorExpression bv)
Returns a boolean expression representing the integer value expr , according to the conversion rule of the underlying
encoding. |
|
BitVectorExpression |
castToInteger(BooleanExpression bool)
Returns an integer expression representing the boolean value bool , according to the conversion rule of the underlying
encoding. |
|
static BitVectorExpressionFactory |
create(Map<File,? extends SymbolTable> symbolTables,
ExpressionManager exprManager,
int addressSize,
int cellSize)
Create an expression factory with the given pointer and word sizes. |
|
static BitVectorExpressionFactory |
create(Map<File,SymbolTable> symbolTables,
ExpressionManager exprManager,
ArrayType<BitVectorType,BitVectorType> memArrayType)
Create an expression factory with the given array type to model memory. |
|
static BitVectorExpressionFactory |
create(Map<File,SymbolTable> symbolTables,
ExpressionManager exprManager,
ArrayVariableExpression<BitVectorType,BitVectorType> memArray)
|
|
BitVectorExpression |
deref(BitVectorExpression expr)
Returns an integer expression representing the value stored at the memory location identified by expression p . |
|
BooleanExpression |
eq(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs for equality. |
|
BooleanExpression |
evalBoolean(BooleanExpression bool,
Expression<ArrayType<BitVectorType,BitVectorType>> state)
Evaluate the boolean expression e in state . |
|
BitVectorExpression |
evalExpression(BitVectorExpression expr,
Expression<ArrayType<BitVectorType,BitVectorType>> state)
|
|
BooleanExpression |
ff()
Returns a boolean expression representing false . |
|
protected BitVectorType |
getAddressType()
|
|
ImmutableSet<? extends BooleanExpression> |
getAssumptions()
Get logical assumptions used in the underlying encoding. |
|
protected BitVectorType |
getCellType()
|
|
ArrayType<BitVectorType,BitVectorType> |
getStateType()
Returns the program state type of the underlying encoding. |
|
BooleanExpression |
greaterThan(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs . |
|
BooleanExpression |
greaterThanOrEqual(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs . |
|
BitVectorExpression |
ifThenElse(BooleanExpression bool,
BitVectorExpression thenExpr,
BitVectorExpression elseExpr)
Returns an integer expression with the value of thenExpr if
bool holds and the value of elseExpr otherwise. |
|
|
indexArray(Expression<ArrayType<I,E>> array,
BitVectorExpression index)
|
|
|
indexArray(Expression<ArrayType<I,E>> array,
Iterable<? extends BitVectorExpression> indices)
|
|
BitVectorExpression |
integerConstant(int c)
Returns an integer expression representing the constant c . |
|
BitVectorExpression |
integerVar(String id,
boolean fresh)
Returns a integer expression representing the variable with name id . |
|
BooleanExpression |
lessThan(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs . |
|
BooleanExpression |
lessThanOrEqual(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs . |
|
BitVectorExpression |
minus(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns an integer expression representing subtraction of the two integer arguments. |
|
BooleanExpression |
neq(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns a boolean expression comparing integers lhs and
rhs for disequality. |
|
BooleanExpression |
nor(Iterable<BooleanExpression> disjuncts)
Returns an boolean expression that holds if none of the boolean elements of the Iterable disjuncts is true. |
|
BooleanExpression |
not(BooleanExpression b)
Returns a boolean expression representing the negation of expression b . |
|
BitVectorExpression |
one()
Returns an integer expression representing one. |
|
BooleanExpression |
or(BooleanExpression lhs,
BooleanExpression rhs)
Returns a boolean expression representing the logical OR the two boolean arguments. |
|
BitVectorExpression |
plus(BitVectorExpression lhs,
BitVectorExpression rhs)
Returns an integer expression representing the sum of the two integer arguments. |
|
BooleanExpression |
tt()
Returns a boolean expression representing true . |
|
Type<?> |
type(IRType t)
|
|
BitVectorExpression |
unknown()
Returns an integer expression representing an unknown value. |
|
Object |
variable(String name,
IRType type,
boolean fresh)
|
|
BitVectorExpression |
zero()
Returns an integer expression representing zero. |
Methods inherited from class edu.nyu.cascade.ir.expr.AbstractExpressionFactory |
---|
decr, functionCall, functionCall, functionCall, getExpressionManager, getInitialState, incr, integerAnd, integerNot, integerOr |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static BitVectorExpressionFactory create(Map<File,SymbolTable> symbolTables, ExpressionManager exprManager, ArrayVariableExpression<BitVectorType,BitVectorType> memArray) throws ExpressionFactoryException
ExpressionFactoryException
public static BitVectorExpressionFactory create(Map<File,SymbolTable> symbolTables, ExpressionManager exprManager, ArrayType<BitVectorType,BitVectorType> memArrayType) throws ExpressionFactoryException
symbolTables
- exprManager
- addressSize
- the desired size of a pointercellSize
- the desired size of a memory word (i.e., the unit of a pointer
"step")
IllegalArgumentException
- if addressSize
is not a multiple of
cellSize
ExpressionFactoryException
public static BitVectorExpressionFactory create(Map<File,? extends SymbolTable> symbolTables, ExpressionManager exprManager, int addressSize, int cellSize) throws ExpressionFactoryException
symbolTables
- exprManager
- addressSize
- the desired size of a pointercellSize
- the desired size of a memory word (i.e., the unit of a pointer "step")
IllegalArgumentException
- if addressSize
is not a multiple of cellSize
ExpressionFactoryException
public BooleanExpression allocated(BitVectorExpression loc, BitVectorExpression size) throws ExpressionFactoryException
ExpressionFactory
ptr
represents an allocated block of
storage of size
bytes (used in source code annotations).
NOTE: Optional operation.
ExpressionFactoryException
public BooleanExpression and(BooleanExpression lhs, BooleanExpression rhs) throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public Expression<ArrayType<BitVectorType,BitVectorType>> assign(Expression<ArrayType<BitVectorType,BitVectorType>> mem, BitVectorExpression var, BitVectorExpression val) throws ExpressionFactoryException
ExpressionFactory
rval
to the memory location lval
in pre-state
state
.
ExpressionFactoryException
public BitVectorExpression bitwiseAnd(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public BooleanExpression castToBoolean(BitVectorExpression bv) throws ExpressionFactoryException
AbstractExpressionFactory
expr
, according to the conversion rule of the underlying
encoding.
Default implementation: following the C convention, an expression
expr
has the boolean value true
iff. it is not
equal to the return value of zero()
.
castToBoolean
in interface ExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
castToBoolean
in class AbstractExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
ExpressionFactoryException
public BitVectorExpression castToInteger(BooleanExpression bool) throws ExpressionFactoryException
AbstractExpressionFactory
bool
, according to the conversion rule of the underlying
encoding.
Default implementation: true maps to the return value of one()
and false maps to the return value of zero()
.
castToInteger
in interface ExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
castToInteger
in class AbstractExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
ExpressionFactoryException
public BitVectorExpression deref(BitVectorExpression expr) throws ExpressionFactoryException
ExpressionFactory
p
.
NOTE: Optional operation.
ExpressionFactoryException
public BooleanExpression eq(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
for equality.
ExpressionFactoryException
public BooleanExpression evalBoolean(BooleanExpression bool, Expression<ArrayType<BitVectorType,BitVectorType>> state) throws ExpressionFactoryException
ExpressionFactory
e
in state
. The
method is responsible for converting the underlying encoding of booleans
Bool
into an object of type
IExpression<IBooleanType>
that can be queried for
validity/satisfiability.
ExpressionFactoryException
public BitVectorExpression evalExpression(BitVectorExpression expr, Expression<ArrayType<BitVectorType,BitVectorType>> state) throws ExpressionFactoryException
ExpressionFactoryException
public BooleanExpression ff() throws ExpressionFactoryException
ExpressionFactory
false
.
ExpressionFactoryException
protected BitVectorType getAddressType()
public ImmutableSet<? extends BooleanExpression> getAssumptions() throws ExpressionFactoryException
AbstractExpressionFactory
x
, y
, and z
are represented as
indices into an array, then getAssumptions()
may return
{ x ≠ y, x ≠ z, y ≠ z }
.
Default implementation: an empty set of assumptions.
getAssumptions
in interface ExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
getAssumptions
in class AbstractExpressionFactory<BitVectorExpression,BooleanExpression,ArrayType<BitVectorType,BitVectorType>>
ExpressionFactoryException
protected BitVectorType getCellType()
public ArrayType<BitVectorType,BitVectorType> getStateType() throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public BooleanExpression greaterThan(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
.
ExpressionFactoryException
public BooleanExpression greaterThanOrEqual(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
.
ExpressionFactoryException
public BitVectorExpression ifThenElse(BooleanExpression bool, BitVectorExpression thenExpr, BitVectorExpression elseExpr) throws ExpressionFactoryException
ExpressionFactory
thenExpr
if
bool
holds and the value of elseExpr
otherwise.
ExpressionFactoryException
public BitVectorExpression integerConstant(int c) throws ExpressionFactoryException
ExpressionFactory
c
.
ExpressionFactoryException
public BitVectorExpression integerVar(String id, boolean fresh) throws ExpressionFactoryException
ExpressionFactory
id
.
fresh
- TODO
ExpressionFactoryException
public BooleanExpression lessThan(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
.
ExpressionFactoryException
public BooleanExpression lessThanOrEqual(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
.
ExpressionFactoryException
public BitVectorExpression minus(BitVectorExpression lhs, BitVectorExpression rhs)
ExpressionFactory
public BooleanExpression neq(BitVectorExpression lhs, BitVectorExpression rhs) throws ExpressionFactoryException
ExpressionFactory
lhs
and
rhs
for disequality.
ExpressionFactoryException
public BooleanExpression nor(Iterable<BooleanExpression> disjuncts) throws ExpressionFactoryException
ExpressionFactory
Iterable
disjuncts
is true.
ExpressionFactoryException
public BooleanExpression not(BooleanExpression b) throws ExpressionFactoryException
ExpressionFactory
b
.
ExpressionFactoryException
public BitVectorExpression one() throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public BooleanExpression or(BooleanExpression lhs, BooleanExpression rhs) throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public BitVectorExpression plus(BitVectorExpression lhs, BitVectorExpression rhs)
ExpressionFactory
public BooleanExpression tt() throws ExpressionFactoryException
ExpressionFactory
true
.
ExpressionFactoryException
public BitVectorExpression unknown() throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public BitVectorExpression zero() throws ExpressionFactoryException
ExpressionFactory
ExpressionFactoryException
public <I extends Type<I>,E extends Type<E>> BitVectorExpression indexArray(Expression<ArrayType<I,E>> array, BitVectorExpression index)
public <I extends Type<I>,E extends Type<E>> BitVectorExpression indexArray(Expression<ArrayType<I,E>> array, Iterable<? extends BitVectorExpression> indices)
public Type<?> type(IRType t) throws ExpressionFactoryException
ExpressionFactoryException
public Object variable(String name, IRType type, boolean fresh) throws ExpressionFactoryException
ExpressionFactoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |