| 1300 | } |
| 1301 | |
| 1302 | GcnTokenList GcnStackifier::structurize() |
| 1303 | { |
| 1304 | // TODO: |
| 1305 | // A big todo though, stackifier algorithm doesn't support |
| 1306 | // irreducible cfg, we need to convert the irreducible |
| 1307 | // cfg to a reducible one manually by dispatch loops |
| 1308 | // using some variables. |
| 1309 | LOG_ASSERT(isIrreducible() == false, "TODO: support irreducible cfg."); |
| 1310 | |
| 1311 | GcnTokenList tokenList; |
| 1312 | |
| 1313 | m_builder.build(tokenList); |
| 1314 | LOG_ASSERT(m_verifier.verify(tokenList), "token list not valid"); |
| 1315 | //LOG_DEBUG("%s", tokenList.dump().c_str()); |
| 1316 | |
| 1317 | m_optimizer.optimize(tokenList); |
| 1318 | LOG_ASSERT(m_verifier.verify(tokenList), "token list not valid"); |
| 1319 | //LOG_DEBUG("%s", tokenList.dump().c_str()); |
| 1320 | |
| 1321 | m_eliminator.eliminate(tokenList); |
| 1322 | LOG_ASSERT(m_verifier.verify(tokenList), "token list not valid"); |
| 1323 | |
| 1324 | m_diverger.diverge(tokenList); |
| 1325 | LOG_ASSERT(m_verifier.verify(tokenList), "token list not valid"); |
| 1326 | //LOG_DEBUG("%s", tokenList.dump().c_str()); |
| 1327 | |
| 1328 | return tokenList; |
| 1329 | } |
| 1330 | |
| 1331 | bool GcnStackifier::isIrreducible() |
| 1332 | { |