本文整理汇总了C++中IR::is_exp方法的典型用法代码示例。如果您正苦于以下问题:C++ IR::is_exp方法的具体用法?C++ IR::is_exp怎么用?C++ IR::is_exp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IR
的用法示例。
在下文中一共展示了IR::is_exp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doProp
//'usevec': for local used.
bool IR_CP::doProp(IN IRBB * bb, Vector<IR*> & usevec)
{
bool change = false;
C<IR*> * cur_iter, * next_iter;
for (BB_irlist(bb).get_head(&cur_iter),
next_iter = cur_iter; cur_iter != NULL; cur_iter = next_iter) {
IR * def_stmt = cur_iter->val();
BB_irlist(bb).get_next(&next_iter);
if (!is_copy(def_stmt)) { continue; }
DUSet const* useset = NULL;
UINT num_of_use = 0;
SSAInfo * ssainfo = NULL;
bool ssadu = false;
if ((ssainfo = def_stmt->get_ssainfo()) != NULL &&
SSA_uses(ssainfo).get_elem_count() != 0) {
//Record use_stmt in another vector to facilitate this function
//if it is not in use-list any more after copy-propagation.
SEGIter * sc;
for (INT u = SSA_uses(ssainfo).get_first(&sc);
u >= 0; u = SSA_uses(ssainfo).get_next(u, &sc)) {
IR * use = m_ru->get_ir(u);
ASSERT0(use);
usevec.set(num_of_use, use);
num_of_use++;
}
ssadu = true;
} else if (def_stmt->get_exact_ref() == NULL &&
!def_stmt->is_void()) {
//Allowing copy propagate exact or VOID value.
continue;
} else if ((useset = def_stmt->readDUSet()) != NULL &&
useset->get_elem_count() != 0) {
//Record use_stmt in another vector to facilitate this function
//if it is not in use-list any more after copy-propagation.
DUIter di = NULL;
for (INT u = useset->get_first(&di);
u >= 0; u = useset->get_next(u, &di)) {
IR * use = m_ru->get_ir(u);
usevec.set(num_of_use, use);
num_of_use++;
}
} else {
continue;
}
IR const* prop_value = get_propagated_value(def_stmt);
for (UINT i = 0; i < num_of_use; i++) {
IR * use = usevec.get(i);
ASSERT0(use->is_exp());
IR * use_stmt = use->get_stmt();
ASSERT0(use_stmt->is_stmt());
ASSERT0(use_stmt->get_bb() != NULL);
IRBB * use_bb = use_stmt->get_bb();
if (!ssadu &&
!(bb == use_bb && bb->is_dom(def_stmt, use_stmt, true)) &&
!m_cfg->is_dom(BB_id(bb), BB_id(use_bb))) {
//'def_stmt' must dominate 'use_stmt'.
//e.g:
// if (...) {
// g = 10; //S1
// }
// ... = g; //S2
//g can not be propagted since S1 is not dominate S2.
continue;
}
if (!is_available(def_stmt, prop_value, use_stmt)) {
//The value that will be propagated can
//not be killed during 'ir' and 'use_stmt'.
//e.g:
// g = a; //S1
// if (...) {
// a = ...; //S3
// }
// ... = g; //S2
//g can not be propagted since a is killed by S3.
continue;
}
if (!ssadu && !m_du->isExactAndUniqueDef(def_stmt, use)) {
//Only single definition is allowed.
//e.g:
// g = 20; //S3
// if (...) {
// g = 10; //S1
// }
// ... = g; //S2
//g can not be propagted since there are
//more than one definitions are able to get to S2.
continue;
}
//.........这里部分代码省略.........