本文整理汇总了C++中StatementList::get_suif_env方法的典型用法代码示例。如果您正苦于以下问题:C++ StatementList::get_suif_env方法的具体用法?C++ StatementList::get_suif_env怎么用?C++ StatementList::get_suif_env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementList
的用法示例。
在下文中一共展示了StatementList::get_suif_env方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dismantle_c_for_statement
Statement* c_for_statement_walker::dismantle_c_for_statement(CForStatement *the_for){
StatementList *replacement = create_statement_list(the_for->get_suif_env());
StatementList *body = create_statement_list(the_for->get_suif_env());
Statement* original_body = the_for->get_body();
the_for->set_body(0);
body->append_statement(original_body);
the_for->set_body(body);
Statement* pre_pad = the_for->get_pre_pad();
CodeLabelSymbol* break_lab = the_for->get_break_label();
CodeLabelSymbol* continue_lab = the_for->get_continue_label();
Statement* before = the_for->get_before();
Expression* test = the_for->get_test();
Statement* step = the_for->get_step();;
if(before)remove_suif_object(before);
if(test)remove_suif_object(test);
if(step)remove_suif_object(step);
if(body)remove_suif_object(body);
if(pre_pad)remove_suif_object(pre_pad);
the_for->set_break_label(0);
the_for->set_continue_label(0);
// I am guessing what pre-pad and post-pad do
if (before)
replacement->append_statement(before);
// and loop if not out of range
replacement->append_statement(
create_label_location_statement(the_for->get_suif_env(), continue_lab));
if(test) {
SuifEnv *env = the_for->get_suif_env();
DataType *bool_type = get_type_builder(env)->get_boolean_type();
test = create_unary_expression(env,bool_type,k_logical_not,test);
replacement->append_statement(create_branch_statement(env,test,break_lab));
}
if(pre_pad){
replacement->append_statement(pre_pad);
}
append_flattened(replacement,body);
append_flattened(replacement,step);
replacement->append_statement(create_jump_statement(body->get_suif_env(),continue_lab));
replacement->append_statement(
create_label_location_statement(body->get_suif_env(), break_lab));
// end of loop
the_for->get_parent()->replace(the_for, replacement);
return replacement;
}