39 #define DEBUG_NAME "compiler2/MachineInstructionSchedulingPass"
47 struct UpdatePhiOperand :
public std::unary_function<MachinePhiInst*,void> {
48 typedef alloc::map<Instruction*,MachineOperand*>::type InstMapTy;
51 UpdatePhiOperand(InstMapTy &
inst_map) : inst_map(inst_map) {}
53 virtual void operator()(MachinePhiInst* phi)
const {
54 PHIInst* phi_inst = phi->get_PHIInst();
59 e = phi->end();
i !=
e; ++
i) {
60 Instruction *
I = (*op)->to_Instruction();
62 InstMapTy::const_iterator it =
inst_map.find(I);
104 #if !PATTERN_MATCHING
105 LOG2(
"lowering for BB using list sched " << BI <<
nl);
107 e = IS->inst_end(BI);
i !=
e; ++
i) {
109 LOG2(
"lower: " << *I <<
nl);
113 LOG2(
"Lowering with Pattern Matching " << BI <<
nl);
122 assert(it != map.end());
130 LOG2(
"MBB: " << *MBB <<
nl);
132 UpdatePhiOperand functor(inst_map);
144 LOG2(
"new MBB: " << *new_MBB <<
nl);
158 if(MBB->
size() == 0) {
159 ERROR_MSG(
"verification failed",
"MachineBasicBlock ("
160 << *MBB <<
") empty");
166 ERROR_MSG(
"verification failed",
"first Instruction ("
167 << *front <<
") not a label");
173 ERROR_MSG(
"verification failed",
"last Instruction ("
174 << *back <<
") not a control flow transfer instruction");
183 if (phi->
op_size() != num_pred) {
184 ERROR_MSG(
"verification failed",
"Machine basic block (" << *MBB <<
") has "
185 << num_pred <<
" predecessors but phi node (" << *phi <<
") has " << phi->
op_size());
GlobalSchedule TODO: more info.
const_phi_iterator phi_end() const
returns an const iterator to the phi instructions
virtual bool is_jump() const
PredecessorListTy::const_iterator const_pred_iterator
PhiListTy::const_iterator const_phi_iterator
virtual bool is_end() const
This Instruction marks the start of a basic block.
A basic block of (scheduled) machine instructions.
virtual void accept(InstructionVisitor &v, bool copyOperands)=0
Visitor pattern.
MBBIterator self_iterator() const
get self iterator
void move_instructions(InputIterator first, InputIterator last, MachineBasicBlock &from, MachineBasicBlock &to)
Move instructions to another basic block.
iterator end()
returns an iterator to the end
virtual bool is_label() const
reference back()
access the last element
#define ERROR_MSG(EXPR_SHORT, EXPR_LONG)
iterator begin()
returns an iterator to the beginning
virtual PassUsage & get_PassUsage(PassUsage &PA) const
Set the requirements for the pass.
const_pred_iterator pred_begin() const
std::size_t size() const
returns the number of elements
iterator end()
returns an iterator to the end
const_phi_iterator phi_begin() const
returns an const iterator to the phi instructions
OperandListTy::const_iterator const_op_iterator
const_reference front() const
access the first element
const_reference back() const
access the last element
iterator begin()
returns an iterator to the beginning
std::size_t op_size() const
reference front()
access the first element
Stores the interdependencies of a pass.
std::size_t pred_size() const
returns the number of predecessor nodes
const_bb_iterator bb_end() const
void push_front(MachineInstruction *value)
inserts value to the beginning
MachineInstructionSchedule::iterator insert_after(iterator pos, const MBBBuilder &value)
inserts value after the element pointed to by pos
const_bb_iterator bb_begin() const
Proxy to encode explicit and implicit successors.
operand_list::iterator operand_iterator
jmethodID jint const void jint const jvmtiAddrLocationMap * map
virtual bool verify() const
Verify the Result.
const GlobalSchedule * GS
const_pred_iterator pred_end() const
BasicBlockListTy::const_iterator const_bb_iterator
BasicBlockSchedulingPass TODO: more info.
void insert_pred(MachineBasicBlock *value)
Appends the given element value to the list of predecessors.
static PassRegistry< BasicBlockSchedulingPass > X("BasicBlockSchedulingPass")
BasicBlockSchedule TODO: more info.
MachineInstructionSchedule::iterator push_back(const MBBBuilder &value)
Appends the given element value to the end of the container.
void add_requires()
PassName is required.
MachineBasicBlock * get_block() const
virtual bool run(JITData &JD)
Run the Pass.
InstructionSchedule TODO: more info.
virtual BeginInst * get_BeginInst() const
Get the corresponding BeginInst.