31 #define DEBUG_NAME "compiler2/MachineBasicBlock"
45 return OS <<
"MBB:" <<
setz(4) <<
id;
60 LOG(
"Instruction " << *MI <<
" moved from " <<
from
61 <<
" to " <<
to <<
" predecessor of MBB: " << *MBB <<
nl);
75 return OS <<
"MIIterator end";
81 struct TargetOperandEqualPred
82 :
public std::unary_function<MachineInstruction*,bool> {
85 TargetOperandEqualPred(MachineOperand *
op) : op(op) {}
87 bool operator()(MachineInstruction* MI) {
88 return MI->get_result().op ==
op;
97 = std::find_if(MBB->
phi_begin(), MBB->
phi_end(), TargetOperandEqualPred(op));
143 std::insert_iterator<MachineBasicBlock> get_edge_inserter(
144 MachineBasicBlock *
from, MachineBasicBlock *to) {
146 return std::inserter(*last.block_it(), last);
void update(MachineInstruction *MI)
update instruction block
const_pred_iterator pred_end() const
returns an const iterator to the predecessors
const_phi_iterator phi_end() const
returns an const iterator to the phi instructions
PredListTy::iterator pred_iterator
MIIterator get_edge_iterator(MachineBasicBlock *from, MachineBasicBlock *to, Backend *backend)
bool check_is_phi(MachineInstruction *value)
iterator insert_before(iterator pos, MachineInstruction *value)
inserts value before the element pointed to by pos
virtual bool is_jump() const
MachinePhiInst * get_phi_from_operand(MachineBasicBlock *MBB, MachineOperand *op)
MIIterator mi_last()
returns an MIIterator to the last element (included)
PhiListTy::const_iterator const_phi_iterator
A basic block of (scheduled) machine instructions.
virtual void set_block(MachineBasicBlock *MBB)
MBBIterator self_iterator() const
get self iterator
MIIterator insert_before(MIIterator pos, MachineInstruction *value)
Get an edge inserter.
successor_iterator successor_begin()
const_phi_iterator phi_begin() const
returns an const iterator to the phi instructions
virtual MachineInstruction * create_Jump(MachineBasicBlock *target) const =0
const_reference back() const
access the last element
void push_back(MachineInstruction *value)
Appends the given element value to the end of the container.
successor_list::const_iterator const_successor_iterator
const_pred_iterator pred_begin() const
returns an const iterator to the predecessors
Simple stream class for formatted output.
void push_front(MachineInstruction *value)
inserts value to the beginning
successor_iterator successor_end()
MachineBasicBlock * get_edge_block(MachineBasicBlock *from, MachineBasicBlock *to, Backend *backend)
get a new basic block for a given edge
OStream & operator<<(OStream &OS, const Conditional::CondID &cond)
virtual bool is_phi() const
MachineInstructionSchedule * get_parent() const
get parent
#define LOG(STMT)
Analogous to DEBUG.
Proxy to encode explicit and implicit successors.
OStream & print(OStream &OS) const
print
static std::size_t id_counter
MIIterator convert(iterator pos)
get a MIIterator form a iterator
Operands that can be directly used by the machine (register, memory, stackslot)
MIIterator insert_after(MIIterator pos, MachineInstruction *value)
void operator()(MachineInstruction *MI)
successor_list::iterator successor_iterator
iterator insert_after(iterator pos, MachineInstruction *value)
inserts value after the element pointed to by pos
static SetZero setz(size_t w)