org.jikesrvm.compilers.opt.ir
Class Operator

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.Operator

public final class Operator
extends Object

An Operator represents the operator of an Instruction. For each operator in the IR, we create exactly one Operator instance to represent it. These instances are all stored in static fields of Operators. Since only one instance is created for each semantic operator, they can be compared using ==.

A common coding practive is to implement the Operators interface to be able to reference the IR operators within a class without having to prepend 'Operators.' everywhere.

See Also:
Operators, Instruction, OperatorNames

Field Summary
private static int acquire
           
private static int alloc
           
private static int branch
           
private static int call
           
private static int commutative
           
private static int compare
           
private static int conditional
           
private static int dynLink
           
private static int ethrow
           
 byte format
          Encoding of the operator's InstructionFormat.
private static int fpPop
           
private static int fpPush
           
private static int immedPEI
           
 int implicitDefs
          Physical registers that are implicitly defined by the operator.
 int implicitUses
          Physical registers that are implicitly used by the operator.
private static int indirect
           
private static int load
           
private static int memAsLoad
           
private static int memAsStore
           
private static int move
           
static int none
           
private  int numberDefs
          How many operands of the operator are (pure) defs?
private  int numberDefUses
          How many operands of the operator are both defs and uses?
private  int numberUses
          How many operands of the operator are pure uses?
(package private)  OperatorClass opClass
          Operator Class of the operator; used for instruction scheduling.
 char opcode
          The operators opcode.
static Operator[] OperatorArray
           
private static int release
           
private static int ret
           
private static int store
           
private  int traits
          encoding of operator traits (characteristics)
private static int tsp
           
static int varDefs
           
static int varUses
           
private static int yieldPoint
           
 
Constructor Summary
private Operator(char opcode, byte format, int traits, int numDefs, int numDefUses, int numUses, int iDefs, int iUses)
           
 
Method Summary
 int getNumberOfDefs()
          Returns the number of operands that are defs (either pure defs or combined def/uses).
 int getNumberOfDefUses()
          Returns the number of operands that are defs and uses.
 int getNumberOfFixedPureDefs()
          Returns the number of operands that are pure defs and are not in the variable-length part of the operand list.
 int getNumberOfFixedPureUses()
          Returns the number of operands that are pure uses and are not in the variable-length part of the operand list.
 int getNumberOfFixedUses()
          Returns the number of operands that are uses (either combined use/defs or pure uses) and are not in the variable-length part of the operand list.
 int getNumberOfImplicitDefs()
          Returns the number of physical registers that are implicitly defined by this operator.
 int getNumberOfImplicitUses()
          Returns the number of physical registers that are implicitly used by this operator.
 int getNumberOfPureDefs()
          Returns the number of operands that are defs.
 int getNumberOfPureFixedUses()
          Returns the number of operands that are pure uses and are not in the variable-length part of the operand list.
 int getNumberOfPureUses()
          Returns the number of operands that are pure uses.
 int getNumberOfUses()
          Returns the number of operands that are uses (either combined def/uses or pure uses).
 OperatorClass getOpClass()
          Gets the operator class.
 boolean hasVarDefs()
          Can the operator have a variable number of uses?
 boolean hasVarUses()
          Can the operator have a variable number of uses?
 boolean hasVarUsesOrDefs()
          Can the operator have a variable number of uses or defs?
 boolean isAcquire()
          Is the operator an acquire (monitorenter/lock)?
 boolean isAllocation()
          Is the operator an actual memory allocation instruction (NEW, NEWARRAY, etc)?
 boolean isBranch()
          Is the operator an intraprocedural branch?
 boolean isCall()
          Is the operator a call (one kind of interprocedural branch)?
 boolean isCommutative()
          Is the operator commutative?
 boolean isCompare()
          Is the operator a compare (val,val) => condition?
 boolean isConditionalBranch()
          Is the operator a conditional intraprocedural branch?
 boolean isConditionalCall()
          Is the operator a conditional call?
 boolean isDirectBranch()
          Is the operator a direct intraprocedural branch?
 boolean isDirectCall()
          Is the operator a direct call?
 boolean isDynamicLinkingPoint()
          Could the operator either directly or indirectly cause dynamic class loading?
 boolean isExplicitLoad()
          Is the operator an explicit load of a finite set of values from a finite set of memory locations (load, load multiple, _not_ call)?
 boolean isExplicitStore()
          Is the operator an explicit store of a finite set of values to a finite set of memory locations (store, store multiple, _not_ call)?
 boolean isFpPop()
          Does the operator pop the floating-point stack?
 boolean isFpPush()
          Does the operator push on the floating-point stack?
 boolean isGCPoint()
          Is the operator a potential GC point?
 boolean isImplicitLoad()
          Should the operator be treated as a load from some unknown location(s) for the purposes of scheduling and/or modeling the memory subsystem?
 boolean isImplicitStore()
          Should the operator be treated as a store to some unknown location(s) for the purposes of scheduling and/or modeling the memory subsystem?
 boolean isIndirectBranch()
          Is the operator an indirect intraprocedural branch?
 boolean isIndirectCall()
          Is the operator an indirect call?
 boolean isMove()
          Does the operator represent a simple move (the value is unchanged) from one "register" location to another "register" location?
 boolean isPEI()
          Is the operator a PEI (Potentially Excepting Instruction)?
 boolean isRelease()
          Is the operator a release (monitorexit/unlock)?
 boolean isReturn()
          Is the operator a return (interprocedural branch)?
 boolean isThrow()
          Is the operator a throw of a Java exception?
 boolean isTSPoint()
          is the operator a potential thread switch point?
 boolean isUnconditionalBranch()
          Is the operator an unconditional intraprocedural branch?
 boolean isUnconditionalCall()
          Is the operator an unconditional call?
 boolean isYieldPoint()
          Is the operator a yield point?
 void setOpClass(OperatorClass opClass)
          Sets the operator class.
 String toString()
          Returns the string representation of this operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

