diff options
| author | 2025-10-19 08:09:09 +0200 | |
|---|---|---|
| committer | 2025-10-19 08:09:09 +0200 | |
| commit | dea8fd171acb54b6d9685422d5e391fb55074008 (patch) | |
| tree | 2c149892f35c5183c9b2a1da4ab437228dc432ef /cfg.c | |
| parent | 3437945692f2b87883a4f066473c9deed50f25f5 (diff) | |
Organize source files into directories
Diffstat (limited to 'cfg.c')
| -rw-r--r-- | cfg.c | 43 |
1 files changed, 0 insertions, 43 deletions
@@ -1,43 +0,0 @@ -#include "ir.h" - -static void -porec(struct block ***rpo, struct block *b) -{ - if (wasvisited(b)) return; - markvisited(b); - if (b->s2) porec(rpo, b->s2); - if (b->s1) porec(rpo, b->s1); - *--*rpo = b; -} - -void -sortrpo(struct function *fn) -{ - static struct block **rpobuf; - struct block **rpoend, **rpo; - int i, ndead; - - xbgrow(&rpobuf, fn->nblk); - rpo = rpoend = rpobuf + fn->nblk, - - startbbvisit(); - fn->entry->id = 0; - porec(&rpo, fn->entry); - ndead = rpo - rpobuf; - for (struct block *blk = fn->entry; ndead > 0; blk = blk->lnext) { - if (!wasvisited(blk)) { - blk->lnext = blk->lprev = NULL; - freeblk(fn, blk); - --ndead; - } - } - for (i = 1, ++rpo; rpo < rpoend; ++rpo, ++i) { - rpo[-1]->lnext = rpo[0]; - rpo[0]->lprev = rpo[-1]; - rpo[0]->id = i; - } - fn->entry->lprev = rpo[-1]; - rpo[-1]->lnext = fn->entry; -} - -/* vim:set ts=3 sw=3 expandtab: */ |