CACAO
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes
cacao::jit::compiler2::MachineInstruction Class Reference

Proxy to encode explicit and implicit successors. More...

Inheritance diagram for cacao::jit::compiler2::MachineInstruction:
cacao::jit::compiler2::memory::ManagerMixin< MachineInstruction > cacao::jit::compiler2::MachineJumpInst cacao::jit::compiler2::MachineLabelInst cacao::jit::compiler2::MachinePhiInst cacao::jit::compiler2::x86_64::X86_64Instruction cacao::jit::compiler2::x86_64::JumpInst cacao::jit::compiler2::x86_64::BreakInst cacao::jit::compiler2::x86_64::CondJumpInst cacao::jit::compiler2::x86_64::CondTrapInst cacao::jit::compiler2::x86_64::EnterInst cacao::jit::compiler2::x86_64::FFREEInst cacao::jit::compiler2::x86_64::FINCSTPInst cacao::jit::compiler2::x86_64::GPInstruction cacao::jit::compiler2::x86_64::IndirectJumpInst cacao::jit::compiler2::x86_64::LeaveInst cacao::jit::compiler2::x86_64::PatchInst

Public Types

typedef alloc::vector
< MachineOperandDesc >::type 
operand_list
 
typedef operand_list::iterator operand_iterator
 
typedef
operand_list::const_iterator 
const_operand_iterator
 
typedef alloc::vector
< MachineOperandDesc >::type 
dummy_operand_list
 
typedef
dummy_operand_list::iterator 
dummy_operand_iterator
 
typedef
dummy_operand_list::const_iterator 
const_dummy_operand_iterator
 
typedef alloc::unordered_map
< EmbeddedMachineOperand
*, int >::type 
RefMapTy
 
typedef alloc::list
< MachineBasicBlock * >::type 
successor_list
 
typedef successor_list::iterator successor_iterator
 
typedef
successor_list::const_iterator 
const_successor_iterator
 

Public Member Functions

 MachineInstruction (const char *name, MachineOperand *result, std::size_t num_operands, const char *comment=NULL)
 
void set_comment (const char *c)
 
const char * get_comment () const
 
void set_operand (std::size_t i, MachineOperand *op)
 
void finalize_operands ()
 has to be called after all operands with embedded operands have been added More...
 
virtual void set_block (MachineBasicBlock *MBB)
 
MachineBasicBlockget_block () const
 
std::size_t op_size () const
 
MachineOperandDescoperator[] (std::size_t i)
 
const MachineOperandDescget (std::size_t i) const
 
MachineOperandDescget (std::size_t i)
 
operand_iterator begin ()
 
operand_iterator end ()
 
operand_iterator find (MachineOperand *op)
 
MachineOperandDescfront ()
 
MachineOperandDescback ()
 
const_operand_iterator begin () const
 
const_operand_iterator end () const
 
std::size_t dummy_op_size () const
 
const MachineOperandDescget_dummy (std::size_t i) const
 
MachineOperandDescget_dummy (std::size_t i)
 
dummy_operand_iterator dummy_begin ()
 
dummy_operand_iterator dummy_end ()
 
dummy_operand_iterator find_dummy (MachineOperand *op)
 
MachineOperandDescdummy_front ()
 
MachineOperandDescdummy_back ()
 
const_dummy_operand_iterator dummy_begin () const
 
const_dummy_operand_iterator dummy_end () const
 
successor_iterator successor_begin ()
 
successor_iterator successor_end ()
 
const_successor_iterator successor_begin () const
 
MachineBasicBlocksuccessor_front () const
 
MachineBasicBlocksuccessor_back () const
 
const_successor_iterator successor_end () const
 
std::size_t successor_size () const
 
bool successor_empty () const
 
std::size_t get_id () const
 
const char * get_name () const
 
const MachineOperandDescget_result () const
 
MachineOperandDescget_result ()
 
void set_result (MachineOperand *MO)
 
virtual bool accepts_immediate (std::size_t i, Immediate *imm) const
 
virtual bool is_label () const
 
