25 #ifndef _JIT_COMPILER2_MACHINEINSTRUCTION
26 #define _JIT_COMPILER2_MACHINEINSTRUCTION
47 class MachineMoveInst;
50 class MachineInstruction;
65 : parent(parent), index(index),
op(NULL) {}
69 : parent(parent),
index(0), op(op) {}
87 class SuccessorProxy :
public memory::ManagerMixin<SuccessorProxy> {
92 enum Type { ExplTy, ImplTy };
93 MachineBasicBlock *entry;
97 explicit SuccessorProxy(MachineBasicBlock* MBB, Explicit)
98 : entry(MBB), type(ExplTy) {}
100 explicit SuccessorProxy(MachineBasicBlock* MBB, Implicit)
101 : entry(MBB), type(ImplTy) {}
103 operator MachineBasicBlock*()
const;
126 pos = dummy_operands.size();
130 ref_map.insert(std::make_pair(op,pos));
133 const std::size_t
id;
150 :
id(id_counter++), operands(num_operands,dflt), result(result), name(name) {
154 :
id(id_counter++), operands(), dummy_operands(), ref_map(), result(this, result), name(name), comment(comment),
block(NULL) {
155 for (std::size_t
i = 0;
i < num_operands ; ++
i) {
160 set_dummy_operand(&(*it));
169 assert(i < operands.size());
173 set_dummy_operand(&(*it));
181 it->first->real = &dummy_operands[it->second];
193 return operands.size();
196 assert(i < operands.size());
197 assert(operands[i].get_index() == i);
201 assert(
i < operands.size());
202 assert(operands[
i].get_index() ==
i);
206 assert(
i < operands.size());
207 assert(operands[
i].get_index() ==
i);
211 return operands.begin();
214 return operands.end();
224 return operands.front();
227 return operands.back();
230 return operands.begin();
233 return operands.end();
236 return dummy_operands.size();
239 assert(i < dummy_operands.size());
240 assert(dummy_operands[i].get_index() == i);
241 return dummy_operands[
i];
244 assert(i < dummy_operands.size());
245 assert(dummy_operands[i].get_index() == i);
246 return dummy_operands[
i];
249 return dummy_operands.begin();
252 return dummy_operands.end();
262 return dummy_operands.front();
265 return dummy_operands.back();
268 return dummy_operands.begin();
271 return dummy_operands.end();
274 return successors.begin();
277 return successors.end();
280 return successors.begin();
283 return successors.
front();
286 return successors.
back();
289 return successors.end();
292 return successors.size();
295 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()
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)
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
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
void set_dummy_operand(EmbeddedMachineOperand *op)