<s> void JVMAsmBackend :: applyFixup ( const MCAssembler & Asm , const MCFixup & Fixup , const MCValue & Target , MutableArrayRef < char > Data , uint64_t Value , bool IsResolved , const MCSubtargetInfo * STI ) const { return ; } </s>

Apply the Value for given Fixup into the provided data fragment , at the offset specified by the fixup and following the fixup kind as appropriate .


<s> bool JVMAsmBackend :: fixupNeedsRelaxation ( const MCFixup & Fixup , uint64_t Value , const MCRelaxableFragment * DF , const MCAsmLayout & Layout ) const { return false ; } </s>

Simple predicate for targets where ! Resolved implies requiring relaxation .


<s> unsigned JVMAsmBackend :: getNumFixupKinds ( ) const { return 0 ; } </s>

Get the number of target specific fixup kinds .


<s> bool JVMAsmBackend :: mayNeedRelaxation ( const MCInst & Inst , const MCSubtargetInfo & STI ) const { return false ; } </s>

Check whether the given instruction may need relaxation .


<s> void JVMAsmBackend :: relaxInstruction ( const MCInst & Inst , const MCSubtargetInfo & STI , MCInst & Res ) const { return ; } </s>

Relax the instruction in the given fragment to the next wider instruction .


<s> bool JVMAsmBackend :: writeNopData ( raw_ostream & OS , uint64_t Count ) const { return false ; } </s>

Write an ( optimal ) nop sequence of Count bytes to the given output .


<s>
void
JVMAsmPrinter
::
EmitInstruction
(
const
MachineInstr
*
MI
)
{
if
(
IsSkipInstruction
(
*
MI
)
)
return
;
LLVM_DEBUG
(
dbgs
(
)
<<
"EmitInstruction: "
<<
*
MI
<<
'\n'
)
;
JVMMCInstLower
InstLower
(
OutContext
,
*
this
)
;
MCInst
TmpInst
;
InstLower
.
Lower
(
MI
,
TmpInst
)
;
EmitToStreamer
(
*
OutStreamer
,
TmpInst
)
;
}
</s>

EmitInstruction - This callback is invoked when an instruction is emitted , to advance the hazard state .


<s>
StringRef
getPassName
(
)
const
override
{
return
"JVM Assembly Printer"
;
}
</s>

getPassName - Return a nice clean name for a pass .


<s> const JVMSubtarget & getSubtarget ( ) const { return * Subtarget ; } </s>

getSubtarget - Return the subtarget for which this machine code is being compiled .


<s> const MCExpr * JVMAsmPrinter :: lowerConstant ( const Constant * CV ) { return AsmPrinter :: lowerConstant ( CV ) ; } </s>

Lower the specified LLVM Constant to an MCExpr .


"There are no defined alternate asm variants"

PrintAsmOperand - Print out an operand for an inline asm expression .


<s> bool runOnMachineFunction ( MachineFunction & MF ) override { Subtarget = & MF . getSubtarget < JVMSubtarget > ( ) ; MRI = & MF . getRegInfo ( ) ; MFI = MF . getInfo < JVMFunctionInfo > ( ) ; OutStreamer -> SetFunctionInfo ( MFI -> getDescVector ( ) ) ; return AsmPrinter :: runOnMachineFunction ( MF ) ; } </s>

runOnMachineFunction - Emit the function body .


<s> static JVMAssemblerImpl * getInst ( ) { if ( ! inst ) { inst = new JVMAssemblerImpl ( ) ; } return inst ; } </s>

If this is a normal dependency , returns the instruction that is depended on .


<s> int getSize ( ) { return size ; } </s>

Return the number of bytes in the encoding of this instruction , or zero if the encoding size can not be known from the opcode .


<s> void setFunction ( Function & F ) { Func = & F ; } </s>

Initialize data structures for specified new function .


<s>
void
CompositeHandler
::
dump
(
)
{
for
(
auto
Ty
:
typeDefs
)
{
LLVM_DEBUG
(
{
dbgs
(
)
<<
"Type : "
;
Ty
.
first
->
dump
(
)
;
dbgs
(
)
<<
"Values:"
;
for
(
auto
Val
:
typeValues
[
Ty
.
first
]
)
Val
->
dump
(
)
;
dbgs
(
)
<<
"Flattend Type :"
;
if
(
Ty
.
second
)
Ty
.
second
->
dump
(
)
;
else
dbgs
(
)
<<
"<null>"
;
dbgs
(
)
<<
"\n"
;
}
)
;
}
}
</s>

Dump the plan to stderr ( for debugging ) .

JVM
"Type : "
"Values:"
"Flattend Type :"
"<null>"
"\n"


<s> int CompositeHandler :: getNumElements ( Type * Ty , bool AccessMemFormFlatStruct ) { int NumElems = 0 ; Type * TyKey = reinterpret_cast < Type * > ( reinterpret_cast < char * > ( Ty ) + ( int ) AccessMemFormFlatStruct ) ; if ( typeNumElemCache . find ( TyKey ) != typeNumElemCache . end ( ) ) return typeNumElemCache [ TyKey ] ; if ( isa < StructType > ( Ty ) ) { StructType * STy = cast < StructType > ( Ty ) ; for ( StructType :: element_iterator EB = STy -> element_begin ( ) , EI = EB , EE = STy -> element_end ( ) ; EI != EE ; ++ EI ) { if ( CompositeType :: classof ( * EI ) ) NumElems += getNumElements ( * EI , AccessMemFormFlatStruct ) ; else NumElems += 1 ; } } else if ( isa < ArrayType > ( Ty ) ) { Type * ElmTy = cast < ArrayType > ( Ty ) -> getElementType ( ) ; bool exploreArr = ! CheckIfFlattendType ( ElmTy ) || ! AccessMemFormFlatStruct ; if ( isa < StructType > ( ElmTy ) || ( isa < ArrayType > ( ElmTy ) && exploreArr ) ) { int NumArrElems = cast < ArrayType > ( Ty ) -> getNumElements ( ) ; NumElems += NumArrElems * getNumElements ( ElmTy , AccessMemFormFlatStruct ) ; } else NumElems += exploreArr ? cast < ArrayType > ( Ty ) -> getNumElements ( ) : 1 ; } else if ( isa < PointerType > ( Ty ) ) { NumElems += getNumElements ( cast < PointerType > ( Ty ) -> getElementType ( ) , AccessMemFormFlatStruct ) ; } else NumElems += 1 ; typeNumElemCache [ TyKey ] = NumElems ; return NumElems ; } </s>


<s> void CompositeHandler :: visitCallInst ( CallInst & I ) { for ( Value * Arg : I . arg_operands ( ) ) { visitValue ( Arg , Arg -> getType ( ) ) ; } } </s>


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { AU . setPreservesCFG ( ) ; MachineFunctionPass :: getAnalysisUsage ( AU ) ; AU . addRequired < MachineDominatorTree > ( ) ; } </s>

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this .


<s> void releaseMemory ( ) override { } </s>

releaseMemory ( ) - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed .


<s> MCDisassembler :: DecodeStatus JVMDisassembler :: getInstruction ( MCInst & MI , uint64_t & Size , ArrayRef < uint8_t > Bytes , uint64_t , raw_ostream & OS , raw_ostream & CS ) const { return MCDisassembler :: Fail ; } </s>

Returns the disassembly of a single instruction .


<s> void JVMFrameLowering :: emitEpilogue ( MachineFunction & MF , MachineBasicBlock & MBB ) const { } </s>


<s> void JVMFrameLowering :: emitPrologue ( MachineFunction & MF , MachineBasicBlock & MBB ) const { } </s>

emitProlog/emitEpilog - These methods insert prolog and epilog code into the function .


<s> bool JVMFrameLowering :: hasFP ( const MachineFunction & MF ) const { return false ; } </s>

hasFP - Return true if the specified function should have a dedicated frame pointer register .


<s> void JVMInstPrinter :: printInst ( const MCInst * MI , raw_ostream & OS , StringRef Annot , const MCSubtargetInfo & ) { printInstruction ( MI , OS ) ; printAnnotation ( OS , Annot ) ; } </s>

Print the specified MCInst to the specified raw_ostream .


<s>
bool
JVMInstrInfo
::
analyzeBranch
(
MachineBasicBlock
&
MBB
,
MachineBasicBlock
*
&
TBB
,
MachineBasicBlock
*
&
FBB
,
SmallVectorImpl
<
MachineOperand
>
&
Cond
,
bool
AllowModify
)
const
{
MachineInstr
*
UBR
=
nullptr
;
MachineInstr
*
CBR
=
nullptr
;
for
(
auto
ritr
=
MBB
.
instr_rbegin
(
)
;
ritr
!=
MBB
.
instr_rend
(
)
;
ritr
++
)
{
MachineInstr
&
MI
=
*
ritr
;
if
(
!
MI
.
isBranch
(
)
)
break
;
if
(
!
IsConditionalBranch
(
MI
)
)
{
assert
(
!
UBR
&&
"Multiple-unconditional branches"
)
;
UBR
=
&
MI
;
}
else
{
assert
(
!
CBR
&&
"Multiple-conditional branches"
)
;
CBR
=
&
MI
;
}
}
if
(
nullptr
==
CBR
&&
nullptr
==
UBR
)
return
true
;
else
if
(
UBR
&&
!
CBR
)
{
TBB
=
UBR
->
getOperand
(
0
)
.
getMBB
(
)
;
}
else
if
(
CBR
)
{
TBB
=
CBR
->
getOperand
(
CBR
->
getNumOperands
(
)
1
)
.
getMBB
(
)
;
for
(
unsigned
i
=
0
;
i
<
CBR
->
getNumOperands
(
)
2
;
i
++
)
Cond
.
push_back
(
CBR
->
getOperand
(
i
)
)
;
FBB
=
UBR
UBR
->
getOperand
(
0
)
.
getMBB
(
)
:
nullptr
;
}
else
{
llvm_unreachable
(
"Unhandled banching"
)
;
}
return
false
;
}
</s>

analyzeBranch - Analyze the branching code at the end of MBB , returning true if it can not be understood ( e.g .


<s> bool analyzeSelect ( const MachineInstr & MI , SmallVectorImpl < MachineOperand > & Cond , unsigned & TrueOp , unsigned & FalseOp , bool & Optimizable ) const override { return false ; } </s>

Analyze the given select instruction , returning true if it can not be understood .


<s>
void
JVMInstrInfo
::
copyPhysReg
(
MachineBasicBlock
&
MBB
,
MachineBasicBlock
::
iterator
I
,
const
DebugLoc
&
DL
,
unsigned
DestReg
,
unsigned
SrcReg
,
bool
KillSrc
)
const
{
llvm_unreachable
(
"Unsupported copyPhysReg."
)
;
}
</s>


<s> const JVMRegisterInfo & getRegisterInfo ( ) const { return RI ; } </s>

getRegisterInfo - TargetInstrInfo is a superset of MRegister info .


<s> unsigned JVMInstrInfo :: removeBranch ( MachineBasicBlock & MBB , int * BytesRemoved ) const { unsigned Count = 0 ; for ( auto ritr = MBB . instr_rbegin ( ) ; ritr != MBB . instr_rend ( ) ; ritr ++ ) { MachineInstr & MI = * ritr ; if ( ! MI . isBranch ( ) ) break ; MI . eraseFromParent ( ) ; Count ++ ; } return Count ; } </s>

Remove the branching code at the end of the specific MBB .


<s>
bool
JVMInstrInfo
::
reverseBranchCondition
(
SmallVectorImpl
<
MachineOperand
>
&
Cond
)
const
{
MachineOperand
&
MO
=
Cond
[
0
]
;
unsigned
NewCond
;
switch
(
MO
.
getImm
(
)
)
{
default
:
llvm_unreachable
(
"Unhandled conditon"
)
;
case
JVM
::
IFICMPEQ
:
NewCond
=
JVM
::
IFICMPNE
;
break
;
case
JVM
::
IFICMPNE
:
NewCond
=
JVM
::
IFICMPEQ
;
break
;
case
JVM
::
IFICMPGT
:
NewCond
=
JVM
::
IFICMPLE
;
break
;
case
JVM
::
IFICMPGE
:
NewCond
=
JVM
::
IFICMPLT
;
break
;
case
JVM
::
IFICMPLT
:
NewCond
=
JVM
::
IFICMPGE
;
break
;
case
JVM
::
IFICMPLE
:
NewCond
=
JVM
::
IFICMPGT
;
break
;
case
JVM
::
IFEQ
:
NewCond
=
JVM
::
IFNE
;
break
;
case
JVM
::
IFGT
:
NewCond
=
JVM
::
IFLE
;
break
;
case
JVM
::
IFGE
:
NewCond
=
JVM
::
IFLT
;
break
;
case
JVM
::
IFLT
:
NewCond
=
JVM
::
IFGE
;
break
;
case
JVM
::
IFLE
:
NewCond
=
JVM
::
IFGT
;
break
;
case
JVM
::
IFNE
:
NewCond
=
JVM
::
IFEQ
;
break
;
}
Cond
[
0
]
.
setImm
(
NewCond
)
;
return
false
;
}
</s>

Reverses the branch condition of the specified condition list , returning false on success and true if it can not be reversed .

JVM
JVM
0
"Unhandled conditon"
JVM::IFICMPEQ
JVM::IFICMPNE
JVM::IFICMPNE
JVM::IFICMPEQ
JVM::IFICMPGT
JVM::IFICMPLE
JVM::IFICMPGE
JVM::IFICMPLT
JVM::IFICMPLT
JVM::IFICMPGE
JVM::IFICMPLE
JVM::IFICMPGT
JVM::IFEQ
JVM::IFNE
JVM::IFGT
JVM::IFLE
JVM::IFGE
JVM::IFLT
JVM::IFLT
JVM::IFGE
JVM::IFLE
JVM::IFGT
JVM::IFNE
JVM::IFEQ
0


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { getLoopAnalysisUsage ( AU ) ; } </s>


<s> bool runOnFunction ( Function & F ) override { Func = & F ; DT = & getAnalysis < DominatorTreeWrapperPass > ( ) . getDomTree ( ) ; return ProcessFunction ( ) ; } </s>

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass .


<s>
StringRef
getPassName
(
)
const
override
{
return
"JVM Instruction Selection"
;
}
</s>

getPassName - Return a nice clean name for a pass .


"Global constants structure not present"

runOnMachineFunction - Emit the function body .


<s>
void
JVMDAGToDAGISel
::
Select
(
SDNode
*
Node
)
{
LLVM_DEBUG
(
errs
(
)
<<
"Selecting: "
)
;
LLVM_DEBUG
(
Node
->
dump
(
CurDAG
)
)
;
LLVM_DEBUG
(
errs
(
)
<<
"\n"
)
;
if
(
Node
->
isMachineOpcode
(
)
)
{
LLVM_DEBUG
(
errs
(
)
<<
"== "
;
Node
->
dump
(
CurDAG
)
;
errs
(
)
<<
"\n"
)
;
Node
->
setNodeId
(
1
)
;
return
;
}
EVT
VT
=
Node
->
getValueType
(
0
)
;
switch
(
Node
->
getOpcode
(
)
)
{
default
:
break
;
(
void
)
VT
;
}
SelectCode
(
Node
)
;
}
</s>

Main hook for targets to transform nodes into machine nodes .

JVM
JVM
"Selecting: "
"\n"
"== "
"\n"
1
0


<s> bool JVMTargetLowering :: CanLowerReturn ( CallingConv :: ID , MachineFunction & , bool , const SmallVectorImpl < ISD :: OutputArg > & Outs , LLVMContext & ) const { return Outs . size ( ) <= 1 ; } </s>

This hook should be implemented to check whether the return values described by the Outs array can fit into the return registers .


<s> void JVMTargetLowering :: finalizeLowering ( MachineFunction & MF ) const { auto & MRI = MF . getRegInfo ( ) ; MRI . freezeReservedRegs ( MF ) ; } </s>

Execute target specific actions to finalize target lowering .


<s>
const
char
*
JVMTargetLowering
::
getTargetNodeName
(
unsigned
Opcode
)
const
{
switch
(
Opcode
)
{
default
:
llvm_unreachable
(
"Unhandled target opcode.\n"
)
;
break
;
case
JVMISD
::
ALLOC
:
return
"JVMISD::ALLOC"
;
case
JVMISD
::
ADD
:
return
"JVMISD::ADD"
;
case
JVMISD
::
AND
:
return
"JVMISD::AND"
;
case
JVMISD
::
DIV
:
return
"JVMISD::DIV"
;
case
JVMISD
::
EXTEND
:
return
"JVMISD::EXTEND"
;
case
JVMISD
::
ARGUMENT
:
return
"JVMISD::ARGUMENT"
;
case
JVMISD
::
LOAD
:
return
"JVMISD::LOAD"
;
case
JVMISD
::
LOAD_W_CHAIN
:
return
"JVMISD::LOAD_W_CHAIN"
;
case
JVMISD
::
MUL
:
return
"JVMISD::MUL"
;
case
JVMISD
::
SHL
:
return
"JVMISD::SHL"
;
case
JVMISD
::
SRL
:
return
"JVMISD::SRL"
;
case
JVMISD
::
SRA
:
return
"JVMISD::SRA"
;
case
JVMISD
::
STORENR
:
return
"JVMISD::STORENR"
;
case
JVMISD
::
STORE
:
return
"JVMISD::STORE"
;
case
JVMISD
::
TRUNC
:
return
"JVMISD::TRUNC"
;
case
JVMISD
::
FIELD_ACC_R
:
return
"JVMISD::FIELD_ACC_R"
;
case
JVMISD
::
FIELD_ACC_W
:
return
"JVMISD::FIELD_ACC_W"
;
case
JVMISD
::
INDEX_ACC
:
return
"JVMISD::INDEX_ACC"
;
case
JVMISD
::
INVOKENV
:
return
"JVMISD::INVOKENV"
;
case
JVMISD
::
OR
:
return
"JVMISD::OR"
;
case
JVMISD
::
SUB
:
return
"JVMISD::SUB"
;
case
JVMISD
::
CMP
:
return
"JVMISD::CMP"
;
case
JVMISD
::
CALL
:
return
"JVMISD::CALL"
;
case
JVMISD
::
REM
:
return
"JVMISD::REM"
;
case
JVMISD
::
RET
:
return
"JVMISD::RET"
;
case
JVMISD
::
DUP
:
return
"JVMISD::DUP"
;
case
JVMISD
::
BR_CC
:
return
"JVMISD::BR_CC"
;
case
JVMISD
::
BR_CONST_CC
:
return
"JVMISD::BR_CONST_CC"
;
case
JVMISD
::
XOR
:
return
"JVMISD::XOR"
;
}
return
nullptr
;
}
</s>

getTargetNodeName - This method returns the name of a target specific

JVM
JVM
"Unhandled target opcode.\n"
JVMISD::ALLOC
"JVMISD::ALLOC"
JVMISD::ADD
"JVMISD::ADD"
JVMISD::AND
"JVMISD::AND"
JVMISD::DIV
"JVMISD::DIV"
JVMISD::EXTEND
"JVMISD::EXTEND"
JVMISD::ARGUMENT
"JVMISD::ARGUMENT"
JVMISD::LOAD
"JVMISD::LOAD"
JVMISD::LOAD_W_CHAIN
"JVMISD::LOAD_W_CHAIN"
JVMISD::MUL
"JVMISD::MUL"
JVMISD::SHL
"JVMISD::SHL"
JVMISD::SRL
"JVMISD::SRL"
JVMISD::SRA
"JVMISD::SRA"
JVMISD::STORENR
"JVMISD::STORENR"
JVMISD::STORE
"JVMISD::STORE"
JVMISD::TRUNC
"JVMISD::TRUNC"
JVMISD::FIELD_ACC_R
"JVMISD::FIELD_ACC_R"
JVMISD::FIELD_ACC_W
"JVMISD::FIELD_ACC_W"
JVMISD::INDEX_ACC
"JVMISD::INDEX_ACC"
JVMISD::INVOKENV
"JVMISD::INVOKENV"
JVMISD::OR
"JVMISD::OR"
JVMISD::SUB
"JVMISD::SUB"
JVMISD::CMP
"JVMISD::CMP"
JVMISD::CALL
"JVMISD::CALL"
JVMISD::REM
"JVMISD::REM"
JVMISD::RET
"JVMISD::RET"
JVMISD::DUP
"JVMISD::DUP"
JVMISD::BR_CC
"JVMISD::BR_CC"
JVMISD::BR_CONST_CC
"JVMISD::BR_CONST_CC"
JVMISD::XOR
"JVMISD::XOR"


<s> bool isSuitableForJumpTable ( const SwitchInst * SI , uint64_t NumCases , uint64_t Range ) const override { return false ; } </s>

Return true if lowering to a jump table is suitable for a set of case clusters which may contain NumCases cases , Range range of values .


"JVM doesn't support non-C calling conventions"

"JVM hasn't implemented inalloca arguments"

"JVM hasn't implemented cons regs arguments"

"JVM hasn't implemented cons regs last arguments"

This hook must be implemented to lower the incoming ( formal ) arguments , described by the Ins array , into the specified DAG .


<s>
SDValue
JVMTargetLowering
::
LowerOperation
(
SDValue
Op
,
SelectionDAG
&
DAG
)
const
{
SDLoc
DL
(
Op
)
;
auto
PtrVT
=
getPointerTy
(
DAG
.
getDataLayout
(
)
)
;
switch
(
Op
.
getOpcode
(
)
)
{
default
:
llvm_unreachable
(
"unimplemented operation lowering"
)
;
return
SDValue
(
)
;
case
ISD
::
ARRAY_REF
:
return
LowerARRAY_REF
(
Op
,
DAG
)
;
case
ISD
::
STRUCT_REF
:
return
LowerSTRUCT_REF
(
Op
,
DAG
)
;
case
ISD
::
BRCOND
:
return
LowerBRCOND
(
Op
,
DAG
)
;
case
ISD
::
BR_CC
:
return
LowerBR_CC
(
Op
,
DAG
)
;
case
ISD
::
DYNAMIC_STACKALLOC
:
return
LowerDYNAMIC_STACKALLOC
(
Op
,
DAG
)
;
case
ISD
::
SHL
:
case
ISD
::
SRA
:
case
ISD
::
SRL
:
case
ISD
::
OR
:
case
ISD
::
AND
:
case
ISD
::
XOR
:
case
ISD
::
ADD
:
case
ISD
::
SUB
:
case
ISD
::
MUL
:
case
ISD
::
UDIV
:
case
ISD
::
SDIV
:
case
ISD
::
UREM
:
case
ISD
::
SREM
:
return
LowerBinaryOp
(
Op
,
DAG
)
;
case
ISD
::
LOAD
:
return
LowerLOAD
(
Op
,
DAG
)
;
case
ISD
::
STORE
:
return
LowerSTORE
(
Op
,
DAG
)
;
case
ISD
::
GlobalAddress
:
return
LowerGlobalAddress
(
Op
,
DAG
,
PtrVT
)
;
case
ISD
::
ZERO_EXTEND
:
case
ISD
::
SIGN_EXTEND
:
case
ISD
::
ANY_EXTEND
:
case
ISD
::
SIGN_EXTEND_INREG
:
return
LowerEXTEND
(
Op
,
DAG
)
;
case
ISD
::
TRUNCATE
:
return
LowerTRUNCATE
(
Op
,
DAG
)
;
}
}
</s>

LowerOperation - Provide custom lowering hooks for some operations .

JVM
JVM
"unimplemented operation lowering"
ISD::ARRAY_REF
ISD::STRUCT_REF
ISD::BRCOND
ISD::BR_CC
ISD::DYNAMIC_STACKALLOC
ISD::SHL
ISD::SRA
ISD::SRL
ISD::OR
ISD::AND
ISD::XOR
ISD::ADD
ISD::SUB
ISD::MUL
ISD::UDIV
ISD::SDIV
ISD::UREM
ISD::SREM
ISD::LOAD
ISD::STORE
ISD::GlobalAddress
ISD::ZERO_EXTEND
ISD::SIGN_EXTEND
ISD::ANY_EXTEND
ISD::SIGN_EXTEND_INREG
ISD::TRUNCATE


"JVM hasn't implemented inalloca results"

"JVM hasn't implemented cons regs results"

"JVM hasn't implemented cons regs last results"

This hook must be implemented to lower outgoing return values , described by the Outs array , into the specified DAG .


<s> SDValue JVMTargetLowering :: PerformDAGCombine ( SDNode * N , DAGCombinerInfo & DCI ) const { return SDValue ( N , 0 ) ; } </s>

This method will be invoked for all target nodes and for any target-independent nodes that the target has registered with invoke it for .


"\n******** JVM Load/Store Elimination Optimization ********\n"


<s> bool runOnFunction ( Function & F ) override { Func = & F ; return ProcessFunction ( ) ; } </s>


<s> void JVMFunctionInfo :: Initialize ( ) { EmitGlobConsts = false ; NumArguments = 0 ; StackLimit = 0 ; LocalsLimit = 0 ; } </s>

This method must be called before any actual lowering is done .


<s> bool isValidUnquotedName ( StringRef Name ) const override { return true ; } </s>

Return true if the identifier Name does not need quotes to be syntactically correct .


<s> static MCAsmInfo * createMCAsmInfo ( const MCRegisterInfo & , const Triple & TT ) { return new JVMMCAsmInfo ( TT ) ; } </s>

createMCAsmInfo - Create a MCAsmInfo implementation for the specified target triple .


<s> static MCInstrInfo * createMCInstrInfo ( ) { MCInstrInfo * X = new MCInstrInfo ( ) ; InitJVMMCInstrInfo ( X ) ; return X ; } </s>

createMCInstrInfo - Create a MCInstrInfo implementation .


<s> static MCSubtargetInfo * createMCSubtargetInfo ( const Triple & TT , StringRef CPU , StringRef FS ) { return createJVMMCSubtargetInfoImpl ( TT , CPU , FS ) ; } </s>

createMCSubtargetInfo - Create a MCSubtargetInfo implementation .


"Entry block with non-zero block Number."

Returns true if this is the entry block of the function .


"\n******** JVM Offset allocation ********\n"


"\n******** JVM Store/Dup insertion ********\n"


<s> void JVMRegisterInfo :: eliminateFrameIndex ( MachineBasicBlock :: iterator II , int SPAdj , unsigned FIOperandNum , RegScavenger * ) const { } </s>

This method must be overriden to eliminate abstract frame indices from instructions which may use them .


<s> const MCPhysReg * JVMRegisterInfo :: getCalleeSavedRegs ( const MachineFunction * ) const { static const MCPhysReg CalleeSavedRegs [ ] = { 0 } ; return CalleeSavedRegs ; } </s>


<s> unsigned JVMRegisterInfo :: getFrameRegister ( const MachineFunction & MF ) const { return 0 ; } </s>


<s>
const
TargetRegisterClass
*
JVMRegisterInfo
::
getPointerRegClass
(
const
MachineFunction
&
MF
,
unsigned
Kind
)
const
{
assert
(
Kind
==
0
&&
"Only one kind of pointer on JVM"
)
;
if
(
MF
.
getSubtarget
<
JVMSubtarget
>
(
)
.
hasAddr64
(
)
)
return
&
JVM
::
I64RegClass
;
return
&
JVM
::
I32RegClass
;
}
</s>

getPointerRegClass - Returns a TargetRegisterClass used for pointer values .


<s> BitVector JVMRegisterInfo :: getReservedRegs ( const MachineFunction & MF ) const { BitVector resRegs ( getNumRegs ( ) ) ; return resRegs . set ( ) ; } </s>

getReservedRegs - Returns a bitset indexed by physical register number indicating if a register is a special register that has particular uses and should be considered unavailable at all times , e.g .


<s> bool JVMSubtarget :: enableMachineScheduler ( ) const { return false ; } </s>

Enable the MachineScheduler pass for all X86 subtargets .


<s> const JVMInstrInfo * getInstrInfo ( ) const override { return & InstrInfo ; } </s>


<s> const JVMRegisterInfo * getRegisterInfo ( ) const override { return & getInstrInfo ( ) -> getRegisterInfo ( ) ; } </s>

getRegisterInfo - TargetInstrInfo is a superset of MRegister info .


<s> const Triple & getTargetTriple ( ) const { return TargetTriple ; } </s>

Get the target triple which is a string describing the target host .


<s> JVMSubtarget & JVMSubtarget :: initializeSubtargetDependencies ( StringRef FS ) { if ( CPUString . empty ( ) ) CPUString = "jvm" ; return * this ; } </s>

initializeSubtargetDependencies - Initializes using a CPU , a TuneCPU , and feature string so that we can use initializer lists for subtarget initialization .


<s> bool JVMSubtarget :: useAA ( ) const { return true ; } </s>

Enable use of alias analysis during code generation ( during MI scheduling , DAGCombine , etc . ) .


<s> void JVMPassConfig :: addCodeGenPrepare ( ) { } </s>

Add pass to prepare the LLVM IR for code generation .


<s> bool addGCPasses ( ) override { return false ; } </s>

addGCPasses - Add late codegen passes that analyze code for garbage collection .


<s> bool JVMPassConfig :: addInstSelector ( ) { ( void ) TargetPassConfig :: addInstSelector ( ) ; addPass ( createJVMISelDag ( getJVMTargetMachine ( ) , getOptLevel ( ) ) ) ; return false ; } </s>

addInstSelector - This method should install an instruction selector pass , which converts from LLVM code to machine instructions .


<s> void JVMPassConfig :: addIRPasses ( ) { TargetPassConfig :: addIRPasses ( ) ; addPass ( createJVMLowerMemoryIntrinsics ( ) ) ; addPass ( createAggressiveDCEPass ( ) ) ; if ( JvmAggOpt ) addPass ( createInstructionCombiningPass ( ) ) ; addPass ( createJVMIRDecorator ( ) ) ; addPass ( createAggressiveDCEPass ( ) ) ; if ( JvmAggOpt ) addPass ( createInstructionCombiningPass ( ) ) ; if ( JvmClient ) addPass ( createX2JavaPass ( ) ) ; } </s>

Add common target configurable passes that perform LLVM IR to IR transforms following machine independent optimization .


<s> void JVMPassConfig :: addMachinePasses ( ) { addPass ( & PHIEliminationID , false ) ; addPass ( createJVMPreAllocationFixups ( ) ) ; addPass ( createJVMCopyElision ( ) ) ; addPreEmitPass ( ) ; } </s>

Add the complete , standard set of LLVM CodeGen passes .


<s> void JVMPassConfig :: addOptimizedRegAlloc ( FunctionPass * RegAllocPass ) { disablePass ( & RegisterCoalescerID ) ; TargetPassConfig :: addOptimizedRegAlloc ( RegAllocPass ) ; } </s>

addOptimizedRegAlloc - Add passes related to register allocation .


<s> void JVMPassConfig :: addPostRegAlloc ( ) { disablePass ( & ShrinkWrapID ) ; disablePass ( & MachineCopyPropagationID ) ; disablePass ( & PostRASchedulerID ) ; disablePass ( & FuncletLayoutID ) ; disablePass ( & StackMapLivenessID ) ; disablePass ( & LiveDebugValuesID ) ; disablePass ( & PatchableFunctionID ) ; disablePass ( & PrologEpilogCodeInserterID ) ; TargetPassConfig :: addPostRegAlloc ( ) ; } </s>

This method may be implemented by targets that want to run passes after register allocation pass pipeline but before prolog-epilog insertion .


<s> void JVMPassConfig :: addPreEmitPass ( ) { TargetPassConfig :: addPreEmitPass ( ) ; if ( JvmLSOpt ) addPass ( createJVMLoadStoreEliminationOpt ( ) ) ; addPass ( createJVMOffsetAllocator ( ) ) ; addPass ( createJVMPostAllocationFixups ( ) ) ; } </s>

This pass may be implemented by targets that want to run passes immediately before machine code is emitted .


<s> TargetPassConfig * JVMTargetMachine :: createPassConfig ( PassManagerBase & PM ) { return new JVMPassConfig ( * this , PM ) ; } </s>

Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of CodeGen passes .


<s> FunctionPass * JVMPassConfig :: createTargetRegisterAllocator ( bool ) { return nullptr ; } </s>

createTargetRegisterAllocator - Create the register allocator pass for this target at the current optimization level .


<s> TargetLoweringObjectFile * getObjFileLowering ( ) const override { return TLOF . get ( ) ; } </s>

Return information about object file lowering .


<s> const JVMSubtarget * JVMTargetMachine :: getSubtargetImpl ( const Function & F ) const { Attribute CPUAttr = F . getFnAttribute ( "target-cpu" ) ; Attribute FSAttr = F . getFnAttribute ( "target-features" ) ; std :: string CPU = ! CPUAttr . hasAttribute ( Attribute :: None ) ? CPUAttr . getValueAsString ( ) . str ( ) : TargetCPU ; std :: string FS = ! FSAttr . hasAttribute ( Attribute :: None ) ? FSAttr . getValueAsString ( ) . str ( ) : TargetFS ; auto & I = SubtargetMap [ CPU + FS ] ; if ( ! I ) { resetTargetOptions ( F ) ; I = llvm :: make_unique < JVMSubtarget > ( TargetTriple , CPU , FS , * this ) ; } return I . get ( ) ; } </s>

Virtual method implemented by subclasses that returns a reference to that target 's TargetSubtargetInfo-derived member variable .

JVM JVM JVM "target-cpu" "target-features" JVM


<s> void JVMTargetObjectFile :: Initialize ( MCContext & Ctx , const TargetMachine & TM ) { TargetLoweringObjectFileELF :: Initialize ( Ctx , TM ) ; InitializeELF ( TM . Options . UseInitArray ) ; } </s>

This method must be called before any actual lowering is done .


<s> void changeSection ( const MCSection * CurSection , MCSection * Section , const MCExpr * SubSection , raw_ostream & OS ) override { } </s>

Update streamer for a new active section .


<s> void flush ( ) { OS . flush ( ) ; } </s>

Flush the updater state to LR so it is valid and contains all added segments .


<s> iterator begin ( ) { return Blocks . rbegin ( ) ; } </s>


<s> iterator end ( ) { return Blocks . rend ( ) ; } </s>

Get a const_iterator to the end of the symbol table .


<s> void getAnalysisUsage ( AnalysisUsage & AU ) const override { AU . setPreservesAll ( ) ; } </s>

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this .


<s> bool runOnFunction ( Function & F ) override { std :: string Code ; raw_string_ostream OS ( Code ) ; Func = & F ; return GenJavaClass ( OS ) ; } </s>

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass .


<s> void setFunction ( Function & Func ) { F = & Func ; } </s>

Initialize data structures for specified new function .