| 512 | } |
| 513 | |
| 514 | void GcnTokenListOptimizer::optimize(GcnTokenList& tokens) |
| 515 | { |
| 516 | m_tokens = &tokens; |
| 517 | |
| 518 | removeRedundantLoops(); |
| 519 | removeEmptyIfs(); |
| 520 | mergeBlocks(); |
| 521 | removeRedundantNesting(); |
| 522 | adjustLoopEnds(); |
| 523 | removeRedundantBlocks(); |
| 524 | |
| 525 | // TODO: |
| 526 | // more optimizations. |
| 527 | // there is a removeRedundantBranches in cheerp's implementation, |
| 528 | // I'm not very clear about it, so didn't port to here. |
| 529 | } |
| 530 | |
| 531 | template <uint32_t Kind, typename FnType> |
| 532 | void GcnTokenListOptimizer::for_each_kind(FnType func) |