opcode

public final char opcode
The operators opcode. This value serves as a unique id suitable for use in switches


format

public final byte format
Encoding of the operator's InstructionFormat. This field is only meant to be directly referenced from the mechanically generated InstructionFormat classes defined in the instructionFormats package. Instruction contains an explanation of the role of InstructionFormats in the IR.


traits

private final int traits
encoding of operator traits (characteristics)


numberDefs

private final int numberDefs
How many operands of the operator are (pure) defs?


numberDefUses

private final int numberDefUses
How many operands of the operator are both defs and uses? Only non-zero on IA32, 390.


numberUses

private final int numberUses
How many operands of the operator are pure uses? Only contains a valid value for non-variableLength operators


implicitDefs

public final int implicitDefs
Physical registers that are implicitly defined by the operator.


implicitUses

public final int implicitUses
Physical registers that are implicitly used by the operator.


opClass

OperatorClass opClass
Operator Class of the operator; used for instruction scheduling.


none

public static final int none
See Also:
Constant Field Values

move

private static final int move
See Also:
Constant Field Values

branch

private static final int branch
See Also:
Constant Field Values

call

private static final int call
See Also:
Constant Field Values

conditional

private static final int conditional
See Also:
Constant Field Values

indirect

private static final int indirect
See Also:
Constant Field Values

load

private static final int load
See Also:
Constant Field Values

memAsLoad

private static final int memAsLoad
See Also:
Constant Field Values

store

private static final int store
See Also:
Constant Field Values

memAsStore

private static final int memAsStore
See Also:
Constant Field Values

ethrow

private static final int ethrow
See Also:
Constant Field Values

immedPEI

private static final int immedPEI
See Also:
Constant Field Values

compare

private static final int compare
See Also:
Constant Field Values

alloc

private static final int alloc
See Also:
Constant Field Values

ret

private static final int ret
See Also:
Constant Field Values

varUses

public static final int varUses
See Also:
Constant Field Values

varDefs

public static final int varDefs
See Also:
Constant Field Values

tsp

private static final int tsp
See Also:
Constant Field Values

acquire

private static final int acquire
See Also:
Constant Field Values

release

private static final int release
See Also:
Constant Field Values

dynLink

private static final int dynLink
See Also:
Constant Field Values

yieldPoint

private static final int yieldPoint
See Also:
Constant Field Values

fpPop

private static final int fpPop
See Also:
Constant Field Values

fpPush

private static final int fpPush
See Also:
Constant Field Values

commutative

private static final int commutative
See Also:
Constant Field Values

OperatorArray

public static final Operator[] OperatorArray
Constructor Detail

Operator

private Operator(char opcode,
                 byte format,
                 int traits,
                 int numDefs,
                 int numDefUses,
                 int numUses,
                 int iDefs,
                 int iUses)
Method Detail

setOpClass

public void setOpClass(OperatorClass opClass)
Sets the operator class.

Parameters:
opClass - operator class

getOpClass

public OperatorClass getOpClass()
Gets the operator class.

Returns:
operator class

toString

public String toString()
Returns the string representation of this operator.

Overrides:
toString in class Object
Returns:
the name of the operator

getNumberOfPureDefs

public int getNumberOfPureDefs()
Returns the number of operands that are defs. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
number of operands that are pure defs

getNumberOfFixedPureDefs

public int getNumberOfFixedPureDefs()
Returns the number of operands that are pure defs and are not in the variable-length part of the operand list. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
how many non-variable operands are pure defs

getNumberOfFixedPureUses

public int getNumberOfFixedPureUses()
Returns the number of operands that are pure uses and are not in the variable-length part of the operand list. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
how many non-variable operands are pure uses

getNumberOfDefUses

public int getNumberOfDefUses()
Returns the number of operands that are defs and uses. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
number of operands that are combined defs and uses

getNumberOfPureUses

public int getNumberOfPureUses()
Returns the number of operands that are pure uses. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
number of operands that are pure uses

getNumberOfDefs

public int getNumberOfDefs()
Returns the number of operands that are defs (either pure defs or combined def/uses). By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
number of operands that are defs

getNumberOfUses

public int getNumberOfUses()
Returns the number of operands that are uses (either combined def/uses or pure uses). By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
how many operands are uses

getNumberOfPureFixedUses

public int getNumberOfPureFixedUses()
Returns the number of operands that are pure uses and are not in the variable-length part of the operand list. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
how many non-variable operands are pure uses

getNumberOfFixedUses

public int getNumberOfFixedUses()
Returns the number of operands that are uses (either combined use/defs or pure uses) and are not in the variable-length part of the operand list. By convention, operands are ordered in instructions such that all defs are first, followed by all combined defs/uses, followed by all pure uses.

Returns:
number of non-variable operands are uses

getNumberOfImplicitDefs

public int getNumberOfImplicitDefs()
Returns the number of physical registers that are implicitly defined by this operator.

Returns:
number of implicit defs

getNumberOfImplicitUses

public int getNumberOfImplicitUses()
Returns the number of physical registers that are implicitly used by this operator.

Returns:
number of implicit uses

isMove

public boolean isMove()
Does the operator represent a simple move (the value is unchanged) from one "register" location to another "register" location?

Returns:
true if the operator is a simple move or false if it is not.

isBranch

public boolean isBranch()
Is the operator an intraprocedural branch?

Returns:
true if the operator is am intraprocedural branch or false if it is not.

isConditionalBranch

public boolean isConditionalBranch()
Is the operator a conditional intraprocedural branch?

Returns:
true if the operator is a conditoonal intraprocedural branch or false if it is not.

isUnconditionalBranch

public boolean isUnconditionalBranch()
Is the operator an unconditional intraprocedural branch? We consider various forms of switches to be unconditional intraprocedural branches, even though they are multi-way branches and we may not no exactly which target will be taken. This turns out to be the right thing to do, since some arm of the switch will always be taken (unlike conditional branches).

Returns:
true if the operator is an unconditional intraprocedural branch or false if it is not.

isDirectBranch

public boolean isDirectBranch()
Is the operator a direct intraprocedural branch? In the HIR and LIR we consider switches to be direct branches, because their targets are known precisely.

Returns:
true if the operator is a direct intraprocedural branch or false if it is not.

isIndirectBranch

public boolean isIndirectBranch()
Is the operator an indirect intraprocedural branch?

Returns:
true if the operator is an indirect interprocedural branch or false if it is not.

isCall

public boolean isCall()
Is the operator a call (one kind of interprocedural branch)?

Returns:
true if the operator is a call or false if it is not.

isConditionalCall

public boolean isConditionalCall()
Is the operator a conditional call? We only allow conditional calls in the MIR, since they tend to only be directly implementable on some architecutres.

Returns:
true if the operator is a conditional call or false if it is not.

