| 3321 | */ |
| 3322 | |
| 3323 | void sp_head::optimize() |
| 3324 | { |
| 3325 | List<sp_instr_opt_meta> bp; |
| 3326 | sp_instr *i; |
| 3327 | uint src, dst; |
| 3328 | |
| 3329 | DBUG_EXECUTE_IF("sp_head_optimize_disable", return; ); |
| 3330 | |
| 3331 | opt_mark(); |
| 3332 | |
| 3333 | bp.empty(); |
| 3334 | src= dst= 0; |
| 3335 | while ((i= get_instr(src))) |
| 3336 | { |
| 3337 | if (! i->marked) |
| 3338 | { |
| 3339 | delete i; |
| 3340 | src+= 1; |
| 3341 | } |
| 3342 | else |
| 3343 | { |
| 3344 | if (src != dst) |
| 3345 | { |
| 3346 | /* Move the instruction and update prev. jumps */ |
| 3347 | sp_instr_opt_meta *ibp; |
| 3348 | List_iterator_fast<sp_instr_opt_meta> li(bp); |
| 3349 | |
| 3350 | set_dynamic(&m_instr, (uchar*)&i, dst); |
| 3351 | while ((ibp= li++)) |
| 3352 | { |
| 3353 | ibp->set_destination(src, dst); |
| 3354 | } |
| 3355 | } |
| 3356 | i->opt_move(dst, &bp); |
| 3357 | src+= 1; |
| 3358 | dst+= 1; |
| 3359 | } |
| 3360 | } |
| 3361 | m_instr.elements= dst; |
| 3362 | bp.empty(); |
| 3363 | } |
| 3364 | |
| 3365 | void sp_head::add_mark_lead(uint ip, List<sp_instr> *leads) |
| 3366 | { |
no test coverage detected