Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.expr
Class Operator

java.lang.Object
  extended bynet.sf.jode.expr.Expression
      extended bynet.sf.jode.expr.Operator
Direct Known Subclasses:
ArrayLengthOperator, ArrayLoadOperator, BinaryOperator, CheckCastOperator, CheckNullOperator, CompareBinaryOperator, CompareToIntOperator, CompareUnaryOperator, ConstantArrayOperator, ConvertOperator, FieldOperator, IfThenElseOperator, IIncOperator, InstanceOfOperator, InvokeOperator, LocalVarOperator, MonitorEnterOperator, MonitorExitOperator, NewArrayOperator, NoArgOperator, OuterLocalOperator, PopOperator, PrePostFixOperator, SimpleOperator, StoreInstruction, StringAddOperator, UnaryOperator

public abstract class Operator
extends Expression


Field Summary
static int ADD_OP
           
static int AND_OP
           
static int ASSIGN_OP
           
static int COMPARE_OP
           
static int DEC_OP
           
static int EQUALS_OP
           
static int GREATER_OP
           
static int GREATEREQ_OP
           
static int INC_OP
           
static int LESS_OP
           
static int LESSEQ_OP
           
static int LOG_AND_OP
           
static int LOG_NOT_OP
           
static int LOG_OR_OP
           
static int NEG_OP
           
static int NOTEQUALS_OP
           
static int OPASSIGN_OP
           
protected  int operatorIndex
           
static int SHIFT_OP
           
static int SUB_OP
           
 
Fields inherited from class net.sf.jode.expr.Expression
EMPTYSTRING, type
 
Constructor Summary
Operator(Type type)
           
Operator(Type type, int op)
           
 
Method Summary
 Expression addOperand(Expression op)
           
 int canCombine(CombineableOperator combOp)
          Checks if the given Expression (which must be a CombineableOperator) can be combined into this expression.
 Expression combine(CombineableOperator comb)
          Combines the given Expression (which should be a StoreInstruction) into this expression.
 boolean containsConflictingLoad(MatchableOperator op)
          Checks if this expression contains a conflicting load, that matches the given CombineableOperator.
 boolean containsMatchingLoad(CombineableOperator comb)
          Checks if this expression contains a matching load, that matches the given Expression.
abstract  void dumpExpression(TabbedPrintWriter writer)
           
 boolean equals(java.lang.Object o)
           
 void fillDeclarables(java.util.Collection used)
           
 void fillInGenSet(java.util.Collection in, java.util.Collection gen)
           
 int getFreeOperandCount()
          Get the number of operands.
 Operator getOperator()
           
 int getOperatorIndex()
           
 java.lang.String getOperatorString()
           
 Expression[] getSubExpressions()
           
 boolean hasSideEffects(Expression expr)
          Checks if the value of the given expression can change, due to side effects in this expression.
 void initOperands(int opcount)
           
 boolean isConstant()
           
 boolean isFreeOperator()
          Tells if this is an operator, that doesn't have any subExpression, yet.
 boolean isFreeOperator(int opcount)
          Tells if this is an operator, that doesn't have any subExpression, yet, and that expects opcount operands
 void makeDeclaration(java.util.Set done)
           
 boolean opEquals(Operator o)
           
 void setOperatorIndex(int op)
           
 void setSubExpressions(int i, Expression expr)
           
 Expression simplify()
           
 boolean subsEquals(Operator other)
           
 
Methods inherited from class net.sf.jode.expr.Expression
dumpExpression, dumpExpression, getBreakPenalty, getParent, getPriority, getType, isVoid, makeInitializer, negate, removeOnetimeLocals, setType, simplifyString, simplifyStringBuffer, toString, updateParentType, updateSubTypes, updateType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD_OP

public static final int ADD_OP
See Also:
Constant Field Values

SUB_OP

public static final int SUB_OP
See Also:
Constant Field Values

SHIFT_OP

public static final int SHIFT_OP
See Also:
Constant Field Values

AND_OP

public static final int AND_OP
See Also:
Constant Field Values

ASSIGN_OP

public static final int ASSIGN_OP
See Also:
Constant Field Values

OPASSIGN_OP

public static final int OPASSIGN_OP
See Also:
Constant Field Values

INC_OP

public static final int INC_OP
See Also:
Constant Field Values

DEC_OP

public static final int DEC_OP
See Also:
Constant Field Values

COMPARE_OP

public static final int COMPARE_OP
See Also:
Constant Field Values

EQUALS_OP