virtual bool is_phi () const
 
virtual bool is_move () const
 
virtual bool is_jump () const
 
virtual bool is_end () const
 
virtual MachineMoveInst * to_MachineMoveInst ()
 
virtual MachinePhiInstto_MachinePhiInst ()
 
OStreamprint (OStream &OS) const
 print instruction More...
 
virtual OStreamprint_successor_label (OStream &OS, std::size_t index) const
 print successor label More...
 
virtual OStreamprint_operands (OStream &OS) const
 print operands More...
 
virtual OStreamprint_result (OStream &OS) const
 print result More...
 
virtual void emit (CodeMemory *CM) const
 emit machine code More...
 
virtual void link (CodeFragment &CF) const
 link machine code More...
 
virtual ~MachineInstruction ()
 destructor More...
 

Protected Attributes

const std::size_t id
 
operand_list operands
 
dummy_operand_list dummy_operands
 dummy_operands is a list of operands embedded in the real operands of this instruction that need register allocation (for example indirect addressing on x86) More...
 
RefMapTy ref_map
 
successor_list successors
 
MachineOperandDesc result
 
const char * name
 
const char * comment
 
MachineBasicBlockblock
 

Private Member Functions

void set_dummy_operand (EmbeddedMachineOperand *op)
 

Static Private Attributes

static std::size_t id_counter = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from cacao::jit::compiler2::memory::ManagerMixin< MachineInstruction >
static voidoperator new (std::size_t size) throw (std::bad_alloc)
 normal new More...
 
static voidoperator new (std::size_t size, void *ptr) throw ()
 placement new More...
 
