30 #define DEBUG_NAME "compiler2/LivetimeInterval"
38 assert(!(last < first));
57 if (range.
end < current.
end) {
99 if (pos < i->start.get_iterator())
101 if (pos <= i->
end.get_iterator()) {
121 a_e = a.
end(), b_e = b.
end() ; a_i != a_e && b_i != b_e ; ) {
123 if (a_i->end < b_i->start) {
127 if (b_i->end < a_i->start) {
131 return std::max(a_i->start,b_i->start);
146 LOG(
"pre " << *pre <<
nl);
149 LOG(
"post " << *pre <<
nl);
155 assert(lti_next.pimpl);
156 return lti_next.get_operand(pos);
158 assert(!(pos <
front().start.get_iterator()));
187 for (; i!=
e && *i <
pos; ++
i) {
188 LOG2(
" keep " << *i <<
nl);
192 LOG2(
" move " << *tmp <<
nl);
193 to->
uses.insert(*tmp);
194 from->
uses.erase(tmp);
201 for (; i!=
e && *i <
pos; ++
i) {
202 LOG2(
" keep " << *i <<
nl);
206 LOG2(
" move " << *tmp <<
nl);
207 to->
defs.insert(*tmp);
208 from->
defs.erase(tmp);
214 LOG2(
"split_active " << *
this <<
" at " << pos <<
nl);
215 #if defined(ENABLE_LOGGING)
218 LOG3(
"pre " << --tmp <<
nl);
219 LOG3(
">> " << ++tmp <<
nl);
220 LOG3(
"post " << ++tmp <<
nl);
232 LOG2(
"new use: " << use <<
nl);
233 LOG2(
"new def: " << def <<
nl);
243 LOG2(
"copy ranges" <<
nl);
246 for (; i !=
e && i->end < ((current == NULL) ? def : *current); ++
i) {
247 LOG2(
" keep " << *i <<
nl);
250 assert(i->start < def);
257 lti.
pimpl->insert_usedef(def);
262 LOG2(
" move " << *tmp <<
nl);
263 lti.
pimpl->intervals.push_back(*tmp);
274 LOG2(
"Split " << *
this <<
" at " << pos <<
nl);
283 LOG2(
"copy ranges" <<
nl);
286 for (; i !=
e && i->start <
pos; ++
i) {
287 LOG2(
" keep " << *i <<
nl);
293 LOG2(
" move " << *tmp <<
nl);
294 lti.
pimpl->intervals.push_back(*tmp);
307 LOG2(
"split_phi_active " << *
this <<
" at " << pos <<
nl);
319 LOG2(
"new def: " << def <<
nl);
320 LOG2(
"new use: " << use <<
nl);
330 LOG2(
"copy ranges" <<
nl);
333 for (; i !=
e && i->end < use; ++
i) {
334 LOG2(
" keep " << *i <<
nl);
343 lti.
pimpl->insert_usedef(def);
348 LOG2(
" move " << *tmp <<
nl);
349 lti.
pimpl->intervals.push_back(*tmp);
357 OS <<
"LivetimeInterval (" << lti.
front().
start <<
") in "
360 OS <<
" (hint:" << lti.
get_hint() <<
")";
366 return OS <<
"(LivetimeInterval) NULL";
372 if (usedef.
is_use()) OS <<
"Use";
373 if (usedef.
is_def()) OS <<
"Def";
378 return OS <<
"LivetimeRange " << range.
start <<
" - " << range.
end;
LivetimeInterval split_active(MIIterator pos, UseDef *current=NULL)
LivetimeInterval::iterator iterator
const MachineOperandDesc & get(std::size_t i) const
MachineOperand * get_operand() const
bool is_use_at(MIIterator pos) const
MIIterator get_iterator() const
Get instruction iterator.
const_iterator begin() const
LivetimeInterval::const_iterator const_iterator
MachineOperand * get_init_operand() const
static void move_use_def(LivetimeIntervalImpl *from, LivetimeIntervalImpl *to, UseDef pos)
void set_from(UseDef from, UseDef to)
Set from. If no interval available add range from to.
DefListTy::const_iterator const_def_iterator
virtual bool is_label() const
#define DEBUG_COND_N(VERBOSE)
const_def_iterator def_begin() const
void set_from(UseDef from, UseDef to)
LivetimeRange front() const
MachineBasicBlock * current
const_use_iterator use_begin() const
bool is_def_at(MIIterator pos) const
const_iterator end() const
const_iterator begin() const
Instruction::InstID tmp[]
std::size_t op_size() const
void set_operand(MachineOperand *op)
Set the current store of the interval.
LivetimeRange front() const
Simple stream class for formatted output.
OStream & operator<<(OStream &OS, const Conditional::CondID &cond)
State get_State(MIIterator pos) const
bool is_use() const
Is a use position.
LivetimeRange back() const
MachineOperand * get_init_operand() const
Get the initial operand.
#define LOG(STMT)
Analogous to DEBUG.
virtual bool is_move() const
LivetimeInterval split_phi_active(MIIterator pos, MachineOperand *MO)
Proxy to encode explicit and implicit successors.
UseDef next_intersection(const LivetimeInterval &a, const LivetimeInterval &b, UseDef pos, UseDef end)
const_iterator end() const
IntervalListTy::const_iterator const_iterator
UseListTy::const_iterator const_use_iterator
LivetimeInterval split_inactive(UseDef pos, MachineOperand *MO)
LivetimeInterval get_next() const
Operands that can be directly used by the machine (register, memory, stackslot)
const_def_iterator def_end() const
const MachineOperandDesc & get_result() const
MachineOperand * get_operand() const
Get the current store of the interval.
#define assert_msg(COND, EXPR)
MachineOperand * get_hint() const
Get the hint for the interval.
const_use_iterator use_end() const
void insert_usedef(const UseDef &usedef)
shared_ptr< LivetimeIntervalImpl > pimpl
bool is_def() const
Is a def position.
void add_range(UseDef first, UseDef last)
A range the range [first, last] to the interval.
bool is_pseudo() const
Is a pseudo use/def.
UseDef next_usedef_after(UseDef, UseDef) const