at.dms.kjc
Class CVariableInfo

java.lang.Object
  |
  +--at.dms.kjc.CVariableInfo

public final class CVariableInfo
extends java.lang.Object

Information about possible/definitive assignment of a set of variables. For each variable, it is tracked whether the variable may have been initialized, is definitely unassigned, or is definitely assigned.


Constructor Summary
CVariableInfo()
          Maintain assignment info for a set of variables.
 
Method Summary
 void addInfo(int pos, int info)
          Adds assignment info for variable at position pos to info.
 java.lang.Object clone()
          Returns a deep clone of this object.
 int getInfo(int pos)
          Returns assignment info for variable at position pos.
static int initialize()
          Returns info bitfield that means "definitely assigned".
static boolean isDefinitelyUnassigned(int info)
          Returns whether the info bitfield argument means "not definitely unassigned".
static boolean isInitialized(int info)
          Returns whether the info bitfield argument means "definitely assigned".
static boolean isUnreachable(int info)
          Returns whether the info bitfield argument means both "definitely assigned" and "definitely unassigned".
static boolean mayBeInitialized(int info)
          Returns whether the info bitfield argument means "not definitely unassigned".
static int merge(int one, int two)
          Merge two variable info values.
 void setInfo(int pos, int info)
          Sets assignment info for variable at position pos to info; any old information about the variables is overwritten.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CVariableInfo

public CVariableInfo()
Maintain assignment info for a set of variables.
Method Detail

clone

public java.lang.Object clone()
Returns a deep clone of this object.
Overrides:
clone in class java.lang.Object

getInfo

public int getInfo(int pos)
Returns assignment info for variable at position pos.

addInfo

public void addInfo(int pos,
                    int info)
Adds assignment info for variable at position pos to info. The new info bits are merged (with the binary-or operation) with the existing information.

setInfo

public void setInfo(int pos,
                    int info)
Sets assignment info for variable at position pos to info; any old information about the variables is overwritten.

merge

public static final int merge(int one,
                              int two)
Merge two variable info values. Algorithm: if either one is possible (maybe) assigned, then the result is possibly assigned. Only if both a definitely assigned, the result is definitely assigned.
Parameters:
one - The first info bitfield.
two - The second info bitfield.
Returns:
The merged result of these information flags.

initialize

public static final int initialize()
Returns info bitfield that means "definitely assigned".

isInitialized

public static final boolean isInitialized(int info)
Returns whether the info bitfield argument means "definitely assigned".

isDefinitelyUnassigned

public static final boolean isDefinitelyUnassigned(int info)
Returns whether the info bitfield argument means "not definitely unassigned".

mayBeInitialized

public static final boolean mayBeInitialized(int info)
Returns whether the info bitfield argument means "not definitely unassigned".

isUnreachable

public static final boolean isUnreachable(int info)
Returns whether the info bitfield argument means both "definitely assigned" and "definitely unassigned". According to the JLS, this can only happen at a position in the code that is unreachable.