ack/mach/proto/mcg/reg.c

38 lines
798 B
C
Raw Normal View History

#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)
{
struct hreg* hreg = calloc(1, sizeof *hreg);
hreg->name = brd->name;
hreg->realname = brd->realname;
hreg->type = brd->type;
hreg->attrs = brd->attrs;
hreg->is_stacked = false;
return hreg;
}
struct hreg* new_stacked_hreg(uint32_t type)
{
static int hreg_count = 1;
struct hreg* hreg = calloc(1, sizeof *hreg);
hreg->name = aprintf("stacked_%d_id_%d", type, hreg_count++);
hreg->realname = hreg->name;
hreg->type = type;
hreg->attrs = type;
hreg->is_stacked = true;
hreg->offset = -1;
return hreg;
}
/* vim: set sw=4 ts=4 expandtab : */