summaryrefslogtreecommitdiffhomepage
path: root/ir/ir
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-12-30 17:24:31 +0100
committerMatthias Braun <matze@braunis.de>2016-12-30 23:18:50 +0100
commitc60f2966f1830378aa2bcc515e4a211322382b35 (patch)
treef0a111a4366487f36a2a8732a6bb816d9dc496d5 /ir/ir
parenta14e8740eb2a5313877deb79f1546b4a77bde446 (diff)
irmode: Remove arithmetic argument from new_{int|reference}_mode()
Your only choice is irma_twos_complement anyway now.
Diffstat (limited to 'ir/ir')
-rw-r--r--ir/ir/irio.c6
-rw-r--r--ir/ir/irmode.c37
2 files changed, 22 insertions, 21 deletions
diff --git a/ir/ir/irio.c b/ir/ir/irio.c
index 4d39805..5974a54 100644
--- a/ir/ir/irio.c
+++ b/ir/ir/irio.c
@@ -2101,18 +2101,20 @@ static void read_modes(read_env_t *env)
case kw_int_mode: {
const char *name = read_string(env);
ir_mode_arithmetic arith = read_mode_arithmetic(env);
+ assert(arith == irma_twos_complement);
int size = read_long(env);
int sign = read_long(env);
unsigned modulo_shift = read_long(env);
- new_int_mode(name, arith, size, sign, modulo_shift);
+ new_int_mode(name, size, sign, modulo_shift);
break;
}
case kw_reference_mode: {
const char *name = read_string(env);
ir_mode_arithmetic arith = read_mode_arithmetic(env);
+ assert(arith == irma_twos_complement);
int size = read_long(env);
unsigned modulo_shift = read_long(env);
- ir_mode *mode = new_reference_mode(name, arith, size, modulo_shift);
+ ir_mode *mode = new_reference_mode(name, size, modulo_shift);
set_reference_offset_mode(mode, read_mode_ref(env));
int is_mode_P = read_int(env);
if (is_mode_P)
diff --git a/ir/ir/irmode.c b/ir/ir/irmode.c
index 95095b4..aa98148 100644
--- a/ir/ir/irmode.c
+++ b/ir/ir/irmode.c
@@ -139,33 +139,32 @@ static ir_mode *register_mode(ir_mode *mode)
return mode;
}
-ir_mode *new_int_mode(const char *name, ir_mode_arithmetic arithmetic,
- unsigned bit_size, int sign, unsigned modulo_shift)
+ir_mode *new_int_mode(const char *name, unsigned bit_size, int sign,
+ unsigned modulo_shift)
{
if (bit_size >= (unsigned)sc_get_precision())
panic("cannot create mode: more bits than tarval module maximum");
- ir_mode *result = alloc_mode(name, irms_int_number, arithmetic, bit_size,
- sign, modulo_shift);
+ ir_mode *result = alloc_mode(name, irms_int_number, irma_twos_complement,
+ bit_size, sign, modulo_shift);
return register_mode(result);
}
-ir_mode *new_reference_mode(const char *name, ir_mode_arithmetic arithmetic,
- unsigned bit_size, unsigned modulo_shift)
+ir_mode *new_reference_mode(const char *name, unsigned bit_size,
+ unsigned modulo_shift)
{
if (bit_size >= (unsigned)sc_get_precision())
panic("cannot create mode: more bits than tarval module maximum");
- ir_mode *result = alloc_mode(name, irms_reference, arithmetic, bit_size,
- 0, modulo_shift);
+ ir_mode *result = alloc_mode(name, irms_reference, irma_twos_complement,
+ bit_size, 0, modulo_shift);
ir_mode *res = register_mode(result);
/* Construct offset mode if none is set yet. */
if (res->offset_mode == NULL) {
char buf[64];
snprintf(buf, sizeof(buf), "%s_i", name);
- ir_mode *offset_mode = new_int_mode(buf, arithmetic, bit_size, 1,
- modulo_shift);
+ ir_mode *offset_mode = new_int_mode(buf, bit_size, 1, modulo_shift);
res->offset_mode = offset_mode;
}
return res;
@@ -449,16 +448,16 @@ void init_mode(void)
mode_F = new_float_mode("F", irma_ieee754, 8, 23, ir_overflow_min_max);
mode_D = new_float_mode("D", irma_ieee754, 11, 52, ir_overflow_min_max);
- mode_Bs = new_int_mode("Bs", irma_twos_complement, 8, 1, 32);
- mode_Bu = new_int_mode("Bu", irma_twos_complement, 8, 0, 32);
- mode_Hs = new_int_mode("Hs", irma_twos_complement, 16, 1, 32);
- mode_Hu = new_int_mode("Hu", irma_twos_complement, 16, 0, 32);
- mode_Is = new_int_mode("Is", irma_twos_complement, 32, 1, 32);
- mode_Iu = new_int_mode("Iu", irma_twos_complement, 32, 0, 32);
- mode_Ls = new_int_mode("Ls", irma_twos_complement, 64, 1, 64);
- mode_Lu = new_int_mode("Lu", irma_twos_complement, 64, 0, 64);
+ mode_Bs = new_int_mode("Bs", 8, 1, 32);
+ mode_Bu = new_int_mode("Bu", 8, 0, 32);
+ mode_Hs = new_int_mode("Hs", 16, 1, 32);
+ mode_Hu = new_int_mode("Hu", 16, 0, 32);
+ mode_Is = new_int_mode("Is", 32, 1, 32);
+ mode_Iu = new_int_mode("Iu", 32, 0, 32);
+ mode_Ls = new_int_mode("Ls", 64, 1, 64);
+ mode_Lu = new_int_mode("Lu", 64, 0, 64);
- mode_P = new_reference_mode("P", irma_twos_complement, 32, 32);
+ mode_P = new_reference_mode("P", 32, 32);
}
ir_mode *find_unsigned_mode(const ir_mode *mode)