25 #ifndef _JIT_COMPILER2_X86_64INSTRUCTIONS
26 #define _JIT_COMPILER2_X86_64INSTRUCTIONS
154 : scale(scale), index(index.
op), base(base.
op),
disp(
disp) {}
176 ABORT_MSG(
"type not supported",
"x86_64 ModRMOperand::get_scale() type: " << type);
194 ABORT_MSG(
"constant value not supported",
"x86_64 ModRMOperand::get_scale() value: " << value);
206 : scale(scale), index(index), base(base),
disp(
disp) {}
232 std::size_t num_operands) :
380 if (i != 1)
return false;
473 framesize(framesize) {}
556 virtual bool is_end()
const {
return true; }
605 enc(
RM), floatingpoint(floatingpoint) {
612 enc(
MR), floatingpoint(floatingpoint) {
660 from(from), to(to) {}
674 data_index(data_index) {}
703 cond(cond),
jump(else_target) {
738 :
GPInstruction(
"X86_64CMovInst", dstsrc1.
op, op_size, 2), cond(cond) {
782 MoveInst(
"X86_64CVTSI2SSInst", src.
op, dst.
op, to), from(from) {
796 MoveInst(
"X86_64CVTTSS2SIInst", src.
op, dst.
op, to), to(to) {
807 MoveInst(
"X86_64CVTTSD2SIInst", src.
op, dst.
op, to), to(to) {
954 :
SSEAluSDInst(
"X86_64AddSDInst", src2, dstsrc1, 0x58) {}
960 :
SSEAluSDInst(
"X86_64MulSDInst", src2, dstsrc1, 0x59) {}
966 :
SSEAluSDInst(
"X86_64SubSDInst", src2, dstsrc1, 0x5c) {}
972 :
SSEAluSDInst(
"X86_64DivSDInst", src2, dstsrc1, 0x5e) {}
997 :
SSEAluSSInst(
"X86_64AddSSInst", src2, dstsrc1, 0x58) {}
1003 :
SSEAluSSInst(
"X86_64MulSSInst", src2, dstsrc1, 0x59) {}
1009 :
SSEAluSSInst(
"X86_64SubSSInst", src2, dstsrc1, 0x5c) {}
1015 :
SSEAluSSInst(
"X86_64DivSSInst", src2, dstsrc1, 0x5e) {}
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void emit(CodeMemory *CM) const
emit machine code
DivSDInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
DstSrc2Op(MachineOperand *op)
SrcOp(MachineOperand *op)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void link(CodeFragment &CF) const
link machine code
Superclass for general purpose register instruction.
Subtract Scalar Double-Precision Floating-Point Values.
MovSDInst(const SrcOp &src, const DstOp &dst)
SubSDInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
virtual void emit(CodeMemory *CM) const
emit machine code
This represents a machine register usage.
void set_target(MachineBasicBlock *target)
ModRMOperand(ScaleFactor scale, const IndexOp &index, const BaseOp &base, int32_t disp=0)
constructor. Full
Simple wrapper for second operand of an x86_64 instruction.
GPInstruction::OperandSize get_OperandSize_from_Type(const Type::TypeID type)
virtual void emit(CodeMemory *CM) const
emit machine code
Simple wrapper for first operand of an x86_64 instruction.
Superclass for general purpose register instruction.
Src1Op(MachineOperand *op)
virtual void emit(CodeMemory *CM) const
emit machine code
Simple wrapper for a ModRM source operand.
MulSDInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual bool is_jump() const
GPInstruction::OperandSize from
UCOMISSInst(const Src2Op &src2, const Src1Op &src1)
static ScaleFactor get_scale(Type::TypeID type)
covert type to scale
MulSSInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void emit(CodeMemory *CM) const
emit machine code
DstSrcOp(MachineOperand *op)
Multiply Scalar Double-Precision Floating-Point Values.
RetInst(OperandSize op_size, const SrcOp &src)
Non-void return.
A basic block of (scheduled) machine instructions.
LEAInst(const DstOp &dst, OperandSize op_size, const SrcOp src)
virtual void emit(CodeMemory *CM) const
emit machine code
SSEAluSDInst(const char *name, const Src2Op &src2, const DstSrc1Op &dstsrc1, u1 opcode)
This abstract class represents a x86_64 ALU instruction.
SrcMemOp(ManagedStackSlot *op)
virtual void link(CodeFragment &CF) const
link machine code
DstSrc1Op(MachineOperand *op)
AdcInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
Src2Op(MachineOperand *op)
Simple wrapper for a ModRM destination operand.
MovInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize op_size, bool forceSameRegisters=false)
virtual void emit(CodeMemory *CM) const
emit machine code
MachineOperandDesc result
XORPDInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
JumpInst(MachineBasicBlock *target)
AddSSInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
UCOMISDInst(const Src2Op &src2, const Src1Op &src1)
FFREEInst(FPUStackRegister *fpureg)
SSEAluInst(const char *name, const Src2Op &src2, const DstSrc1Op &dstsrc1, u1 opcode, GPInstruction::OperandSize op_size)
DstMemOp(ManagedStackSlot *op)
virtual void emit(CodeMemory *CM) const
emit machine code
CVTSD2SSInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
Convert Dword Integer to Scalar Single-Precision FP Value.
void add_target(MachineBasicBlock *MBB)
SubInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
Descriptor of a MachineOperand.
SSEAluSSInst(const char *name, const Src2Op &src2, const DstSrc1Op &dstsrc1, u1 opcode)
Add Scalar Single-Precision Floating-Point Values.
SSE Alu Instruction (Double-Precision)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void emit(CodeMemory *CM) const
emit machine code
virtual bool is_move() const
MachineBasicBlock * successor_back() const
virtual void link(CodeFragment &CF) const
link machine code
MovImmSSInst(const SrcOp &src, const DstOp &dst)
void set_operand(std::size_t i, MachineOperand *op)
JNIEnv jclass jobject const char * name
virtual bool is_end() const
Divide Scalar Single-Precision Floating-Point Values.
virtual void emit(CodeMemory *CM) const
emit machine code
ModRMOperandDesc(ModRMOperand::ScaleFactor scale, MachineOperandDesc &index, MachineOperandDesc &base, int32_t disp=0)
constructor
virtual void emit(CodeMemory *CM) const
emit machine code
CMovInst(Cond::COND cond, const DstSrc1Op &dstsrc1, const Src2Op &src2, GPInstruction::OperandSize op_size)
Move with Sign-Extension.
MovDSEGInst(const DstOp &dst, DataSegment::IdxTy &data_index)
virtual void emit(CodeMemory *CM) const
emit machine code
Simple wrapper for first operand of an x86_64 instruction which is also used for the result...
CVTTSS2SIInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
CondJumpInst(Cond::COND cond, MachineBasicBlock *then_target, MachineBasicBlock *else_target)
successor_list successors
virtual OStream & print_successor_label(OStream &OS, std::size_t index) const
print successor label
Move data seg to register.
virtual void emit(CodeMemory *CM) const
emit machine code
DstOp(MachineOperand *op)
CVTSS2SDInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize to)
MachineBasicBlock * successor_front() const
Subtract Scalar Single-Precision Floating-Point Values.
virtual void emit(CodeMemory *CM) const
emit machine code
GPInstruction::OperandSize get_operand_size_from_Type(Type::TypeID type)
MoveInst(const char *name, MachineOperand *src, MachineOperand *dst, OperandSize op_size)
virtual void emit(CodeMemory *CM) const
emit machine code
NegInst(const DstSrcOp &dstsrc, OperandSize op_size)
virtual void emit(CodeMemory *CM) const
emit machine code
GPInstruction::OperandSize to
CDQInst(const DstSrc1Op &src1, const DstSrc2Op &src2, OperandSize op_size)
DataSegment::IdxTy data_index
GPInstruction(const char *name, MachineOperand *result, OperandSize op_size, std::size_t num_operands)
MovModRMInst(const SrcOp &src, GPInstruction::OperandSize op_size, const DstModRM &dst, bool floatingpoint)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual bool accepts_immediate(std::size_t i, Immediate *imm) const
OStream & operator<<(OStream &OS, const ModRMOperandDesc &modrm)
OperandSize get_op_size() const
virtual void emit(CodeMemory *CM) const
emit machine code
MovImmSDInst(const SrcOp &src, const DstOp &dst)
virtual void emit(CodeMemory *CM) const
emit machine code
DivSSInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
std::size_t op_size() const
virtual bool is_jump() const
Simple wrapper for the operand of an single operand x86_64 instruction.
IMulInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
void emit_nop(CodeFragment code, int length)
AndInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
Multiply Scalar Single-Precision Floating-Point Values.
IDivInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, const DstSrc2Op &dst2, OperandSize op_size)
The destination operands are only used to guide the register allocator.
Convert Dword Integer to Scalar Double-Precision FP Value.
Convert with truncation Scalar Single-FP Value to DW Integer.
Simple stream class for formatted output.
MovImmSInst(const char *name, const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize op_size)
DstModRM(ModRMOperand &op)
virtual void link(CodeFragment &CF) const
link machine code
XorInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
virtual bool accepts_immediate(std::size_t i, Immediate *imm) const
virtual void emit(CodeMemory *CM) const
emit machine code
SrcModRM(ModRMOperand &op)
GPInstruction::OperandSize to
ModRMOperand(Type::TypeID type, const IndexOp &index, const BaseOp &base, int32_t disp=0)
constructor. Full (with Type::TypeID for scale)
virtual void emit(CodeMemory *CM) const
emit machine code
ModRMOperand::ScaleFactor scale
virtual void emit(CodeMemory *CM) const
emit machine code
GPInstruction::OperandSize from
DataSegment::IdxTy data_index
Simple wrapper for first operand of an x86_64 instruction which is also used for the result...
XORPSInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
ModRMOperand(const BaseOp &base, int32_t disp=0)
constructor. base and disp only
CVTTSD2SIInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
MachineOperandDesc & index
Simple wrapper for destination of an x86_64 instruction.
Proxy to encode explicit and implicit successors.
JumpInst jump
jump to the else target
AddSDInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
virtual void emit(CodeMemory *CM) const
emit machine code
ALUInstruction(const char *name, const Src1Op &src1, const Src2Op &src2, OperandSize op_size, u1 alu_id)
ALUInstruction(const char *name, const DstSrc1Op &dstsrc1, const Src2Op &src2, OperandSize op_size, u1 alu_id)
virtual void emit(CodeMemory *CM) const
emit machine code
CVTSI2SDInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
Type::TypeID get_type() const
FPRemInst(OperandSize op_size)
virtual void emit(CodeMemory *CM) const
This must be implemented by subclasses.
CVTSI2SSInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
MovSSInst(const SrcOp &src, const DstOp &dst)
MovModRMInst(const DstOp &dst, GPInstruction::OperandSize op_size, const SrcModRM &src, bool floatingpoint)
constructor. full arguments
virtual OStream & print_operands(OStream &OS) const
print operands
CallInst(const SrcOp &src, const DstOp &dst, std::size_t argc)
SubSSInst(const Src2Op &src2, const DstSrc1Op &dstsrc1)
CondTrapInst(Cond::COND cond, s4 trap, const SrcOp &index)
Operands that can be directly used by the machine (register, memory, stackslot)
void finalize_operands()
has to be called after all operands with embedded operands have been added
virtual void link(CodeFragment &CF) const
link machine code
IMulImmInst(const Src1Op &src1, const Src2Op &src2, const DstOp &dst, OperandSize op_size)
PatchInst(Patcher *patcher)
virtual OStream & print_result(OStream &OS) const
print result
AddInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
virtual void emit(CodeMemory *CM) const
emit machine code
FLDInst(const SrcMemOp &src, GPInstruction::OperandSize op_size)
virtual void emit(CodeMemory *CM) const
emit machine code
static ScaleFactor get_scale(int32_t value)
covert type to scale
SSE Alu Instruction (Single-Precision)
virtual void emit(CodeMemory *CM) const
emit machine code
X86_64Instruction(const char *name, MachineOperand *result, std::size_t num_operands)
CmpInst(const Src2Op &src2, const Src1Op &src1, OperandSize op_size)
TODO: return type actually is status-flags.
MachineBasicBlock * get_then() const
virtual bool is_jump() const
GPInstruction::OperandSize to
virtual void emit(CodeMemory *CM) const
emit machine code
MachineBasicBlock * get_else() const
#define ABORT_MSG(EXPR_SHORT, EXPR_LONG)
virtual void emit(CodeMemory *CM) const
emit machine code
UCOMISInst(const char *name, const Src2Op &src2, const Src1Op &src1, GPInstruction::OperandSize op_size)
XORPInst(const char *name, const Src2Op &src2, const DstSrc1Op &dstsrc1, GPInstruction::OperandSize op_size)
MovSXInst(const SrcOp &src, const DstOp &dst, GPInstruction::OperandSize from, GPInstruction::OperandSize to)
const char const void jint length
IndirectJumpInst(const SrcOp &src)
Add Scalar Double-Precision Floating-Point Values.
FPUStackRegister * fpureg
OrInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
SbbInst(const Src2Op &src2, const DstSrc1Op &dstsrc1, OperandSize op_size)
GPInstruction::OperandSize from
MachineOperandDesc & base
Divide Scalar Double-Precision Floating-Point Values.
virtual void emit(CodeMemory *CM) const
emit machine code
FSTPInst(const DstMemOp &dst, GPInstruction::OperandSize op_size)
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void emit(CodeMemory *CM) const
emit machine code
virtual void emit(CodeMemory *CM) const
emit machine code