25 #ifndef _JIT_COMPILER2_MACHINEINSTRUCTION
26 #define _JIT_COMPILER2_MACHINEINSTRUCTION
47 class MachineMoveInst;
50 class MachineInstruction;
51 class MachineReplacementPointInst;
66 : parent(parent), index(index),
op(NULL) {}
70 : parent(parent),
index(0), op(op) {}
88 class SuccessorProxy :
public memory::ManagerMixin<SuccessorProxy> {
93 enum Type { ExplTy, ImplTy };
94 MachineBasicBlock *entry;
98 explicit SuccessorProxy(MachineBasicBlock* MBB, Explicit)
99 : entry(MBB), type(ExplTy) {}
101 explicit SuccessorProxy(MachineBasicBlock* MBB, Implicit)
102 : entry(MBB), type(ImplTy) {}
104 operator MachineBasicBlock*()
const;
127 pos = dummy_operands.size();
131 ref_map.insert(std::make_pair(op,pos));
134 const std::size_t
id;
151 :
id(id_counter++), operands(num_operands,dflt), result(result), name(name) {
155 :
id(id_counter++), operands(), dummy_operands(), ref_map(), result(this, result), name(name), comment(comment),
block(NULL) {
156 for (std::size_t
i = 0;
i < num_operands ; ++
i) {
161 set_dummy_operand(&(*it));
170 assert(i < operands.size());
174 set_dummy_operand(&(*it));
181 for (RefMapTy::iterator it = ref_map.begin(),
e = ref_map.end(); it !=
e; ++it) {
182 it->first->real = &dummy_operands[it->second];
194 return operands.size();
197 assert(i < operands.size());
198 assert(operands[i].get_index() == i);
202 assert(
i < operands.size());
203 assert(operands[
i].get_index() ==
i);
207 assert(
i < operands.size());
208 assert(operands[
i].get_index() ==
i);
212 return operands.begin();
215 return operands.end();
225 return operands.front();
228 return operands.back();
231 return operands.begin();
234 return operands.end();
237 return dummy_operands.size();
240 assert(i < dummy_operands.size());
241 assert(dummy_operands[i].get_index() == i);
242 return dummy_operands[
i];
245 assert(i < dummy_operands.size());
246 assert(dummy_operands[i].get_index() == i);
247 return dummy_operands[
i];
250 return dummy_operands.begin();
253 return dummy_operands.end();
263 return dummy_operands.front();
266 return dummy_operands.back();
269 return dummy_operands.begin();
272 return dummy_operands.end();
275 return successors.begin();
278 return successors.end();
281 return successors.begin();
284 return successors.
front();
287 return successors.
back();
290 return successors.end();
293 return successors.size();
296 return successors.empty();
embedded_operand_list::iterator operand_iterator
const_operand_iterator end() const
MachineOperandDesc(MachineInstruction *parent, std::size_t index, MachineOperand *op)
void set_result(MachineOperand *MO)
MachineOperandDesc & dummy_front()
virtual MachineReplacementPointInst * to_MachineReplacementPointInst()
dummy_operand_list::const_iterator const_dummy_operand_iterator
virtual bool is_jump() const
MachineInstruction(const char *name, MachineOperand *result, std::size_t num_operands, const char *comment=NULL)
MachineInstruction * parent
virtual bool is_end() const
Custom new/delete handler mixin.
A basic block of (scheduled) machine instructions.
virtual void set_block(MachineBasicBlock *MBB)
const MachineOperandDesc & get_dummy(std::size_t i) const
operand_list::const_iterator const_operand_iterator
alloc::unordered_map< EmbeddedMachineOperand *, int >::type RefMapTy
MachineOperandDesc result
virtual bool is_label() const
MachineOperandDesc & back()
const char * get_name() const
virtual MachinePhiInst * to_MachinePhiInst()
Descriptor of a MachineOperand.
void set_comment(const char *c)
Represents a point in the program, where it is possible to recover the source state to perform on-sta...
virtual ~MachineInstruction()
destructor
successor_iterator successor_begin()
MachineBasicBlock * successor_back() const
void set_operand(std::size_t i, MachineOperand *op)
JNIEnv jclass jobject const char * name
const char * get_comment() const
virtual bool accepts_immediate(std::size_t i, Immediate *imm) const
virtual MachineMoveInst * to_MachineMoveInst()
dummy_operand_iterator dummy_begin()
const_reference front() const
access the first element
successor_list successors
std::list< T, Allocator< T > > type
const_dummy_operand_iterator dummy_end() const
void link(basicblock *v, basicblock *w)
MachineBasicBlock * successor_front() const
const_reference back() const
access the last element
std::size_t dummy_op_size() const
const_dummy_operand_iterator dummy_begin() const
std::size_t op_size() const
successor_list::const_iterator const_successor_iterator
MachineOperandDesc(MachineInstruction *parent, std::size_t index)
std::vector< T, Allocator< T > > type
Simple stream class for formatted output.
Type
Types used internally by JITTED code.
successor_iterator successor_end()
operand_iterator find(MachineOperand *op)
virtual bool is_phi() const
bool has_embedded_operands()
alloc::vector< MachineOperandDesc >::type operand_list
std::size_t successor_size() const
alloc::list< MachineBasicBlock * >::type successor_list
OStream & operator<<(OStream &OS, const std::string &t)
MachineOperandDesc & get_result()
bool aquivalent(const MachineOperand &MO) const
dummy_operand_iterator find_dummy(MachineOperand *op)
virtual bool is_move() const
Proxy to encode explicit and implicit successors.
static std::size_t id_counter
operand_list::iterator operand_iterator
dummy_operand_list dummy_operands
dummy_operands is a list of operands embedded in the real operands of this instruction that need regi...
MachineOperandDesc & operator[](std::size_t i)
dummy_operand_list::iterator dummy_operand_iterator
dummy_operand_iterator dummy_end()
Operands that can be directly used by the machine (register, memory, stackslot)
MachineBasicBlock * block
void finalize_operands()
has to be called after all operands with embedded operands have been added
MachineOperandDesc & dummy_back()
const MachineOperandDesc & get_result() const
std::size_t get_index() const
MachineOperandDesc & front()
bool successor_empty() const
successor_list::iterator successor_iterator
MachineInstruction * get_MachineInstruction() const
MachineOperandDesc & get_dummy(std::size_t i)
alloc::vector< MachineOperandDesc >::type dummy_operand_list
virtual bool is_call() const
const_successor_iterator successor_begin() const
std::size_t get_id() const
const_successor_iterator successor_end() const
const_operand_iterator begin() const
MachineOperandDesc(MachineInstruction *parent, MachineOperand *op)
MachineBasicBlock * get_block() const
std::unordered_map< Key, T, Hash, KeyEqual, Allocator< std::pair< const Key, T > > > type
void set_dummy_operand(EmbeddedMachineOperand *op)