45 #include "md-trap.hpp"
50 #define DEBUG_NAME "compiler2/x86_64"
61 using namespace x86_64;
119 "Inst: " << src <<
" -> " << dst <<
" type: " << type);
130 template <
unsigned size,
class T>
131 inline T align_to(T val) {
133 return val + ( rem == 0 ? 0 :
size - rem);
136 template <
class I,
class Seg>
137 static void write_data(Seg seg,
I data) {
138 assert(seg.size() ==
sizeof(
I));
140 for (
int i = 0,
e =
sizeof(
I) ;
i <
e ; ++
i) {
141 seg[
i] = (
u1) 0xff & *(reinterpret_cast<u1*>(&data) +
i);
189 I <<
" type: " << type);
282 ABORT_MSG(
"x86_64: Lowering not supported",
283 "Inst: " << I <<
" type: " << type);
326 ABORT_MSG(
"x86_64 Conditional not supported: ",
339 ABORT_MSG(
"x86_64: Lowering not supported",
340 "Inst: " << I <<
" type: " << type);
379 ABORT_MSG(
"x86_64: Lowering not supported",
380 "Inst: " << I <<
" type: " << type);
416 ABORT_MSG(
"x86_64: Lowering not supported",
417 "Inst: " << I <<
" type: " << type);
420 set_op(I,alu->get_result().op);
444 ABORT_MSG(
"x86_64: Lowering not supported",
445 "Inst: " << I <<
" type: " << type);
448 set_op(I,alu->get_result().op);
472 ABORT_MSG(
"x86_64: Lowering not supported",
473 "Inst: " << I <<
" type: " << type);
476 set_op(I,alu->get_result().op);
500 ABORT_MSG(
"x86_64: Lowering not supported",
501 "Inst: " << I <<
" type: " << type);
504 set_op(I,alu->get_result().op);
538 ABORT_MSG(
"x86_64: Lowering not supported",
539 "Inst: " << I <<
" type: " << type);
542 set_op(I,alu->get_result().op);
576 ABORT_MSG(
"x86_64: Lowering not supported",
577 "Inst: " << I <<
" type: " << type);
580 set_op(I,alu->get_result().op);
628 ABORT_MSG(
"x86_64: Lowering not supported",
629 "Inst: " << I <<
" type: " << type);
693 ABORT_MSG(
"x86_64: Lowering not supported",
694 "Inst: " << I <<
" type: " << type);
738 ABORT_MSG(
"x86_64 Lowering not supported",
739 "Inst: " << I <<
" type: " << type);
795 ABORT_MSG(
"x86_64 Lowering not supported",
796 "Inst: " << I <<
" type: " << type);
851 ABORT_MSG(
"x86_64 Lowering not supported",
852 "Inst: " << I <<
" type: " << type);
978 ABORT_MSG(
"x86_64 Lowering not supported",
979 "Inst: " << I <<
" type: " << type);
1147 ABORT_MSG(
"x86_64 Cast not supported!",
"From " << from <<
" to " << to );
1175 ABORT_MSG(
"x86_64 Lowering not supported",
1176 "Inst: " << I <<
" type: " << type);
1182 int arg_counter = 0;
1183 for (std::size_t
i = 0;
i < I->
op_size(); ++
i ) {
1243 int32_t
s2 =
sizeof(
methodptr) * (callee - callee->clazz->methods);
1268 visit(static_cast<INVOKEInst*>(I), copyOperands);
1272 visit(static_cast<INVOKEInst*>(I), copyOperands);
1276 visit(static_cast<INVOKEInst*>(I), copyOperands);
1280 visit(static_cast<INVOKEInst*>(I), copyOperands);
1284 visit(static_cast<INVOKEInst*>(I), copyOperands);
1299 set_op(I, read_field->get_result().op);
1314 set_op(I, write_field->get_result().op);
1333 set_op(I, read_field->get_result().op);
1352 set_op(I, write_field->get_result().op);
1426 DataSegment::IdxTy idx = data.
get_begin();
1451 assert(source_state);
1476 assert(source_state);
1531 set_op(I,move->get_result().op);
1559 ABORT_MSG(
"x86_64: AddImm Lowering not supported",
1560 "Inst: " << I <<
" type: " << type);
1591 ABORT_MSG(
"x86_64: SubRegImm Lowering not supported",
1592 "Inst: " << I <<
" type: " << type);
1624 ABORT_MSG(
"x86_64: MulImm Lowering not supported",
1625 "Inst: " << I <<
" type: " << type);
1633 case BaseIndexDisplacement:
1656 set_op(I,lea->get_result().op);
1659 case BaseIndexDisplacement2:
1682 set_op(I,lea->get_result().op);
1685 case BaseIndexMultiplier:
1715 case BaseIndexMultiplier2:
1745 case BaseIndexMultiplierDisplacement:
1778 set_op(I,lea->get_result().op);
1781 case BaseIndexMultiplierDisplacement2:
1813 set_op(I,lea->get_result().op);
1861 ABORT_MSG(
"x86_64 Lowering not supported",
1862 "Inst: " << I <<
" type: " << type);
1917 ABORT_MSG(
"x86_64 Lowering not supported",
1918 "Inst: " << I <<
" type: " << type);
1973 ABORT_MSG(
"x86_64 Lowering not supported",
1974 "Inst: " << I <<
" type: " << type);
1986 ABORT_MSG(
"Rule not supported",
"Rule " << ruleId <<
" is not supported by method lowerComplex!");
1992 Type::TypeID type,
bool copyOperands,
bool isCommutable) {
1998 }
else if (src_op2->
is_Register() && isCommutable){
2012 compiler2::RegisterFile*
2014 return new x86_64::RegisterFile(type);
static const COND B
below (CF = 1)
void set_op(Instruction *I, MachineOperand *op) const
BeginInstRef & get_else_target()
GPRegister RDX("RDX", 0x2, false, 0x2 *8, 8)
void set_current(MachineBasicBlock *MBB)
static const COND E
equal (ZF = 1)
ManagedStackSlot * create_slot(Type::TypeID type)
Create a ManagedStackSlot.
virtual MachineInstruction * create_Move(MachineOperand *src, MachineOperand *dst) const =0
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
bool is_stackslot() const
Subtract Scalar Double-Precision Floating-Point Values.
virtual BUILTINInst * to_BUILTINInst()
Value * get_operand(size_t i)
virtual Instruction * to_Instruction()
CodeFragment get_aligned_CodeFragment(std::size_t size)
get an aligned code fragment
Simple wrapper for second operand of an x86_64 instruction.
GPInstruction::OperandSize get_OperandSize_from_Type(const Type::TypeID type)
SourceStateInst * get_source_state() const
Get the SourceStateInst that corresponds to this Instruction.
#define WARNING_MSG(EXPR_SHORT, EXPR_LONG)
Simple wrapper for first operand of an x86_64 instruction.
virtual MachineInstruction * create_Jump(MachineBasicBlock *target) const
const MethodDescriptor & get_MethodDescriptor() const
Get the MethodDescriptor.
fieldinfo * get_field() const
Get the accessed field.
OperandID get_OperandID() const
Write a value to a static field.
Type::TypeID get_type() const
get the value type of the instruction
MatchTy::iterator match_iterator
virtual CONSTInst * to_CONSTInst()
u4 get_frame_size() const
Get the value of an object's field.
virtual void emit(CodeMemory *cm) const
emit machine code
Base type of instruction that perform a method invocation.
Load a value from an array.
static const COND G
greater (ZF = 0 and SF = OF)
A TrapInst represents a hardware trap.
Multiply Scalar Double-Precision Floating-Point Values.
A basic block of (scheduled) machine instructions.
virtual void create_frame(CodeMemory *CM, StackSlotManager *SSM) const
virtual INVOKESTATICInst * to_INVOKESTATICInst()
virtual Register * to_Register()
bool is_StackSlot() const
Invoke an interface method.
virtual void lowerComplex(Instruction *I, int ruleId)
Transfers execution back to an unoptimized version of the method.
Get the value of a static field.
union constant_FMIref::@26 p
StackSlotManager * get_StackSlotManager()
Convert Dword Integer to Scalar Single-Precision FP Value.
void add_target(MachineBasicBlock *MBB)
Add Scalar Single-Precision Floating-Point Values.
Write a value to an object's field.
Perform a bounds-check for an array-access.
void set_operand(std::size_t i, MachineOperand *op)
Divide Scalar Single-Precision Floating-Point Values.
JNIEnv jthread jobject jclass jlong size
Move with Sign-Extension.
Simple wrapper for first operand of an x86_64 instruction which is also used for the result...
Represents an explicit null-check on an object reference.
Store a value into an array.
Move data seg to register.
This stores a reference to a BeginInst.
ManagedStackSlot * create_argument_slot(Type::TypeID type, u4 index)
Create a ManagedStackSlot for an invocation argument.
Subtract Scalar Single-Precision Floating-Point Values.
GPInstruction::OperandSize get_operand_size_from_Type(Type::TypeID type)
constant_FMIref * get_fmiref() const
Get information about the method to invoke.
Represents a speculative assumption that has to be checked at run-time.
SuccessorListTy::const_iterator succ_end() const
virtual void visit(LOADInst *I, bool copyOperands)
void push_back(MachineInstruction *value)
Appends the given element value to the end of the container.
Invoke an instance method with special handling.
Provides a mapping from HIR values to baseline IR variables.
Simple wrapper for the operand of an single operand x86_64 instruction.
Conditional::CondID get_condition() const
Get the kind of condition that is computed.
CodeMemory * get_CodeMemory()
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
void emit_nop(CodeFragment code, int length)
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
A "virtual" slot that will eventually be mapped to a machine-level slot.
Multiply Scalar Single-Precision Floating-Point Values.
u1 * get_address() const
Get the pointer to the function that implements the builtin functionality.
Convert Dword Integer to Scalar Double-Precision FP Value.
void push_front(MachineInstruction *value)
inserts value to the beginning
virtual VirtualRegister * to_VirtualRegister()
std::size_t size() const
size of the reference
static ScaleFactor get_scale(Type::TypeID type)
static const COND L
less (SF <> OF)
SuccessorListTy::const_iterator succ_begin() const
MethodDescriptor & get_MethodDescriptor()
Get the MethodDescriptor of the method to invoke.
virtual const char * get_name() const
static const COND GE
greater or equal (SF = OF)
virtual MachineInstruction * create_Move(MachineOperand *src, MachineOperand *dst) const
Simple wrapper for first operand of an x86_64 instruction which is also used for the result...
SuccessorListTy::const_iterator succ_const_iterator
Get the length of an array.
match_iterator match_end()
Backend * get_Backend() const
void setupSrcDst(MachineOperand *&src_op1, MachineOperand *&src_op2, VirtualRegister *&dst, Type::TypeID type, bool copyOperands, bool isCommutable)
Simple wrapper for destination of an x86_64 instruction.
Proxy to encode explicit and implicit successors.
Method * get_Method() const
MachineBasicBlock * get_current() const
Type::TypeID get_type() const
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
void lower_source_state_dependencies(MachineReplacementPointInst *MI, SourceStateInst *source_state)
Operands that can be directly used by the machine (register, memory, stackslot)
GPRegister R10("R10", 0x2, true, 0xa *8, 8)
static const COND NE
not equal (ZF = 0)
GPRegister RAX("RAX", 0x0, false, 0x0 *8, 8)
const MachineOperandDesc & get_result() const
aarch64::NativeRegister NativeRegister
unsigned get_index() const
The index of the argument is represented by this LOADInst.
static const COND A
above (CF = 0 and ZF = 0)
virtual INVOKESPECIALInst * to_INVOKESPECIALInst()
#define assert_msg(COND, EXPR)
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
static const COND P
parity (PF = 1)
SSERegister XMM0("XMM0", 0x0, false, 0x0 *16, 16)
virtual bool is_commutable() const
True if the operands of the instruction are commutable.
void insert_pred(MachineBasicBlock *value)
Appends the given element value to the list of predecessors.
MachineBasicBlock * new_block() const
IdxTy get_begin() const
Get the index of the first element.
MachineOperand * get_op(Instruction *I) const
#define ABORT_MSG(EXPR_SHORT, EXPR_LONG)
BeginInstRef & get_then_target()
void place_deoptimization_marker(SourceStateAwareInst *I)
JITData * get_JITData() const
Add Scalar Double-Precision Floating-Point Values.
BeginInstRef & succ_front()
Ref get_Ref(std::size_t t)
get a new reference to the segment
virtual INVOKEVIRTUALInst * to_INVOKEVIRTUALInst()
virtual INVOKEINTERFACEInst * to_INVOKEINTERFACEInst()
double get_Double() const
match_iterator match_begin()
A LOADInst represents an argument that is passed to the current method.
static const COND LE
less or equal (ZF = 1 or SF <> OF)
const DataSegment & get_DataSegment() const
get DataSegment
Divide Scalar Double-Precision Floating-Point Values.
FloatHandling get_FloatHandling() const
Invoke an instance method.
Return from the current method.
s4 get_source_location() const
MethodDescriptor TODO: more info.