explicit cfg_t(dfa_t &a);
~cfg_t();
+ static void liveness_analysis(const cfg_t &cfg, bool *live);
+ static void dead_code_elimination(cfg_t &cfg, const bool *live);
+ static void interference(const cfg_t &cfg, const bool *live, bool *interf);
+ static tagver_t variable_allocation(const cfg_t &cfg, const bool *interf, tagver_t *ver2new);
+ static void renaming(cfg_t &cfg, const tagver_t *ver2new, tagver_t maxver);
+ static void normalization(cfg_t &cfg);
FORBID_COPY(cfg_t);
};
-void tag_liveness(const cfg_t &cfg, bool *live);
-void tag_dce(cfg_t &cfg, const bool *live);
-void tag_interference(const cfg_t &cfg, const bool *live, bool *interf);
-tagver_t tag_allocation(const cfg_t &cfg, const bool *interf, tagver_t *ver2new);
-void tag_renaming(cfg_t &cfg, const tagver_t *ver2new, tagver_t maxver);
-void tag_normalization(cfg_t &cfg);
-
} // namespace re2c
#endif // _RE2C_IR_DFA_CFG_CFG_
namespace re2c
{
-void tag_dce(cfg_t &cfg, const bool *live)
+void cfg_t::dead_code_elimination(cfg_t &cfg, const bool *live)
{
const tagver_t nver = cfg.dfa.maxtagver + 1;
cfg_bb_t *b = cfg.bblocks, *e = b + cfg.nbblock;
static void interfere(const tcmd_t &cmd, bool *interf, bool *live, bool *buf, size_t nver);
-void tag_interference(const cfg_t &cfg, const bool *live, bool *interf)
+void cfg_t::interference(const cfg_t &cfg, const bool *live, bool *interf)
{
const size_t nver = static_cast<size_t>(cfg.dfa.maxtagver) + 1;
bool *buf1 = new bool[nver];
namespace re2c
{
-void tag_liveness(const cfg_t &cfg, bool *live)
+void cfg_t::liveness_analysis(const cfg_t &cfg, bool *live)
{
const size_t
nbb = cfg.nbblock,
* For that reason all commands are normalized.
*/
-void tag_normalization(cfg_t &cfg)
+void cfg_t::normalization(cfg_t &cfg)
{
cfg_bb_t *b = cfg.bblocks, *e = b + cfg.nbblock;
for (; b < e; ++b) {
bool *interf = new bool[nver * nver];
tagver_t *ver2new = new tagver_t[nver];
- tag_liveness(cfg, live);
- tag_dce(cfg, live);
- tag_interference(cfg, live, interf);
- const tagver_t maxver = tag_allocation(cfg, interf, ver2new);
- tag_renaming(cfg, ver2new, maxver);
- tag_normalization(cfg);
+ cfg_t::liveness_analysis(cfg, live);
+ cfg_t::dead_code_elimination(cfg, live);
+ cfg_t::interference(cfg, live, interf);
+ const tagver_t maxver = cfg_t::variable_allocation(cfg, interf, ver2new);
+ cfg_t::renaming(cfg, ver2new, maxver);
+ cfg_t::normalization(cfg);
delete[] live;
delete[] interf;
namespace re2c
{
-void tag_renaming(cfg_t &cfg, const tagver_t *ver2new, tagver_t maxver)
+void cfg_t::renaming(cfg_t &cfg, const tagver_t *ver2new, tagver_t maxver)
{
tagver_t &oldmax = cfg.dfa.maxtagver;
if (oldmax == maxver) return;
* We build just some cover (not necessarily minimal).
* The algorithm takes quadratic (in the number of tags) time.
*/
-tagver_t tag_allocation(const cfg_t &cfg, const bool *interf,
+tagver_t cfg_t::variable_allocation(const cfg_t &cfg, const bool *interf,
tagver_t *ver2new)
{
const tagver_t