static voidoperator new (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new More...
 
static void operator delete (void *pMemory) throw ()
 normal delete More...
 
static void operator delete (void *pMemory, void *ptr) throw ()
 placement delete More...
 
static void operator delete (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete More...
 
static voidoperator new[] (std::size_t size) throw (std::bad_alloc)
 normal new[] More...
 
static voidoperator new[] (std::size_t size, void *ptr) throw ()
 placement new[] More...
 
static voidoperator new[] (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new[] More...
 
static void operator delete[] (void *pMemory) throw ()
 normal delete[] More...
 
static void operator delete[] (void *pMemory, void *ptr) throw ()
 placement delete[] More...
 
static void operator delete[] (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete[] More...
 

Detailed Description

Proxy to encode explicit and implicit successors.

The target of an unconditional jump is an explicit successor (i.e. the target is specified explicitly). The else branch of a conditional jump (i.e. the following block) is an implicit successor.

For implicit successors the source block is stored. Whenever the real successor is requested the block following the source block is returned. Therefore implicit successors might change if a block is inserted after the source block. Superclass for all machine dependent instructions

Definition at line 110 of file MachineInstruction.hpp.

Member Typedef Documentation

Definition at line 117 of file MachineInstruction.hpp.

Definition at line 114 of file MachineInstruction.hpp.

Definition at line 121 of file MachineInstruction.hpp.

Definition at line 116 of file MachineInstruction.hpp.

Definition at line 115 of file MachineInstruction.hpp.

Definition at line 113 of file MachineInstruction.hpp.

Definition at line 112 of file MachineInstruction.hpp.

Definition at line 118 of file MachineInstruction.hpp.

Definition at line 120 of file MachineInstruction.hpp.

Definition at line 119 of file MachineInstruction.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::MachineInstruction::MachineInstruction ( const char *  name,
MachineOperand result,
std::size_t  num_operands,
const char *  comment = NULL 
)
inline

Definition at line 153 of file MachineInstruction.hpp.

virtual cacao::jit::compiler2::MachineInstruction::~MachineInstruction ( )
inlinevirtual

destructor

Definition at line 356 of file MachineInstruction.hpp.

Member Function Documentation

virtual bool cacao::jit::compiler2::MachineInstruction::accepts_immediate ( std::size_t  i,
Immediate imm 
) const
inlinevirtual
MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::back ( )
inline

Definition at line 226 of file MachineInstruction.hpp.

operand_iterator cacao::jit::compiler2::MachineInstruction::begin ( )
inline

Definition at line 210 of file MachineInstruction.hpp.

const_operand_iterator cacao::jit::compiler2::MachineInstruction::begin ( ) const
inline

Definition at line 229 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::dummy_back ( )
inline

Definition at line 264 of file MachineInstruction.hpp.

dummy_operand_iterator cacao::jit::compiler2::MachineInstruction::dummy_begin ( )
inline

Definition at line 248 of file MachineInstruction.hpp.

const_dummy_operand_iterator cacao::jit::compiler2::MachineInstruction::dummy_begin ( ) const
inline

Definition at line 267 of file MachineInstruction.hpp.

dummy_operand_iterator cacao::jit::compiler2::MachineInstruction::dummy_end ( )
inline

Definition at line 251 of file MachineInstruction.hpp.

const_dummy_operand_iterator cacao::jit::compiler2::MachineInstruction::dummy_end ( ) const
inline

Definition at line 270 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::dummy_front ( )
inline

Definition at line 261 of file MachineInstruction.hpp.

std::size_t cacao::jit::compiler2::MachineInstruction::dummy_op_size ( ) const
inline

Definition at line 235 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::emit ( CodeMemory CM) const
virtual

emit machine code

Reimplemented in cacao::jit::compiler2::x86_64::MovSSInst, cacao::jit::compiler2::x86_64::MovImmSInst, cacao::jit::compiler2::x86_64::MovSDInst, cacao::jit::compiler2::x86_64::FPRemInst, cacao::jit::compiler2::x86_64::SSEAluInst, cacao::jit::compiler2::x86_64::XORPInst, cacao::jit::compiler2::x86_64::UCOMISInst, cacao::jit::compiler2::x86_64::FINCSTPInst, cacao::jit::compiler2::x86_64::FFREEInst, cacao::jit::compiler2::x86_64::FSTPInst, cacao::jit::compiler2::x86_64::FLDInst, cacao::jit::compiler2::x86_64::CVTSD2SSInst, cacao::jit::compiler2::x86_64::CVTSS2SDInst, cacao::jit::compiler2::x86_64::CVTTSD2SIInst, cacao::jit::compiler2::x86_64::CVTTSS2SIInst, cacao::jit::compiler2::x86_64::CVTSI2SSInst, cacao::jit::compiler2::x86_64::CVTSI2SDInst, cacao::jit::compiler2::x86_64::IndirectJumpInst, cacao::jit::compiler2::x86_64::CMovInst, cacao::jit::compiler2::x86_64::CondTrapInst, cacao::jit::compiler2::x86_64::CondJumpInst, cacao::jit::compiler2::x86_64::JumpInst, cacao::jit::compiler2::x86_64::MovDSEGInst, cacao::jit::compiler2::x86_64::MovSXInst, cacao::jit::compiler2::x86_64::LEAInst, cacao::jit::compiler2::x86_64::MovModRMInst, cacao::jit::compiler2::x86_64::MovInst, cacao::jit::compiler2::x86_64::CallInst, cacao::jit::compiler2::x86_64::NegInst, cacao::jit::compiler2::x86_64::RetInst, cacao::jit::compiler2::x86_64::CDQInst, cacao::jit::compiler2::x86_64::IDivInst, cacao::jit::compiler2::x86_64::IMulImmInst, cacao::jit::compiler2::x86_64::IMulInst, cacao::jit::compiler2::x86_64::BreakInst, cacao::jit::compiler2::x86_64::LeaveInst, cacao::jit::compiler2::x86_64::EnterInst, cacao::jit::compiler2::x86_64::PatchInst, cacao::jit::compiler2::x86_64::ALUInstruction, cacao::jit::compiler2::MachineJumpInst, cacao::jit::compiler2::MachinePhiInst, and cacao::jit::compiler2::MachineLabelInst.

Definition at line 86 of file MachineInstruction.cpp.

operand_iterator cacao::jit::compiler2::MachineInstruction::end ( )
inline

Definition at line 213 of file MachineInstruction.hpp.

const_operand_iterator cacao::jit::compiler2::MachineInstruction::end ( ) const
inline

Definition at line 232 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::finalize_operands ( )
inline

has to be called after all operands with embedded operands have been added

Definition at line 179 of file MachineInstruction.hpp.

operand_iterator cacao::jit::compiler2::MachineInstruction::find ( MachineOperand op)
inline

Definition at line 216 of file MachineInstruction.hpp.

dummy_operand_iterator cacao::jit::compiler2::MachineInstruction::find_dummy ( MachineOperand op)
inline

Definition at line 254 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::front ( )
inline

Definition at line 223 of file MachineInstruction.hpp.

const MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get ( std::size_t  i) const
inline

Definition at line 200 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get ( std::size_t  i)
inline

Definition at line 205 of file MachineInstruction.hpp.

MachineBasicBlock* cacao::jit::compiler2::MachineInstruction::get_block ( ) const
inline

Definition at line 188 of file MachineInstruction.hpp.

const char* cacao::jit::compiler2::MachineInstruction::get_comment ( ) const
inline

Definition at line 166 of file MachineInstruction.hpp.

const MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get_dummy ( std::size_t  i) const
inline

Definition at line 238 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get_dummy ( std::size_t  i)
inline

Definition at line 243 of file MachineInstruction.hpp.

std::size_t cacao::jit::compiler2::MachineInstruction::get_id ( ) const
inline

Definition at line 297 of file MachineInstruction.hpp.

const char* cacao::jit::compiler2::MachineInstruction::get_name ( ) const
inline

Definition at line 300 of file MachineInstruction.hpp.

const MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get_result ( ) const
inline

Definition at line 303 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::get_result ( )
inline

Definition at line 306 of file MachineInstruction.hpp.

virtual bool cacao::jit::compiler2::MachineInstruction::is_end ( ) const
inlinevirtual

Reimplemented in cacao::jit::compiler2::x86_64::RetInst.

Definition at line 327 of file MachineInstruction.hpp.

virtual bool cacao::jit::compiler2::MachineInstruction::is_jump ( ) const
inlinevirtual
virtual bool cacao::jit::compiler2::MachineInstruction::is_label ( ) const
inlinevirtual

Reimplemented in cacao::jit::compiler2::MachineLabelInst.

Definition at line 315 of file MachineInstruction.hpp.

virtual bool cacao::jit::compiler2::MachineInstruction::is_move ( ) const
inlinevirtual

Reimplemented in cacao::jit::compiler2::x86_64::MoveInst.

Definition at line 321 of file MachineInstruction.hpp.

virtual bool cacao::jit::compiler2::MachineInstruction::is_phi ( ) const
inlinevirtual

Reimplemented in cacao::jit::compiler2::MachinePhiInst.

Definition at line 318 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::link ( CodeFragment CF) const
virtual
std::size_t cacao::jit::compiler2::MachineInstruction::op_size ( ) const
inline

Definition at line 192 of file MachineInstruction.hpp.

MachineOperandDesc& cacao::jit::compiler2::MachineInstruction::operator[] ( std::size_t  i)
inline

Definition at line 195 of file MachineInstruction.hpp.

OStream & cacao::jit::compiler2::MachineInstruction::print ( OStream OS) const

print instruction

Definition at line 39 of file MachineInstruction.cpp.

OStream & cacao::jit::compiler2::MachineInstruction::print_operands ( OStream OS) const
virtual

print operands

Reimplemented in cacao::jit::compiler2::x86_64::MovModRMInst.

Definition at line 74 of file MachineInstruction.cpp.

OStream & cacao::jit::compiler2::MachineInstruction::print_result ( OStream OS) const
virtual

print result

Reimplemented in cacao::jit::compiler2::x86_64::MovModRMInst.

Definition at line 70 of file MachineInstruction.cpp.

OStream & cacao::jit::compiler2::MachineInstruction::print_successor_label ( OStream OS,
std::size_t  index 
) const
virtual

print successor label

Reimplemented in cacao::jit::compiler2::x86_64::CondJumpInst.

Definition at line 82 of file MachineInstruction.cpp.

virtual void cacao::jit::compiler2::MachineInstruction::set_block ( MachineBasicBlock MBB)
inlinevirtual

Definition at line 185 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::set_comment ( const char *  c)
inline

Definition at line 165 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::set_dummy_operand ( EmbeddedMachineOperand op)
inlineprivate

Definition at line 124 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::set_operand ( std::size_t  i,
MachineOperand op 
)
inline

Definition at line 168 of file MachineInstruction.hpp.

void cacao::jit::compiler2::MachineInstruction::set_result ( MachineOperand MO)
inline

Definition at line 309 of file MachineInstruction.hpp.

MachineBasicBlock* cacao::jit::compiler2::MachineInstruction::successor_back ( ) const
inline

Definition at line 285 of file MachineInstruction.hpp.

successor_iterator cacao::jit::compiler2::MachineInstruction::successor_begin ( )
inline

Definition at line 273 of file MachineInstruction.hpp.

const_successor_iterator cacao::jit::compiler2::MachineInstruction::successor_begin ( ) const
inline

Definition at line 279 of file MachineInstruction.hpp.

bool cacao::jit::compiler2::MachineInstruction::successor_empty ( ) const
inline

Definition at line 294 of file MachineInstruction.hpp.

successor_iterator cacao::jit::compiler2::MachineInstruction::successor_end ( )
inline

Definition at line 276 of file MachineInstruction.hpp.

const_successor_iterator cacao::jit::compiler2::MachineInstruction::successor_end ( ) const
inline

Definition at line 288 of file MachineInstruction.hpp.

MachineBasicBlock* cacao::jit::compiler2::MachineInstruction::successor_front ( ) const
inline

Definition at line 282 of file MachineInstruction.hpp.

std::size_t cacao::jit::compiler2::MachineInstruction::successor_size ( ) const
inline

Definition at line 291 of file MachineInstruction.hpp.

virtual MachineMoveInst* cacao::jit::compiler2::MachineInstruction::to_MachineMoveInst ( )
inlinevirtual

Definition at line 330 of file MachineInstruction.hpp.

virtual MachinePhiInst* cacao::jit::compiler2::MachineInstruction::to_MachinePhiInst ( )
inlinevirtual

Reimplemented in cacao::jit::compiler2::MachinePhiInst.

Definition at line 338 of file MachineInstruction.hpp.

Field Documentation

MachineBasicBlock* cacao::jit::compiler2::MachineInstruction::block
protected

Definition at line 146 of file MachineInstruction.hpp.

const char* cacao::jit::compiler2::MachineInstruction::comment
protected

Definition at line 145 of file MachineInstruction.hpp.

dummy_operand_list cacao::jit::compiler2::MachineInstruction::dummy_operands
protected

dummy_operands is a list of operands embedded in the real operands of this instruction that need register allocation (for example indirect addressing on x86)

Definition at line 140 of file MachineInstruction.hpp.

const std::size_t cacao::jit::compiler2::MachineInstruction::id
protected

Definition at line 133 of file MachineInstruction.hpp.

std::size_t cacao::jit::compiler2::MachineInstruction::id_counter = 0
staticprivate

Definition at line 123 of file MachineInstruction.hpp.

const char* cacao::jit::compiler2::MachineInstruction::name
protected

Definition at line 144 of file MachineInstruction.hpp.

operand_list cacao::jit::compiler2::MachineInstruction::operands
protected

Definition at line 134 of file MachineInstruction.hpp.

RefMapTy cacao::jit::compiler2::MachineInstruction::ref_map
protected

Definition at line 141 of file MachineInstruction.hpp.

MachineOperandDesc cacao::jit::compiler2::MachineInstruction::result
protected

Definition at line 143 of file MachineInstruction.hpp.

successor_list cacao::jit::compiler2::MachineInstruction::successors
protected

Definition at line 142 of file MachineInstruction.hpp.


The documentation for this class was generated from the following files: