|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.Quads.Quad
harpoon.IR.Quads.SIGMA
harpoon.IR.Quads.TYPESWITCH
public class TYPESWITCH
TYPESWITCH
represents a multiple-way branch dependent on
the class type of the argument. It may optionally omit the default
case, in which case it is read as an assertion on the type of the
argument, in addition to its usual semantics.
Field Summary | |
---|---|
protected boolean |
hasDefault
True if this TYPESWITCH has a default case. |
protected Temp |
index
The discriminant, of Object type, whose class is
compared against each class type in keys[] . |
protected HClass[] |
keys
Class type keys for typeswitch cases. |
Fields inherited from class harpoon.IR.Quads.SIGMA |
---|
dst, src |
Fields inherited from class harpoon.IR.Quads.Quad |
---|
arrayFactory |
Constructor Summary | |
---|---|
TYPESWITCH(QuadFactory qf,
HCodeElement source,
Temp index,
HClass[] keys,
Temp[][] dst,
Temp[] src,
boolean hasDefault)
Creates a TYPESWITCH operation. |
|
TYPESWITCH(QuadFactory qf,
HCodeElement source,
Temp index,
HClass[] keys,
Temp[] src,
boolean hasDefault)
Creates a typeswitch with arity defined by the keys array. |
Method Summary | ||
---|---|---|
|
accept(QuadValueVisitor<T> v)
|
|
void |
accept(QuadVisitor v)
Accept a visitor. |
|
boolean |
hasDefault()
Returns true if this TYPESWITCH has a
default case. |
|
Temp |
index()
Returns the Temp holding the discriminant. |
|
HClass[] |
keys()
Returns the array of class type keys for the typeswitch cases. |
|
HClass |
keys(int i)
Returns a given element in the keys array. |
|
int |
keysLength()
Returns the length of the keys array. |
|
int |
kind()
Return an integer enumeration of the kind of this Quad . |
|
Quad |
rename(QuadFactory qqf,
TempMap defMap,
TempMap useMap)
Create a new Quad identical to the receiver, but
with all Temp s renamed according to a mapping. |
|
String |
toString()
Returns human-readable representation of this quad. |
|
Temp[] |
use()
Returns the Temp used by this quad. |
Methods inherited from class harpoon.IR.Quads.SIGMA |
---|
arity, assign, def, dst, dst, dst, numSigmas, removeSigma, src, src |
Methods inherited from class harpoon.IR.Quads.Quad |
---|
addEdge, addEdges, addHandlers, clone, clone, clone, compareTo, defC, edgeC, edges, getFactory, getID, getLineNumber, getSourceFile, handlers, hashCode, isPred, isSucc, map, map, map, next, next, nextEdge, nextEdge, nextLength, pred, predC, prev, prev, prevEdge, prevEdge, prevLength, remove, removeHandlers, rename, replace, succ, succC, toLongString, transferHandlers, useC |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Temp index
Object
type, whose class is
compared against each class type in keys[]
.
protected HClass[] keys
next(n)
is the jump target corresponding to
keys[n]
for 0 <= n < keys.length
.
next(keys.length)
is the default target.
protected boolean hasDefault
TYPESWITCH
has a default case.
Constructor Detail |
---|
public TYPESWITCH(QuadFactory qf, HCodeElement source, Temp index, HClass[] keys, Temp[][] dst, Temp[] src, boolean hasDefault)
TYPESWITCH
operation.
next[n]
is the jump target corresponding to
keys[n]
for 0 <= n < keys.length
.
next[keys.length]
is the default target.
Order among the keys is important; the destination corresponds
to the *first* class type matching the argument.
We differ from the modula-3
TYPECASE statement by disallowing null
as a valid
key value. The discriminant is also not permitted to be
null
(except in quad-with-try form, in which case
a null
discriminant causes the default branch to
be taken). If withDefault
is true
,
a default edge will be taken if none of the keys match the type
of the argument; otherwise we assert that at least one key will
always match the argument.
index
- the discriminant.keys
- class type keys for switch cases.dst
- sigma function left-hand sides.src
- sigma function arguments.hasDefault
- true
if this TYPESWITCH
should
have a default case.public TYPESWITCH(QuadFactory qf, HCodeElement source, Temp index, HClass[] keys, Temp[] src, boolean hasDefault)
Method Detail |
---|
public Temp index()
Temp
holding the discriminant.
public HClass[] keys()
public HClass keys(int i)
keys
array.
public int keysLength()
keys
array.
public boolean hasDefault()
true
if this TYPESWITCH
has a
default case.
public Temp[] use()
Temp
used by this quad.
use
in interface UseDefable
use
in class SIGMA
index
field.public int kind()
Quad
Quad
. The enumerated values are defined in
QuadKind
.
kind
in class Quad
public Quad rename(QuadFactory qqf, TempMap defMap, TempMap useMap)
Quad
Quad
identical to the receiver, but
with all Temp
s renamed according to a mapping.
The new Quad
will have no edges.
The new Quad
will come from the specified
QuadFactory
.
rename
in class Quad
public void accept(QuadVisitor v)
Quad
accept
in class SIGMA
public <T> T accept(QuadValueVisitor<T> v)
accept
in class SIGMA
public String toString()
toString
in class SIGMA
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |