|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.ir.IRTools
public abstract class IRTools
This abstract class contains a bunch of useful static methods for performing operations on IR.
Constructor Summary | |
---|---|
IRTools()
|
Method Summary | |
---|---|
static RegisterOperand |
A(Register reg)
Create an integer register operand for a given register. |
static AddressConstantOperand |
AC(Address value)
Create an address constant operand with a given value. |
static AddressConstantOperand |
AC(Offset value)
|
static Instruction |
CPOS(Instruction src,
Instruction dst)
Copy the position information from the source instruction to the destination instruction, returning the source instruction. |
static RegisterOperand |
CR(Register reg)
Create a condition register operand for a given register. |
static RegisterOperand |
D(Register reg)
Create a double register operand for a given register. |
static DoubleConstantOperand |
DC(double value)
Create a long constant operand with a given value. |
static boolean |
defDoublesAsUse(Operand d,
Instruction s)
Is the operand d, which is a def in instruction s, also a def in instruction s? |
static boolean |
definedIn(Register r,
Instruction s)
Does instruction s define register r? |
static RegisterOperand |
F(Register reg)
Create a float register operand for a given register. |
static FloatConstantOperand |
FC(float value)
Create a long constant operand with a given value. |
static Operator |
getCondMoveOp(TypeReference type)
Returns the correct operator for a conditional move with the given data type. |
static Operand |
getDefaultOperand(TypeReference type)
Returns a constant operand with a default value for a given type |
static Operator |
getLoadOp(FieldReference field,
boolean isStatic)
Returns the correct operator for loading from the given field |
static Operator |
getLoadOp(TypeReference type,
boolean isStatic)
Returns the correct operator for loading a value of the given type |
static Operator |
getMoveOp(TypeReference type)
Returns the correct operator for moving the given data type. |
static Operator |
getStoreOp(FieldReference field,
boolean isStatic)
Returns the correct operator for storing to the given field. |
static Operator |
getStoreOp(TypeReference type,
boolean isStatic)
Returns the correct operator for storing a value of the given type |
static RegisterOperand |
I(Register reg)
Create an integer register operand for a given register. |
static IntConstantOperand |
IC(int value)
Create an integer constant operand with a given value. |
static void |
insertInstructionsAfter(Instruction after,
BasicBlock temp)
Inserts the instructions in the given basic block after the given instruction. |
static RegisterOperand |
L(Register reg)
Create a long register operand for a given register. |
static LongConstantOperand |
LC(long value)
Create a long constant operand with a given value. |
static BasicBlock |
makeBlockOnEdge(BasicBlock in,
BasicBlock out,
IR ir)
Make an empty basic block on an edge in the control flow graph, and fix up the control flow graph and IR instructions accordingly. |
static boolean |
mayBeVolatileFieldLoad(Instruction s)
Might this instruction be a load from a field that is declared to be volatile? |
static void |
moveInstruction(Instruction from,
Instruction to)
Moves the 'from' instruction to immediately before the 'to' instruction. |
static RegisterOperand |
moveIntoRegister(ArchitectureSpecificOpt.RegisterPool pool,
Instruction s,
Operand op)
Generates an instruction to move the given operand into a register, and inserts it before the given instruction. |
static RegisterOperand |
moveIntoRegister(TypeReference type,
Operator move_op,
ArchitectureSpecificOpt.RegisterPool pool,
Instruction s,
Operand op)
Generates an instruction to move the given operand into a register, and inserts it before the given instruction. |
static Instruction |
nonPEIGC(Instruction instr)
Mark the parameter as nonGC and nonPEI and return it. |
static TrueGuardOperand |
TG()
Create a new TrueGuardOperand. |
static boolean |
usedIn(Register r,
Instruction s)
Does instruction s use register r? |
static boolean |
useDoublesAsDef(Operand u,
Instruction s)
Is the operand u, which is a use in instruction s, also a def in instruction s? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IRTools()
Method Detail |
---|
public static RegisterOperand A(Register reg)
... Load.create(INT_LOAD, I(r2), A(r1), IC(4)) ...
reg
- the given register
public static RegisterOperand I(Register reg)
... Load.create(INT_LOAD, I(r2), A(r1), IC(4)) ...
reg
- the given register
public static RegisterOperand F(Register reg)
... Load.create(FLOAT_LOAD, F(r2), A(r1), IC(4)) ...
reg
- the given register
public static RegisterOperand D(Register reg)
... Load.create(DOUBLE_LOAD, D(r2), A(r1), IC(4)) ...
reg
- the given register
public static RegisterOperand L(Register reg)
... Binary.create(LONG_LOAD, L(r2), A(r1), IC(4)) ...
reg
- the given register
public static RegisterOperand CR(Register reg)
... Binary.create(INT_CMP, CR(c2), I(r1), IC(4)) ...
reg
- the given register
public static AddressConstantOperand AC(Address value)
....create(...., AC(Address.zero()) ...
value
- The address constant
public static AddressConstantOperand AC(Offset value)
public static IntConstantOperand IC(int value)
....create(...., IC(0) ...
value
- The int constant
public static LongConstantOperand LC(long value)
....create(...., LC(0L) ...
value
- the long value
public static FloatConstantOperand FC(float value)
....create(...., FC(0L) ...
value
- the float value
public static DoubleConstantOperand DC(double value)
....create(...., DC(0L) ...
value
- the double value
public static TrueGuardOperand TG()
....create(...., TG() ...
public static Instruction CPOS(Instruction src, Instruction dst)
instr.insertBack(CPOS(instr, Load.create(...)));
src
- the instruction to copy position information fromdst
- the instruction to copy position information to
public static Operand getDefaultOperand(TypeReference type)
type
- desired type
public static Operator getMoveOp(TypeReference type)
type
- desired type to move
public static Operator getCondMoveOp(TypeReference type)
type
- desired type to move
public static Operator getLoadOp(FieldReference field, boolean isStatic)
field
- field to load fromisStatic
- is the field static
public static Operator getLoadOp(TypeReference type, boolean isStatic)
type
- type of value to loadisStatic
- is the field static
public static Operator getStoreOp(FieldReference field, boolean isStatic)
field
- The field we're asking aboutisStatic
- is the field static
public static Operator getStoreOp(TypeReference type, boolean isStatic)
type
- desired type to storeisStatic
- is the field static
public static RegisterOperand moveIntoRegister(ArchitectureSpecificOpt.RegisterPool pool, Instruction s, Operand op)
pool
- register pool to allocate froms
- instruction to insert beforeop
- operand to copy to a register
public static RegisterOperand moveIntoRegister(TypeReference type, Operator move_op, ArchitectureSpecificOpt.RegisterPool pool, Instruction s, Operand op)
type
- type to movemove_op
- move operator to usepool
- register pool to allocate froms
- instruction to insert beforeop
- operand to copy to a register
public static void moveInstruction(Instruction from, Instruction to)
from
- instruction to moveto
- instruction after where you want it movedpublic static void insertInstructionsAfter(Instruction after, BasicBlock temp)
after
- instruction after where you want it insertedtemp
- basic block which contains the instructions to be inserted.public static BasicBlock makeBlockOnEdge(BasicBlock in, BasicBlock out, IR ir)
in -> bb -> out.Precondition : There is an edge in the control flow graph from * in -> out.
in
- the source of the control flow edgeout
- the sink of the control flow edgeir
- the governing IR
public static boolean useDoublesAsDef(Operand u, Instruction s)
TODO!!: This implementation is slow. Think about adding some IR support for this functionality; possibly add methods like enumeratePureDefs(), enumerateImpureUses(), etc ..., and restructure the caller to avoid having to call this function. Not going to put effort into this now, as the whole scratch register architecture has a questionable future.
public static boolean defDoublesAsUse(Operand d, Instruction s)
TODO!!: This implementation is slow. Think about adding some IR support for this functionality; possibly add methods like enumeratePureDefs(), enumerateImpureUses(), etc ..., and restructure the caller to avoid having to call this function. Not going to put effort into this now, as the whole scratch register architecture has a questionable future.
public static boolean definedIn(Register r, Instruction s)
public static boolean usedIn(Register r, Instruction s)
public static Instruction nonPEIGC(Instruction instr)
instr.insertBack(notPEIGC(Load.create(...)));
instr
- the given instruction
public static boolean mayBeVolatileFieldLoad(Instruction s)
s
- the insruction to check
true
if the instruction might be a load
from a volatile field or false
if it
cannot be a load from a volatile field
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |