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);
|
2016-10-21 21:31:00 +00:00
|
|
|
hreg->id = brd->id;
|
|
|
|
hreg->brd = brd;
|
2016-10-05 19:00:28 +00:00
|
|
|
hreg->attrs = brd->attrs;
|
|
|
|
hreg->is_stacked = false;
|
2016-10-21 21:31:00 +00:00
|
|
|
/* The aliases array needs to be initialised later. */
|
2016-10-05 19:00:28 +00:00
|
|
|
return hreg;
|
|
|
|
}
|
|
|
|
|
2016-10-25 21:04:20 +00:00
|
|
|
struct hreg* new_stacked_hreg(uint32_t attrs)
|
2016-10-05 19:00:28 +00:00
|
|
|
{
|
2016-10-15 20:53:56 +00:00
|
|
|
static int hreg_count = 1;
|
2016-10-05 19:00:28 +00:00
|
|
|
struct hreg* hreg = calloc(1, sizeof *hreg);
|
2016-10-25 21:04:20 +00:00
|
|
|
hreg->id = aprintf("stacked_%d_id_%d", attrs, hreg_count++);
|
|
|
|
hreg->attrs = attrs;
|
2016-10-05 19:00:28 +00:00
|
|
|
hreg->is_stacked = true;
|
2016-10-15 20:53:56 +00:00
|
|
|
hreg->offset = -1;
|
2016-10-21 21:31:00 +00:00
|
|
|
array_append(&hreg->aliases, hreg);
|
2016-10-05 19:00:28 +00:00
|
|
|
return hreg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set sw=4 ts=4 expandtab : */
|
|
|
|
|