本文整理汇总了C++中IR::is_stmt方法的典型用法代码示例。如果您正苦于以下问题:C++ IR::is_stmt方法的具体用法?C++ IR::is_stmt怎么用?C++ IR::is_stmt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IR
的用法示例。
在下文中一共展示了IR::is_stmt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hoistIf
//Canonicalize det of IF.
//e.g: if (a=10,b+=3,c<a) {...}
//be replaced by
// a = 10;
// b += 3;
// if (c<a) {...}
bool IR_CFS_OPT::hoistIf(IR ** head, IR * ir)
{
ASSERT(ir->is_if(), ("need IF"));
ASSERT(IF_det(ir), ("DET is NULL"));
IR * det = IF_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = det->get_next();
}
IR * new_list = NULL;
if (i > 1) {
det = IF_det(ir);
while (i > 1) {
IR * c = det;
ASSERT(c->is_stmt(),
("Non-stmt ir should be remove during reshape_ir_tree()"));
det = det->get_next();
xcom::remove(&IF_det(ir), c);
xcom::add_next(&new_list, c);
i--;
}
xcom::insertbefore(head, ir, new_list);
return true;
}
return false;
}
示例2: hoistLoop
//Hoist det of loop.
//e.g: while (a=10,b+=3,c<a) {
// IR-List;
// }
//
//be replaced by
//
// a = 10;
// b += 3;
// while (c<a) {
// IR-List;
// a = 10;
// b += 3;
// }
bool IR_CFS_OPT::hoistLoop(IR ** head, IR * ir)
{
ASSERT0(ir->is_dowhile() || ir->is_whiledo() || ir->is_doloop());
ASSERT(LOOP_det(ir), ("DET is NULL"));
IR * det = LOOP_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = det->get_next();
}
IR * new_list = NULL, * new_body_list = NULL;
if (i > 1) {
det = LOOP_det(ir);
while (i > 1) {
IR * c = det;
ASSERT(c->is_stmt(), ("Non-stmt ir should be remove "
"during reshape_ir_tree()"));
det = det->get_next();
xcom::remove(&LOOP_det(ir), c);
xcom::add_next(&new_list, c);
i--;
}
new_body_list = m_ru->dupIRTreeList(new_list);
xcom::insertbefore(head, ir, new_list);
xcom::add_next(&LOOP_body(ir), new_body_list);
return true;
}
return false;
}
示例3: hoist_if
/* Canonicalize det of IF.
e.g: if (a=10,b+=3,c<a) {...}
be replaced by
a = 10;
b += 3;
if (c<a) {...} */
bool IR_CFS_OPT::hoist_if(IR ** head, IR * ir)
{
IS_TRUE(IR_type(ir) == IR_IF, ("need IF"));
IS_TRUE(IF_det(ir), ("DET is NULL"));
IR * det = IF_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = IR_next(det);
}
IR * new_list = NULL;
if (i > 1) {
det = IF_det(ir);
while (i > 1) {
IR * c = det;
IS_TRUE(c->is_stmt(),
("Non-stmt ir should be remove during reshape_ir_tree()"));
det = IR_next(det);
remove(&IF_det(ir), c);
add_next(&new_list, c);
i--;
}
insertbefore(head, ir, new_list);
return true;
}
return false;
}
示例4: hoist_loop
/* Hoist det of loop.
e.g: while (a=10,b+=3,c<a) {
IR-LIST;
}
be replaced by
a = 10;
b += 3;
while (c<a) {
IR-LIST;
a = 10;
b += 3;
} */
bool IR_CFS_OPT::hoist_loop(IR ** head, IR * ir)
{
IS_TRUE(IR_type(ir)==IR_DO_WHILE ||
IR_type(ir)==IR_WHILE_DO ||
IR_type(ir)==IR_DO_LOOP, ("need LOOP"));
IS_TRUE(LOOP_det(ir), ("DET is NULL"));
IR * det = LOOP_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = IR_next(det);
}
IR * new_list = NULL, * new_body_list = NULL;
if (i > 1) {
det = LOOP_det(ir);
while (i > 1) {
IR * c = det;
IS_TRUE(c->is_stmt(), ("Non-stmt ir should be remove "
"during reshape_ir_tree()"));
det = IR_next(det);
remove(&LOOP_det(ir), c);
add_next(&new_list, c);
i--;
}
new_body_list = m_ru->dup_irs_list(new_list);
insertbefore(head, ir, new_list);
add_next(&LOOP_body(ir), new_body_list);
return true;
}
return false;
}
示例5: encode_bb
/* Encode expression for single BB.
Scan IR statement literally, and encoding it for generating
the unique id for each individual expressions, and update
the 'GEN-SET' and 'KILL-SET' of IR-EXPR for BB as well as. */
void IR_EXPR_TAB::encode_bb(IRBB * bb)
{
C<IR*> * ct;
for (IR * ir = BB_irlist(bb).get_head(&ct);
ir != NULL; ir = BB_irlist(bb).get_next(&ct)) {
ASSERT0(ir->is_stmt());
switch (IR_code(ir)) {
case IR_ST:
{
ExpRep * ie = encode_expr(ST_rhs(ir));
if (ie != NULL) {
set_map_ir2ir_expr(ST_rhs(ir), ie);
}
}
break;
case IR_STPR:
{
ExpRep * ie = encode_expr(STPR_rhs(ir));
if (ie != NULL) {
set_map_ir2ir_expr(STPR_rhs(ir), ie);
}
}
break;
case IR_STARRAY:
{
ExpRep * ie = encode_expr(ARR_base(ir));
if (ie != NULL) {
set_map_ir2ir_expr(ARR_base(ir), ie);
}
for (IR * sub = ARR_sub_list(ir); sub != NULL; sub = IR_next(sub)) {
ExpRep * ie = encode_expr(sub);
if (ie != NULL) {
set_map_ir2ir_expr(sub, ie);
}
}
ie = encode_expr(STARR_rhs(ir));
if (ie != NULL) {
set_map_ir2ir_expr(STARR_rhs(ir), ie);
}
}
break;
case IR_IST:
{
ExpRep * ie = encode_expr(IST_rhs(ir));
if (ie != NULL) {
set_map_ir2ir_expr(IST_rhs(ir), ie);
}
ie = encode_istore_memaddr(IST_base(ir));
if (ie != NULL) {
set_map_ir2ir_expr(IST_base(ir), ie);
}
}
break;
case IR_ICALL: //indirective call
{
ExpRep * ie = encode_expr(ICALL_callee(ir));
if (ie != NULL) {
set_map_ir2ir_expr(ICALL_callee(ir), ie);
}
}
case IR_CALL:
{
IR * parm = CALL_param_list(ir);
while (parm != NULL) {
ExpRep * ie = encode_expr(parm);
if (ie != NULL) {
set_map_ir2ir_expr(parm, ie);
}
parm = IR_next(parm);
}
}
break;
case IR_GOTO:
break;
case IR_IGOTO:
{
ExpRep * ie = encode_expr(IGOTO_vexp(ir));
if (ie != NULL) {
set_map_ir2ir_expr(IGOTO_vexp(ir), ie);
}
}
break;
case IR_DO_WHILE:
case IR_WHILE_DO:
case IR_DO_LOOP: //loop with init , boundary , and step info
case IR_IF:
ASSERT(0, ("High level IR should be simplified"));
break;
case IR_LABEL:
break;
case IR_CASE:
case IR_REGION:
break;
//.........这里部分代码省略.........
示例6: computeLocal
void PRDF::computeLocal(IRBB * bb, List<IR const*> & lst)
{
DefSBitSetCore * gen = get_def(BB_id(bb));
DefSBitSetCore * use = get_use(BB_id(bb));
gen->clean(m_sbs_mgr);
use->clean(m_sbs_mgr);
for (IR * x = BB_last_ir(bb); x != NULL; x = BB_prev_ir(bb)) {
ASSERT0(x->is_stmt());
switch (IR_code(x)) {
case IR_ST:
lst.clean();
processOpnd(ST_rhs(x), lst, use, gen);
break;
case IR_STPR:
gen->bunion(STPR_no(x), m_sbs_mgr);
use->diff(STPR_no(x), m_sbs_mgr);
processMay(x, gen, use, true);
lst.clean();
processOpnd(STPR_rhs(x), lst, use, gen);
break;
case IR_SETELEM:
gen->bunion(SETELEM_prno(x), m_sbs_mgr);
use->diff(SETELEM_prno(x), m_sbs_mgr);
processMay(x, gen, use, true);
lst.clean();
processOpnd(SETELEM_rhs(x), lst, use, gen);
lst.clean();
processOpnd(SETELEM_ofst(x), lst, use, gen);
break;
case IR_GETELEM:
gen->bunion(GETELEM_prno(x), m_sbs_mgr);
use->diff(GETELEM_prno(x), m_sbs_mgr);
processMay(x, gen, use, true);
lst.clean();
processOpnd(GETELEM_base(x), lst, use, gen);
lst.clean();
processOpnd(GETELEM_ofst(x), lst, use, gen);
break;
case IR_STARRAY:
lst.clean();
processOpnd(x, lst, use, gen);
break;
case IR_IST:
lst.clean();
processOpnd(x, lst, use, gen);
break;
case IR_SWITCH:
lst.clean();
processOpnd(SWITCH_vexp(x), lst, use, gen);
break;
case IR_IGOTO:
lst.clean();
processOpnd(IGOTO_vexp(x), lst, use, gen);
break;
case IR_GOTO:
break;
case IR_CALL:
case IR_ICALL:
if (x->hasReturnValue()) {
gen->bunion(CALL_prno(x), m_sbs_mgr);
use->diff(CALL_prno(x), m_sbs_mgr);
processMay(x, gen, use, true);
}
lst.clean();
processOpnd(CALL_param_list(x), lst, use, gen);
if (x->is_icall() && ICALL_callee(x)->is_pr()) {
use->bunion(PR_no(ICALL_callee(x)), m_sbs_mgr);
processMay(ICALL_callee(x), gen, use, false);
}
break;
case IR_TRUEBR:
case IR_FALSEBR:
lst.clean();
processOpnd(BR_det(x), lst, use, gen);
break;
case IR_RETURN:
lst.clean();
processOpnd(RET_exp(x), lst, use, gen);
break;
case IR_PHI:
gen->bunion(PHI_prno(x), m_sbs_mgr);
use->diff(PHI_prno(x), m_sbs_mgr);
processMay(x, gen, use, true);
lst.clean();
processOpnd(PHI_opnd_list(x), lst, use, gen);
break;
case IR_REGION:
break;
default:
ASSERT0(0);
}
}
//.........这里部分代码省略.........