44 #define DEBUG_NAME "compiler2/SourceStateAttachment"
52 SourceStateInst *get_associated_source_state(Instruction *
I) {
53 for (
auto i = I->rdep_begin();
i != I->rdep_end();
i++) {
54 SourceStateInst *source_state = (*i)->to_SourceStateInst();
55 if (source_state != NULL) {
71 latest_source_state = get_associated_source_state(begin);
74 assert(latest_source_state);
88 latest_source_state = get_associated_source_state(I);
89 assert(latest_source_state);
93 return latest_source_state;
98 IS = get_Pass<ListSchedulingPass>();
111 SourceStateInst *init_source_state = get_associated_source_state(init_bb);
113 blocks_to_process.push(init_bb);
114 source_state_at_block_entry.push(init_source_state);
116 while (!blocks_to_process.empty()) {
117 BeginInst *begin = blocks_to_process.front();
118 blocks_to_process.pop();
119 SourceStateInst *latest_source_state = source_state_at_block_entry.front();
120 source_state_at_block_entry.pop();
123 if (processed_blocks.count(begin) > 0) {
127 latest_source_state =
process_block(begin, latest_source_state);
128 processed_blocks.insert(begin);
133 blocks_to_process.push(successor);
134 source_state_at_block_entry.push(latest_source_state);
void set_source_state(SourceStateInst *source_state)
Set the SourceStateInst that corresponds to this Instruction.
This Instruction marks the start of a basic block.
This Instruction marks the end of a basic block.
MachineInstructionSchedulingPass TODO: more info.
virtual bool has_side_effects() const
True the instruction has side effects.
virtual SourceStateAwareInst * to_SourceStateAwareInst()
virtual PassUsage & get_PassUsage(PassUsage &PU) const
Set the requirements for the pass.
SourceStateInst * process_block(BeginInst *begin, SourceStateInst *latest_source_state)
std::unordered_set< Key, Hash, KeyEqual, Allocator< Key > > type
void add_schedule_before()
Schedule before PassName.
const_inst_iterator inst_begin(const BeginInst *BI) const
Base type of instructions that can be mapped to a SourceStateInst.
SuccessorListTy::const_iterator succ_end() const
Provides a mapping from HIR values to baseline IR variables.
Stores the interdependencies of a pass.
EndInst * get_EndInst() const
SuccessorListTy::const_iterator succ_begin() const
#define LOG(STMT)
Analogous to DEBUG.
InstructionSchedule< Instruction > * IS
std::queue< T, Container > type
virtual Instruction * to_Instruction()=0
Convert this SourceStateAwareInst to an Instruction.
const_inst_iterator inst_end(const BeginInst *BI) const
virtual bool run(JITData &JD)
Run the Pass.
static PassRegistry< BasicBlockSchedulingPass > X("BasicBlockSchedulingPass")
BeginInst * get_init_bb() const
virtual bool needs_source_state()
std::size_t pred_size() const
void add_requires()
PassName is required.