2016-10-05 19:00:28 +00:00
|
|
|
#include "mcg.h"
|
|
|
|
|
|
|
|
static int vreg_count = 1;
|
|
|
|
|
|
|
|
struct vreg* new_vreg(void)
|
|
|
|
{
|
|
|
|
struct vreg* vreg = calloc(1, sizeof *vreg);
|
|
|
|
vreg->id = vreg_count++;
|
|
|
|
return vreg;
|
|
|
|
}
|
|
|
|
|
2016-10-08 21:32:54 +00:00
|
|
|
struct hreg* new_hreg(const struct burm_register_data* brd)
|
2016-10-05 19:00:28 +00:00
|
|
|
{
|
|
|
|
struct hreg* hreg = calloc(1, sizeof *hreg);
|
|
|
|
hreg->name = brd->name;
|
2016-10-15 09:42:47 +00:00
|
|
|
hreg->realname = brd->realname;
|
2016-10-15 16:38:46 +00:00
|
|
|
hreg->type = brd->type;
|
2016-10-05 19:00:28 +00:00
|
|
|
hreg->attrs = brd->attrs;
|
|
|
|
hreg->is_stacked = false;
|
|
|
|
return hreg;
|
|
|
|
}
|
|
|
|
|
2016-10-15 16:38:46 +00:00
|
|
|
struct hreg* new_stacked_hreg(int offset, uint32_t type)
|
2016-10-05 19:00:28 +00:00
|
|
|
{
|
|
|
|
struct hreg* hreg = calloc(1, sizeof *hreg);
|
|
|
|
hreg->name = aprintf("stacked_%d", offset);
|
2016-10-15 09:42:47 +00:00
|
|
|
hreg->realname = hreg->name;
|
2016-10-15 16:38:46 +00:00
|
|
|
hreg->type = type;
|
|
|
|
hreg->attrs = type;
|
2016-10-05 19:00:28 +00:00
|
|
|
hreg->is_stacked = true;
|
|
|
|
hreg->offset = offset;
|
|
|
|
return hreg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set sw=4 ts=4 expandtab : */
|
|
|
|
|