|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.Quads.Quad
public abstract class Quad
Quad
is the base class for the quadruple representation.
Field Summary | |
---|---|
static ArrayFactory<Quad> |
arrayFactory
Array factory: returns Quad[] s |
Constructor Summary | |
---|---|
protected |
Quad(QuadFactory qf,
HCodeElement source)
Initializes a quad with exactly one input edge and exactly one output edge. |
protected |
Quad(QuadFactory qf,
HCodeElement source,
int prev_arity,
int next_arity)
Initializes a quad with prev_arity input edges and
next_arity output edges. |
Method Summary | ||
---|---|---|
abstract
|
accept(QuadValueVisitor<T> v)
|
|
abstract void |
accept(QuadVisitor v)
Accept a visitor. |
|
static Edge |
addEdge(Quad from,
int from_index,
Quad to,
int to_index)
Adds an edge between two Quads. |
|
static void |
addEdges(Quad[] quadlist)
Add edges between a string of Quads. |
|
void |
addHandlers(HandlerSet handlers)
Add this quad to the given handler sets. |
|
Quad |
clone()
|
|
Quad |
clone(QuadFactory qf,
CloningTempMap tm)
Clone a quad into a new quad factory, renaming all of the temps according to tm (which ought to ensure that all
the new temps belong to the TempFactory of the
new QuadFactory ). |
|
static Quad |
clone(QuadFactory qf,
Quad header)
Create a new copy of a string of Quad s starting at
the given header using QuadFactory . |
|
int |
compareTo(Quad o)
|
|
Temp[] |
def()
Return all the Temps defined by this Quad. |
|
Collection<Temp> |
defC()
Returns a Collection of all the
Temp s defined in this HCodeElement . |
|
List<Edge> |
edgeC()
Returns a List of all the edges to and from
this HCodeElement . |
|
Edge[] |
edges()
Returns an array of all the edges to and from this CFGraphable . |
|
QuadFactory |
getFactory()
Returns the QuadFactory that generated this
Quad . |
|
int |
getID()
Returns a unique numeric identifier for this Quad . |
|
int |
getLineNumber()
Returns the line in the original source file that this Quad is derived from. |
|
String |
getSourceFile()
Returns the original source file name that this Quad
is derived from. |
|
HandlerSet |
handlers()
Return a set of all the handlers guarding this Quad . |
|
int |
hashCode()
|
|
boolean |
isPred(Quad q)
Return true iff the given node is a predecessor of this node. |
|
boolean |
isSucc(Quad q)
Return true iff the given node is a successor of this node. |
|
abstract int |
kind()
Return an integer enumeration of the kind of this Quad . |
|
protected static Temp |
map(TempMap tm,
Temp t)
Apply TempMap tm to Temp
t . |
|
protected static Temp[] |
map(TempMap tm,
Temp[] ta)
Apply TempMap to array of Temp s. |
|
protected static Temp[][] |
map(TempMap tm,
Temp[][] taa)
Apply TempMap to 2-d array of Temp s. |
|
Quad[] |
next()
Returns an array containing all the successors of this quad, in order. |
|
Quad |
next(int i)
Returns the i th successor of this quad. |
|
Edge[] |
nextEdge()
Returns an array containing all the outgoing edges from this quad. |
|
Edge |
nextEdge(int i)
Returns the i th outgoing edge for this quad. |
|
int |
nextLength()
Return the number of successors of this quad. |
|
Edge[] |
pred()
Returns an array of all the edges entering this CFGraphable . |
|
List<Edge> |
predC()
Returns a List of all the edges to
this HCodeElement . |
|
Quad[] |
prev()
Returns an array containing all the predecessors of this quad, in order. |
|
Quad |
prev(int i)
Returns the i th predecessor of this quad. |
|
Edge[] |
prevEdge()
Returns an array containing all the incoming edges of this quad. |
|
Edge |
prevEdge(int i)
Returns the i th incoming edge of this quad. |
|
int |
prevLength()
Return the number of predecessors of this quad. |
|
Edge |
remove()
Remove this quad from the graph. |
|
void |
removeHandlers(HandlerSet handlers)
Remove this quad from the given handler sets. |
|
abstract Quad |
rename(QuadFactory qf,
TempMap defMap,
TempMap useMap)
Create a new Quad identical to the receiver, but
with all Temp s renamed according to a mapping. |
|
Quad |
rename(TempMap defMap,
TempMap useMap)
Create a new Quad identical to the receiver, but
with all Temp s renamed according to a mapping. |
|
static void |
replace(Quad oldQ,
Quad newQ)
Replace one quad with another. |
|
Edge[] |
succ()
Returns an array of all the edges leaving this CFGraphable . |
|
List<Edge> |
succC()
Returns a List of all the edges from
this HCodeElement . |
|
String |
toLongString()
Returns a string representation of this quad containing the source file and the line number info, in addition to the other information provided by the regulat toString(). |
|
abstract String |
toString()
Force everyone to reimplement toString() |
|
static void |
transferHandlers(Quad oldQ,
Quad newQ)
Update the handlers for newQ to match the handlers for oldQ, removing handlers from oldQ in the process. |
|
Temp[] |
use()
Return all the Temps used by this Quad. |
|
Collection<Temp> |
useC()
Returns a Collection of all the
Temp s read in this HCodeElement . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ArrayFactory<Quad> arrayFactory
Quad[]
s
Constructor Detail |
---|
protected Quad(QuadFactory qf, HCodeElement source, int prev_arity, int next_arity)
prev_arity
input edges and
next_arity
output edges.
protected Quad(QuadFactory qf, HCodeElement source)
Method Detail |
---|
public int hashCode()
hashCode
in class Object
public QuadFactory getFactory()
QuadFactory
that generated this
Quad
.
public String getSourceFile()
Quad
is derived from.
getSourceFile
in interface HCodeElement
public int getLineNumber()
Quad
is derived from.
getLineNumber
in interface HCodeElement
public int getID()
Quad
.
getID
in interface HCodeElement
public abstract String toString()
toString
in class Object
public String toLongString()
public abstract void accept(QuadVisitor v)
public abstract <T> T accept(QuadValueVisitor<T> v)
public abstract int kind()
Quad
. The enumerated values are defined in
QuadKind
.
public abstract Quad rename(QuadFactory qf, TempMap defMap, TempMap useMap)
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
.
public final Quad rename(TempMap defMap, TempMap useMap)
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 same
QuadFactory
as the receiver.
public Temp[] use()
use
in interface UseDefable
public Temp[] def()
def
in interface UseDefable
public Collection<Temp> useC()
UseDefable
Collection
of all the
Temp
s read in this HCodeElement
.
useC
in interface UseDefable
public Collection<Temp> defC()
UseDefable
Collection
of all the
Temp
s defined in this HCodeElement
.
defC
in interface UseDefable
public Quad next(int i)
i
th successor of this quad.
public Quad prev(int i)
i
th predecessor of this quad.
public int nextLength()
public int prevLength()
public Quad[] next()
public Quad[] prev()
public Edge[] nextEdge()
public Edge[] prevEdge()
public Edge nextEdge(int i)
i
th outgoing edge for this quad.
public Edge prevEdge(int i)
i
th incoming edge of this quad.
public Edge[] edges()
CFGraphable
CFGraphable
.
edges
in interface CFGraphable<Quad,Edge>
public Edge[] pred()
CFGraphable
CFGraphable
.
pred
in interface CFGraphable<Quad,Edge>
public Edge[] succ()
CFGraphable
CFGraphable
.
succ
in interface CFGraphable<Quad,Edge>
public List<Edge> edgeC()
CFGraphable
List
of all the edges to and from
this HCodeElement
.
edgeC
in interface CFGraphable<Quad,Edge>
public List<Edge> predC()
CFGraphable
List
of all the edges to
this HCodeElement
.
Each CFGEdge
returned is guaranteed to return
this
in response to a call to to()
;
the actual predecessor will be returned from
from()
.
predC
in interface CFGraphable<Quad,Edge>
predC
in interface Graph.Node<Quad,Edge>
public List<Edge> succC()
CFGraphable
List
of all the edges from
this HCodeElement
.
Each CFGEdge
returned is guaranteed to return
this
in response to a call to
from()
; the actual successor to this
will be returned from to()
.
succC
in interface CFGraphable<Quad,Edge>
succC
in interface Graph.Node<Quad,Edge>
public boolean isSucc(Quad q)
Graph.Node
isSucc
in interface Graph.Node<Quad,Edge>
public boolean isPred(Quad q)
Graph.Node
isPred
in interface Graph.Node<Quad,Edge>
public static Edge addEdge(Quad from, int from_index, Quad to, int to_index)
from_index
ed
outgoing edge of from
is connected to the
to_index
ed incoming edge of to
.
Edge
.public static void addEdges(Quad[] quadlist)
addEdge(q[i], 0, q[i+1], 0)
calls.
public static void replace(Quad oldQ, Quad newQ)
public Edge remove()
public static void transferHandlers(Quad oldQ, Quad newQ)
public final void addHandlers(HandlerSet handlers)
public final void removeHandlers(HandlerSet handlers)
public final HandlerSet handlers()
Quad
.
public int compareTo(Quad o)
compareTo
in interface Comparable<Quad>
public final Quad clone()
clone
in class Object
public final Quad clone(QuadFactory qf, CloningTempMap tm)
tm
(which ought to ensure that all
the new temps belong to the TempFactory
of the
new QuadFactory
).
public static Quad clone(QuadFactory qf, Quad header)
Quad
s starting at
the given header using QuadFactory
.
protected static final Temp map(TempMap tm, Temp t)
TempMap
tm
to Temp
t
.
tm.tempMap(t)
if t
is
non-null
, or null
if t
is
null
.protected static final Temp[] map(TempMap tm, Temp[] ta)
TempMap
to array of Temp
s.
Null Temp
s get mapped to null
.
protected static final Temp[][] map(TempMap tm, Temp[][] taa)
TempMap
to 2-d array of Temp
s.
Null Temp
s get mapped to null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |