public abstract class LIRGenerator extends Object implements LIRGeneratorTool
Modifier and Type | Class and Description |
---|---|
private class |
LIRGenerator.BlockScopeImpl |
static class |
LIRGenerator.Options |
LIRGeneratorTool.BlockScope, LIRGeneratorTool.SpillMoveFactory
Modifier and Type | Field and Description |
---|---|
private CallingConvention |
cc |
private AbstractBlockBase<?> |
currentBlock |
private LIRKindTool |
lirKindTool |
private CodeGenProviders |
providers |
private LIRGenerationResult |
res |
Constructor and Description |
---|
LIRGenerator(LIRKindTool lirKindTool,
CodeGenProviders providers,
CallingConvention cc,
LIRGenerationResult res) |
Modifier and Type | Method and Description |
---|---|
<I extends LIRInstruction> |
append(I op) |
AllocatableValue |
asAllocatable(Value value) |
RegisterAttributes |
attributes(Register register) |
void |
beforeRegisterAllocation()
Called just before register allocation is performed on the LIR owned by this generator.
|
protected abstract boolean |
canInlineConstant(JavaConstant c)
Checks whether the supplied constant can be used without loading it into a register for most
operations, i.e., for commonly used arithmetic, logical, and comparison operations.
|
LIRInstruction |
createBenchmarkCounter(String name,
String group,
Value increment) |
LIRInstruction |
createMultiBenchmarkCounter(String[] names,
String[] groups,
Value[] increments) |
protected abstract Variable |
emitAdd(LIRKind resultKind,
Value a,
Value b,
boolean setFlags) |
Variable |
emitAdd(Value aVal,
Value bVal,
boolean setFlags) |
void |
emitBlackhole(Value operand) |
abstract void |
emitCompareBranch(PlatformKind cmpKind,
Value left,
Value right,
Condition cond,
boolean unorderedIsTrue,
LabelRef trueDestination,
LabelRef falseDestination,
double trueDestinationProbability) |
abstract Variable |
emitConditionalMove(PlatformKind cmpKind,
Value leftVal,
Value right,
Condition cond,
boolean unorderedIsTrue,
Value trueValue,
Value falseValue) |
Variable |
emitForeignCall(ForeignCallLinkage linkage,
LIRFrameState frameState,
Value... args) |
protected abstract void |
emitForeignCallOp(ForeignCallLinkage linkage,
Value result,
Value[] arguments,
Value[] temps,
LIRFrameState info)
Emits the single call operation at the heart of generating LIR for a
foreign call.
|
void |
emitIncomingValues(Value[] params) |
abstract void |
emitIntegerTestBranch(Value left,
Value right,
LabelRef trueDestination,
LabelRef falseDestination,
double trueSuccessorProbability) |
abstract Variable |
emitIntegerTestMove(Value leftVal,
Value right,
Value trueValue,
Value falseValue) |
abstract void |
emitJump(LabelRef label) |
Value |
emitLoadConstant(LIRKind kind,
Constant constant) |
Variable |
emitMove(Value input) |
abstract void |
emitOverflowCheckBranch(LabelRef overflow,
LabelRef noOverflow,
LIRKind cmpKind,
double overflowProbability) |
void |
emitStrategySwitch(JavaConstant[] keyConstants,
double[] keyProbabilities,
LabelRef[] keyTargets,
LabelRef defaultTarget,
Variable value) |
abstract void |
emitStrategySwitch(SwitchStrategy strategy,
Variable key,
LabelRef[] keyTargets,
LabelRef defaultTarget) |
protected abstract Variable |
emitSub(LIRKind resultKind,
Value a,
Value b,
boolean setFlags) |
Variable |
emitSub(Value aVal,
Value bVal,
boolean setFlags) |
protected abstract void |
emitTableSwitch(int lowKey,
LabelRef defaultTarget,
LabelRef[] targets,
Value key) |
protected LIRKind |
getAddressKind(Value base,
long displacement,
Value index) |
LIRGeneratorTool.BlockScope |
getBlockScope(AbstractBlockBase<?> block) |
CallingConvention |
getCallingConvention() |
CodeCacheProvider |
getCodeCache() |
AbstractBlockBase<?> |
getCurrentBlock() |
ForeignCallsProvider |
getForeignCalls() |
LIRKind |
getLIRKind(Stamp stamp) |
protected LIRKindTool |
getLIRKindTool() |
MetaAccessProvider |
getMetaAccess() |
CodeGenProviders |
getProviders() |
LIRGenerationResult |
getResult() |
boolean |
hasBlockEnd(AbstractBlockBase<?> block) |
Variable |
load(Value value) |
Value |
loadNonConst(Value value) |
boolean |
needOnlyOopMaps()
Determines if only oop maps are required for the code generated from the LIR.
|
Variable |
newVariable(LIRKind lirKind)
Create a new
Variable . |
AllocatableValue |
resultOperandFor(LIRKind kind)
Gets the ABI specific operand used to return a value of a given kind from a method.
|
TargetDescription |
target() |
static AllocatableValue |
toStackKind(AllocatableValue value) |
protected JavaConstant |
zapValueForKind(PlatformKind kind)
Gets a garbage value for a given kind.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
emitAddress, emitArrayEquals, emitAtomicReadAndAdd, emitAtomicReadAndWrite, emitBitCount, emitBitScanForward, emitBitScanReverse, emitByteSwap, emitCompareAndSwap, emitCountLeadingZeros, emitCountTrailingZeros, emitData, emitDeoptimize, emitLoad, emitMembar, emitMove, emitNullCheck, emitReturn, emitStore, emitUnwind, getSpillMoveFactory
emitAnd, emitDiv, emitFloatConvert, emitMathAbs, emitMathSqrt, emitMul, emitMulHigh, emitNarrow, emitNegate, emitNot, emitOr, emitReinterpret, emitRem, emitShl, emitShr, emitSignExtend, emitUDiv, emitUMulHigh, emitURem, emitUShr, emitXor, emitZeroExtend
private final LIRKindTool lirKindTool
private final CodeGenProviders providers
private final CallingConvention cc
private AbstractBlockBase<?> currentBlock
private LIRGenerationResult res
public LIRGenerator(LIRKindTool lirKindTool, CodeGenProviders providers, CallingConvention cc, LIRGenerationResult res)
public TargetDescription target()
target
in interface LIRGeneratorTool
public CodeGenProviders getProviders()
getProviders
in interface LIRGeneratorTool
public MetaAccessProvider getMetaAccess()
getMetaAccess
in interface LIRGeneratorTool
public CodeCacheProvider getCodeCache()
getCodeCache
in interface LIRGeneratorTool
public ForeignCallsProvider getForeignCalls()
getForeignCalls
in interface LIRGeneratorTool
protected LIRKindTool getLIRKindTool()
public Variable newVariable(LIRKind lirKind)
LIRGeneratorTool
Variable
.newVariable
in interface LIRGeneratorTool
lirKind
- The type of the value that will be stored in this Variable
. See
LIRKind
for documentation on what to pass here. Note that in most cases,
simply passing Value.getLIRKind()
is wrong.Variable
.public RegisterAttributes attributes(Register register)
attributes
in interface LIRGeneratorTool
public Variable emitMove(Value input)
emitMove
in interface LIRGeneratorTool
public Value emitLoadConstant(LIRKind kind, Constant constant)
emitLoadConstant
in interface LIRGeneratorTool
public AllocatableValue asAllocatable(Value value)
asAllocatable
in interface LIRGeneratorTool
public Variable load(Value value)
load
in interface LIRGeneratorTool
protected abstract boolean canInlineConstant(JavaConstant c)
c
- The constant to check.public Value loadNonConst(Value value)
loadNonConst
in interface LIRGeneratorTool
public boolean needOnlyOopMaps()
needOnlyOopMaps
in interface LIRGeneratorTool
public AllocatableValue resultOperandFor(LIRKind kind)
resultOperandFor
in interface LIRGeneratorTool
kind
- the kind of value being returnedkind
public <I extends LIRInstruction> I append(I op)
append
in interface LIRGeneratorTool
public boolean hasBlockEnd(AbstractBlockBase<?> block)
hasBlockEnd
in interface LIRGeneratorTool
public final LIRGeneratorTool.BlockScope getBlockScope(AbstractBlockBase<?> block)
getBlockScope
in interface LIRGeneratorTool
public void emitIncomingValues(Value[] params)
emitIncomingValues
in interface LIRGeneratorTool
public abstract void emitJump(LabelRef label)
emitJump
in interface LIRGeneratorTool
public abstract void emitCompareBranch(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability)
emitCompareBranch
in interface LIRGeneratorTool
public abstract void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, LIRKind cmpKind, double overflowProbability)
emitOverflowCheckBranch
in interface LIRGeneratorTool
public abstract void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueSuccessorProbability)
emitIntegerTestBranch
in interface LIRGeneratorTool
public abstract Variable emitConditionalMove(PlatformKind cmpKind, Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue)
emitConditionalMove
in interface LIRGeneratorTool
public abstract Variable emitIntegerTestMove(Value leftVal, Value right, Value trueValue, Value falseValue)
emitIntegerTestMove
in interface LIRGeneratorTool
protected abstract void emitForeignCallOp(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info)
public static AllocatableValue toStackKind(AllocatableValue value)
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState frameState, Value... args)
emitForeignCall
in interface LIRGeneratorTool
public void emitStrategySwitch(JavaConstant[] keyConstants, double[] keyProbabilities, LabelRef[] keyTargets, LabelRef defaultTarget, Variable value)
emitStrategySwitch
in interface LIRGeneratorTool
public abstract void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget)
emitStrategySwitch
in interface LIRGeneratorTool
protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key)
public CallingConvention getCallingConvention()
getCallingConvention
in interface LIRGeneratorTool
public void beforeRegisterAllocation()
LIRGeneratorTool
beforeRegisterAllocation
in interface LIRGeneratorTool
protected JavaConstant zapValueForKind(PlatformKind kind)
public LIRKind getLIRKind(Stamp stamp)
getLIRKind
in interface ArithmeticLIRGenerator
protected LIRKind getAddressKind(Value base, long displacement, Value index)
public AbstractBlockBase<?> getCurrentBlock()
getCurrentBlock
in interface LIRGeneratorTool
public LIRGenerationResult getResult()
getResult
in interface LIRGeneratorTool
public void emitBlackhole(Value operand)
emitBlackhole
in interface LIRGeneratorTool
public LIRInstruction createBenchmarkCounter(String name, String group, Value increment)
createBenchmarkCounter
in interface BenchmarkCounterFactory
public LIRInstruction createMultiBenchmarkCounter(String[] names, String[] groups, Value[] increments)
createMultiBenchmarkCounter
in interface BenchmarkCounterFactory
public final Variable emitAdd(Value aVal, Value bVal, boolean setFlags)
emitAdd
in interface ArithmeticLIRGenerator