ack/mach/proto/mcg/basicblock.c
David Given c079e97492 Perform SSA conversion of locals. Much, *much* better code now, at least
inasmuch as it looks better before register allocation. Basic blocks now know
their own successors and predecessors (after a certain point in the IR
processing).
2016-10-02 17:50:34 +02:00

43 lines
738 B
C

#include "mcg.h"
static void init_idf();
static struct idf* str2idf(char* tg, int cp);
#define IDF_TYPE struct basicblock*
#define IDF_NAME block
#include <idf_pkg.spec>
#include <idf_pkg.body>
static int next_id = 0;
void bb_init(void)
{
init_idf();
}
struct basicblock* bb_get(const char* name)
{
struct idf* p;
if (!name)
name = aprintf("___anon_bb_%d", next_id++);
p = str2idf((char*) name, 0);
if (!p->block)
{
p->block = calloc(1, sizeof(*p->block));
p->block->name = name;
}
return p->block;
}
void bb_alias(struct basicblock* block, const char* name)
{
struct idf* p = str2idf((char*) name, -1);
assert(p == NULL);
p = str2idf((char*) name, 0);
p->block = block;
}
/* vim: set sw=4 ts=4 expandtab : */