public static final int EQUALS_OP
See Also:
Constant Field Values

NOTEQUALS_OP

public static final int NOTEQUALS_OP
See Also:
Constant Field Values

LESS_OP

public static final int LESS_OP
See Also:
Constant Field Values

GREATEREQ_OP

public static final int GREATEREQ_OP
See Also:
Constant Field Values

GREATER_OP

public static final int GREATER_OP
See Also:
Constant Field Values

LESSEQ_OP

public static final int LESSEQ_OP
See Also:
Constant Field Values

LOG_AND_OP

public static final int LOG_AND_OP
See Also:
Constant Field Values

LOG_OR_OP

public static final int LOG_OR_OP
See Also:
Constant Field Values

LOG_NOT_OP

public static final int LOG_NOT_OP
See Also:
Constant Field Values

NEG_OP

public static final int NEG_OP
See Also:
Constant Field Values

operatorIndex

protected int operatorIndex
Constructor Detail

Operator

public Operator(Type type)

Operator

public Operator(Type type,
                int op)
Method Detail

initOperands

public void initOperands(int opcount)

getFreeOperandCount

public int getFreeOperandCount()
Description copied from class: Expression
Get the number of operands.

Specified by:
getFreeOperandCount in class Expression
Returns:
The number of stack entries this expression needs.

isFreeOperator

public boolean isFreeOperator()
Tells if this is an operator, that doesn't have any subExpression, yet.


isFreeOperator

public boolean isFreeOperator(int opcount)
Tells if this is an operator, that doesn't have any subExpression, yet, and that expects opcount operands


addOperand

public Expression addOperand(Expression op)
Specified by:
addOperand in class Expression

getOperator

public Operator getOperator()

getSubExpressions

public Expression[] getSubExpressions()

setSubExpressions

public void setSubExpressions(int i,
                              Expression expr)

getOperatorIndex

public int getOperatorIndex()

setOperatorIndex

public void setOperatorIndex(int op)

getOperatorString

public java.lang.String getOperatorString()

opEquals

public boolean opEquals(Operator o)

simplify

public Expression simplify()
Overrides:
simplify in class Expression

fillInGenSet

public void fillInGenSet(java.util.Collection in,
                         java.util.Collection gen)
Overrides:
fillInGenSet in class Expression

fillDeclarables

public void fillDeclarables(java.util.Collection used)
Overrides:
fillDeclarables in class Expression

makeDeclaration

public void makeDeclaration(java.util.Set done)
Overrides:
makeDeclaration in class Expression

hasSideEffects

public boolean hasSideEffects(Expression expr)
Checks if the value of the given expression can change, due to side effects in this expression. If this returns false, the expression can safely be moved behind the current expresion.

Overrides:
hasSideEffects in class Expression
Parameters:
expr - the expression that should not change.

containsConflictingLoad

public boolean containsConflictingLoad(MatchableOperator op)
Checks if this expression contains a conflicting load, that matches the given CombineableOperator. The sub expressions are not checked.

Overrides:
containsConflictingLoad in class Expression
Parameters:
op - The combineable operator.
Returns:
if this expression contains a matching load.

containsMatchingLoad

public boolean containsMatchingLoad(CombineableOperator comb)
Checks if this expression contains a matching load, that matches the given Expression.

Overrides:
containsMatchingLoad in class Expression
Parameters:
comb - The store expression.
Returns:
true, iff this expression contains a matching load.
Throws:
ClassCastException, - if e.getOperator is not a CombineableOperator.

canCombine

public int canCombine(CombineableOperator combOp)
Checks if the given Expression (which must be a CombineableOperator) can be combined into this expression.

Overrides:
canCombine in class Expression
Returns:
1, if it can, 0, if no match was found and -1, if a conflict was found. You may wish to check for >0.
Throws:
ClassCastException, - if e.getOperator is not a CombineableOperator.

combine

public Expression combine(CombineableOperator comb)
Combines the given Expression (which should be a StoreInstruction) into this expression. You must only call this if canCombine returns the value 1.

Overrides:
combine in class Expression
Returns:
The combined expression.
Throws:
ClassCastException, - if e.getOperator is not a CombineableOperator.

subsEquals

public boolean subsEquals(Operator other)

equals

public boolean equals(java.lang.Object o)

isConstant

public boolean isConstant()
Overrides:
isConstant in class Expression

dumpExpression

public abstract void dumpExpression(TabbedPrintWriter writer)
                             throws java.io.IOException
Specified by:
dumpExpression in class Expression
Throws:
java.io.IOException

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.