public abstract class Instr extends Object
Modifier and Type | Field and Description |
---|---|
static Operand[] |
EMPTY_OPERANDS |
protected Operand[] |
operands |
Constructor and Description |
---|
Instr(Operation operation,
Operand[] operands) |
Modifier and Type | Method and Description |
---|---|
boolean |
canBeDeleted(IRScope s)
Can this instruction be deleted? LVA will preserve instructions based on whether operands (variables)
are living but even if there are no living variables then the instruction itself may not be able to be removed
during DCE for other reasons (like if it unconditionally has a side-effect or it happens to be living in a
scope where a binding can escape and one of its operands is a local variable).
|
boolean |
canRaiseException() |
abstract Instr |
clone(CloneInfo info)
Clone the instruction for use in an inlining context (either when a scope is inlined into
another scope, or when a block has to be cloned because its associated call belongs to
an inlined scope).
|
Operand[] |
cloneOperands(CloneInfo info) |
boolean |
computeScopeFlags(IRScope scope)
Does this instruction do anything the scope is interested in?
|
void |
encode(IRWriterEncoder e) |
int |
getIPC() |
Operand[] |
getOperands() |
Operation |
getOperation() |
int |
getRPC() |
List<Variable> |
getUsedVariables() |
boolean |
hasSideEffects() |
Object |
interpret(ThreadContext context,
StaticScope currScope,
DynamicScope currDynScope,
IRubyObject self,
Object[] temp) |
int |
interpretAndGetNewIPC(ThreadContext context,
DynamicScope currDynScope,
StaticScope currScope,
IRubyObject self,
Object[] temp,
int ipc) |
boolean |
isDead() |
void |
markDead() |
void |
renameVars(Map<Operand,Operand> renameMap) |
void |
setIPC(int ipc) |
void |
setRPC(int rpc) |
Operand |
simplifyAndGetResult(IRScope scope,
Map<Operand,Operand> valueMap)
This method takes as input a map of operands to their values, and outputs
the result of this instruction.
|
void |
simplifyOperands(Map<Operand,Operand> valueMap,
boolean force)
This method takes as input a map of operands to their values, and outputs
If the value map provides a value for any of the instruction's operands
this method is expected to replace the original operands with the simplified values.
|
String |
toString()
Instructions are meant to be in a machine-readable format so offline tooling can parse the
debugging output.
|
String[] |
toStringNonOperandArgs() |
boolean |
transfersControl() |
void |
visit(IRVisitor visitor) |
public static final Operand[] EMPTY_OPERANDS
protected Operand[] operands
public String[] toStringNonOperandArgs()
public void encode(IRWriterEncoder e)
public String toString()
public Operation getOperation()
public int getIPC()
public void setIPC(int ipc)
public int getRPC()
public void setRPC(int rpc)
public boolean hasSideEffects()
public boolean canRaiseException()
public boolean transfersControl()
public boolean computeScopeFlags(IRScope scope)
public boolean canBeDeleted(IRScope s)
public void markDead()
public boolean isDead()
public Operand[] getOperands()
public abstract Instr clone(CloneInfo info)
info
- This object manages renaming of variables and labels, handles
args and return values.public void simplifyOperands(Map<Operand,Operand> valueMap, boolean force)
public Operand simplifyAndGetResult(IRScope scope, Map<Operand,Operand> valueMap)
scope
- where this instr existsvalueMap
- Mapping from operands to their simplified valuespublic Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp)
public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc)
public void visit(IRVisitor visitor)
Copyright © 2001-2015 JRuby. All Rights Reserved.