* Generate a somewhat-trivial `for' loop */
| 266 | * Generate a somewhat-trivial `for' loop |
| 267 | */ |
| 268 | StatementFor * |
| 269 | StatementFor::make_random(CGContext &cg_context) |
| 270 | { |
| 271 | FactMgr* fm = get_fact_mgr(&cg_context); |
| 272 | assert(fm); |
| 273 | cg_context.get_effect_stm().clear(); |
| 274 | |
| 275 | StatementAssign* init = NULL; |
| 276 | StatementAssign* incr = NULL; |
| 277 | Expression* test = NULL; |
| 278 | unsigned int bound = 0; |
| 279 | const Variable* iv = make_iteration(cg_context, init, test, incr, bound); |
| 280 | // record the effect and facts before loop body |
| 281 | Effect pre_effects = cg_context.get_effect_stm(); |
| 282 | vector<const Fact*> pre_facts = fm->global_facts; |
| 283 | |
| 284 | // create CGContext for body |
| 285 | CGContext body_cg_context(cg_context, cg_context.rw_directive, iv, bound); |
| 286 | Block *body = Block::make_random(body_cg_context, true); |
| 287 | ERROR_GUARD_AND_DEL3(NULL, init, test, incr); |
| 288 | |
| 289 | StatementFor* sf = new StatementFor(cg_context.get_current_block(), *init, *test, *incr, *body); |
| 290 | sf->post_loop_analysis(cg_context, pre_facts, pre_effects); |
| 291 | return sf; |
| 292 | } |
| 293 | |
| 294 | /* generate loop traversing array(s) */ |
| 295 | StatementFor * |
nothing calls this directly
no test coverage detected