isUnconditionalCall

public boolean isUnconditionalCall()
Is the operator an unconditional call? Really only an interesting question in the MIR, since it is by definition true for all HIR and LIR calls.

Returns:
true if the operator is an unconditional call or false if it is not.

isDirectCall

public boolean isDirectCall()
Is the operator a direct call? Only interesting on the MIR. In the HIR and LIR we pretend that all calls are "direct" even though most of them aren't.

Returns:
true if the operator is a direct call or false if it is not.

isIndirectCall

public boolean isIndirectCall()
Is the operator an indirect call? Only interesting on the MIR. In the HIR and LIR we pretend that all calls are "direct" even though most of them aren't.

Returns:
true if the operator is an indirect call or false if it is not.

isExplicitLoad

public boolean isExplicitLoad()
Is the operator an explicit load of a finite set of values from a finite set of memory locations (load, load multiple, _not_ call)?

Returns:
true if the operator is an explicit load or false if it is not.

isImplicitLoad

public boolean isImplicitLoad()
Should the operator be treated as a load from some unknown location(s) for the purposes of scheduling and/or modeling the memory subsystem?

Returns:
true if the operator is an implicit load or false if it is not.

isExplicitStore

public boolean isExplicitStore()
Is the operator an explicit store of a finite set of values to a finite set of memory locations (store, store multiple, _not_ call)?

Returns:
true if the operator is an explicit store or false if it is not.

isImplicitStore

public boolean isImplicitStore()
Should the operator be treated as a store to some unknown location(s) for the purposes of scheduling and/or modeling the memory subsystem?

Returns:
true if the operator is an implicit store or false if it is not.

isThrow

public boolean isThrow()
Is the operator a throw of a Java exception?

Returns:
true if the operator is a throw or false if it is not.

isPEI

public boolean isPEI()
Is the operator a PEI (Potentially Excepting Instruction)?

Returns:
true if the operator is a PEI or false if it is not.

isGCPoint

public boolean isGCPoint()
Is the operator a potential GC point?

Returns:
true if the operator is a potential GC point or false if it is not.

isTSPoint

public boolean isTSPoint()
is the operator a potential thread switch point?

Returns:
true if the operator is a potential threadswitch point or false if it is not.

isCompare

public boolean isCompare()
Is the operator a compare (val,val) => condition?

Returns:
true if the operator is a compare or false if it is not.

isAllocation

public boolean isAllocation()
Is the operator an actual memory allocation instruction (NEW, NEWARRAY, etc)?

Returns:
true if the operator is an allocation or false if it is not.

isReturn

public boolean isReturn()
Is the operator a return (interprocedural branch)?

Returns:
true if the operator is a return or false if it is not.

hasVarUses

public boolean hasVarUses()
Can the operator have a variable number of uses?

Returns:
true if the operator has a variable number of uses or false if it does not.

hasVarDefs

public boolean hasVarDefs()
Can the operator have a variable number of uses?

Returns:
true if the operator has a variable number of uses or false if it does not.

hasVarUsesOrDefs

public boolean hasVarUsesOrDefs()
Can the operator have a variable number of uses or defs?

Returns:
true if the operator has a variable number of uses or defs or false if it does not.

isAcquire

public boolean isAcquire()
Is the operator an acquire (monitorenter/lock)?

Returns:
true if the operator is an acquire or false if it is not.

isRelease

public boolean isRelease()
Is the operator a release (monitorexit/unlock)?

Returns:
true if the operator is a release or false if it is not.

isDynamicLinkingPoint

public boolean isDynamicLinkingPoint()
Could the operator either directly or indirectly cause dynamic class loading?

Returns:
true if the operator is a dynamic linking point or false if it is not.

isYieldPoint

public boolean isYieldPoint()
Is the operator a yield point?

Returns:
true if the operator is a yield point or false if it is not.

isFpPop

public boolean isFpPop()
Does the operator pop the floating-point stack?

Returns:
true if the operator pops the floating-point stack. or false if not.

isFpPush

public boolean isFpPush()
Does the operator push on the floating-point stack?

Returns:
true if the operator pushes on the floating-point stack. or false if not.

isCommutative

public boolean isCommutative()
Is the operator commutative?

Returns:
true if the operator is commutative. or false if not.