mcgg now checks that registers have at most one type attribute set.
This commit is contained in:
parent
f8e71d888b
commit
83cf1be6a8
|
@ -16,7 +16,10 @@
|
||||||
#include "smap.h"
|
#include "smap.h"
|
||||||
#include "mcgg.h"
|
#include "mcgg.h"
|
||||||
|
|
||||||
static char rcsid[] = "$Id$";
|
#define REGATTR_INT 0
|
||||||
|
#define REGATTR_LONG 1
|
||||||
|
#define REGATTR_FLOAT 2
|
||||||
|
#define REGATTR_DOUBLE 3
|
||||||
|
|
||||||
int maxcost = SHRT_MAX / 2;
|
int maxcost = SHRT_MAX / 2;
|
||||||
|
|
||||||
|
@ -162,6 +165,18 @@ int main(int argc, char* argv[])
|
||||||
rule(®, tree(&NOPL, tree(®, NULL, NULL), NULL))->cost = 1;
|
rule(®, tree(&NOPL, tree(®, NULL, NULL), NULL))->cost = 1;
|
||||||
rule(®, tree(&NOPD, tree(®, NULL, NULL), NULL))->cost = 1;
|
rule(®, tree(&NOPD, tree(®, NULL, NULL), NULL))->cost = 1;
|
||||||
rule(NULL, tree(&RET, NULL, NULL))->cost = 1;
|
rule(NULL, tree(&RET, NULL, NULL))->cost = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
struct regattr* attr = makeregattr("int");
|
||||||
|
assert(attr->number == REGATTR_INT);
|
||||||
|
attr = makeregattr("long");
|
||||||
|
assert(attr->number == REGATTR_LONG);
|
||||||
|
attr = makeregattr("float");
|
||||||
|
assert(attr->number == REGATTR_FLOAT);
|
||||||
|
attr = makeregattr("double");
|
||||||
|
assert(attr->number == REGATTR_DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
yyin = infp;
|
yyin = infp;
|
||||||
|
@ -612,6 +627,7 @@ static void emitregisterattrs(void)
|
||||||
assert(rc->number == i);
|
assert(rc->number == i);
|
||||||
|
|
||||||
print("%1\"%s\",\n", rc->name);
|
print("%1\"%s\",\n", rc->name);
|
||||||
|
if (rc->number > REGATTR_DOUBLE)
|
||||||
printh("#define %P%s_ATTR (1U<<%d)\n", rc->name, rc->number);
|
printh("#define %P%s_ATTR (1U<<%d)\n", rc->name, rc->number);
|
||||||
}
|
}
|
||||||
print("};\n\n");
|
print("};\n\n");
|
||||||
|
@ -655,7 +671,10 @@ static void emitregisters(void)
|
||||||
for (i=0; i<registers.count; i++)
|
for (i=0; i<registers.count; i++)
|
||||||
{
|
{
|
||||||
struct reg* r = registers.item[i].right;
|
struct reg* r = registers.item[i].right;
|
||||||
|
uint32_t type = r->attrs & TYPE_ATTRS;
|
||||||
assert(r->number == i);
|
assert(r->number == i);
|
||||||
|
if (type & (type-1))
|
||||||
|
yyerror("register %s has more than one type attribute set", r->name);
|
||||||
|
|
||||||
print("%1{ \"%s\", 0x%x, %Pregister_names_%d_%s, %Pregister_aliases_%d_%s },\n",
|
print("%1{ \"%s\", 0x%x, %Pregister_names_%d_%s, %Pregister_aliases_%d_%s },\n",
|
||||||
r->name, r->attrs, i, r->name, i, r->name);
|
r->name, r->attrs, i, r->name, i, r->name);
|
||||||
|
|
|
@ -17,6 +17,11 @@ struct ir_data
|
||||||
|
|
||||||
extern const struct ir_data ir_data[];
|
extern const struct ir_data ir_data[];
|
||||||
|
|
||||||
|
#define burm_int_ATTR (1U<<0)
|
||||||
|
#define burm_long_ATTR (1U<<1)
|
||||||
|
#define burm_float_ATTR (1U<<2)
|
||||||
|
#define burm_double_ATTR (1U<<3)
|
||||||
|
|
||||||
#define TYPE_ATTRS \
|
#define TYPE_ATTRS \
|
||||||
(burm_int_ATTR | burm_long_ATTR | burm_float_ATTR | burm_double_ATTR)
|
(burm_int_ATTR | burm_long_ATTR | burm_float_ATTR | burm_double_ATTR)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue