diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-06-28 14:59:37 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-14 00:05:28 +0200 |
commit | 99bcbcaf803f894fafc90d22ab4fc5db73a3016e (patch) | |
tree | 999f138632271532e8be6ea38f823e55ca01b08d | |
parent | fa09d838d4b241c98f85657669e11f207d26d4fd (diff) | |
download | sparse-99bcbcaf803f894fafc90d22ab4fc5db73a3016e.tar.gz |
arch: add predefines __INT_FAST${N}_TYPE__
We just added __INT_LEAST${N}_TYPE__, so add these ones
too as they looks slightly more useful.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | predefine.c | 9 | ||||
-rw-r--r-- | target-arm.c | 7 | ||||
-rw-r--r-- | target-h8300.c | 5 | ||||
-rw-r--r-- | target-m68k.c | 9 | ||||
-rw-r--r-- | target-microblaze.c | 9 | ||||
-rw-r--r-- | target-nds32.c | 5 | ||||
-rw-r--r-- | target-nios2.c | 9 | ||||
-rw-r--r-- | target-openrisc.c | 5 | ||||
-rw-r--r-- | target-ppc.c | 9 | ||||
-rw-r--r-- | target-riscv.c | 12 | ||||
-rw-r--r-- | target-s390.c | 9 | ||||
-rw-r--r-- | target-sh.c | 6 | ||||
-rw-r--r-- | target-sparc.c | 5 | ||||
-rw-r--r-- | target-x86.c | 25 | ||||
-rw-r--r-- | target-xtensa.c | 5 | ||||
-rw-r--r-- | target.c | 10 | ||||
-rw-r--r-- | target.h | 8 |
17 files changed, 146 insertions, 1 deletions
diff --git a/predefine.c b/predefine.c index 062e754b..2e9913d5 100644 --- a/predefine.c +++ b/predefine.c @@ -154,6 +154,15 @@ void predefined_macros(void) predefined_ctype("INT_LEAST64", int64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINT_LEAST64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST8", fast8_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST8", ufast8_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST16", fast16_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST16",ufast16_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST32", fast32_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST32",ufast32_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST64", fast64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST64",ufast64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INTMAX", intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); diff --git a/target-arm.c b/target-arm.c index 5fc15c51..104c319b 100644 --- a/target-arm.c +++ b/target-arm.c @@ -5,9 +5,16 @@ static void init_arm(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + if (arch_os == OS_NONE) { int32_ctype = &long_ctype; uint32_ctype = &ulong_ctype; + fast8_ctype = &int_ctype; + ufast8_ctype = &uint_ctype; } } diff --git a/target-h8300.c b/target-h8300.c index 47872b38..84d168b7 100644 --- a/target-h8300.c +++ b/target-h8300.c @@ -8,6 +8,11 @@ static void init_h8300(const struct target *self) ssize_t_ctype = &long_ctype; size_t_ctype = &ulong_ctype; wchar_ctype = &ushort_ctype; + + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; } static void predefine_h8300(const struct target *self) diff --git a/target-m68k.c b/target-m68k.c index ed4a9273..0aed2eb3 100644 --- a/target-m68k.c +++ b/target-m68k.c @@ -3,6 +3,14 @@ #include "machine.h" +static void init_m68k(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_m68k(const struct target *self) { predefine("__m68k__", 1, "1"); @@ -19,5 +27,6 @@ const struct target target_m68k = { .bits_in_longdouble = 96, .max_fp_alignment = 4, + .init = init_m68k, .predefine = predefine_m68k, }; diff --git a/target-microblaze.c b/target-microblaze.c index 1fbeef3c..3a4c3d58 100644 --- a/target-microblaze.c +++ b/target-microblaze.c @@ -3,6 +3,14 @@ #include "machine.h" +static void init_microblaze(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_microblaze(const struct target *self) { predefine("__MICROBLAZE__", 1, "1"); @@ -21,5 +29,6 @@ const struct target target_microblaze = { .bits_in_longdouble = 64, + .init = init_microblaze, .predefine = predefine_microblaze, }; diff --git a/target-nds32.c b/target-nds32.c index 0dc483b2..e3ed2e52 100644 --- a/target-nds32.c +++ b/target-nds32.c @@ -5,6 +5,11 @@ static void init_nds32(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &uint_ctype; } diff --git a/target-nios2.c b/target-nios2.c index a478fff5..c57b1719 100644 --- a/target-nios2.c +++ b/target-nios2.c @@ -4,6 +4,14 @@ #include "builtin.h" +static void init_nios2(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_nios2(const struct target *self) { predefine("__NIOS2", 1, "1"); @@ -33,6 +41,7 @@ const struct target target_nios2 = { .bits_in_longdouble = 64, + .init = init_nios2, .predefine = predefine_nios2, .builtins = builtins_nios2, }; diff --git a/target-openrisc.c b/target-openrisc.c index 553963c0..ad25ff27 100644 --- a/target-openrisc.c +++ b/target-openrisc.c @@ -5,6 +5,11 @@ static void init_openrisc(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &uint_ctype; } diff --git a/target-ppc.c b/target-ppc.c index dede8917..6c0c0737 100644 --- a/target-ppc.c +++ b/target-ppc.c @@ -31,6 +31,14 @@ static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char } +static void init_ppc32(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_ppc32(const struct target *self) { predefine_ppc(self); @@ -46,6 +54,7 @@ const struct target target_ppc32 = { .target_64bit = &target_ppc64, + .init = init_ppc32, .predefine = predefine_ppc32, .asm_constraint = asm_constraint_ppc, }; diff --git a/target-riscv.c b/target-riscv.c index e7f2b03b..6d9113c1 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -87,6 +87,16 @@ static void init_riscv(const struct target *self) riscv_flags = self->flags; } +static void init_riscv32(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + + init_riscv(self); +} + static void predefine_riscv(const struct target *self) { static const char *cmodels[CMODEL_LAST] = { @@ -131,7 +141,7 @@ const struct target target_riscv32 = { .target_64bit = &target_riscv64, - .init = init_riscv, + .init = init_riscv32, .predefine = predefine_riscv, .parse_march = parse_march_riscv, }; diff --git a/target-s390.c b/target-s390.c index 9dbc810e..cdbd685a 100644 --- a/target-s390.c +++ b/target-s390.c @@ -4,6 +4,14 @@ #include "expression.h" +static void init_s390(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_s390(const struct target *self) { predefine("__s390__", 1, "1"); @@ -31,6 +39,7 @@ const struct target target_s390 = { .target_64bit = &target_s390x, + .init = init_s390, .predefine = predefine_s390, .asm_constraint = asm_constraint_s390, }; diff --git a/target-sh.c b/target-sh.c index db517ccb..d4ddf455 100644 --- a/target-sh.c +++ b/target-sh.c @@ -7,6 +7,12 @@ static void init_sh(const struct target *self) { int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; + + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &long_ctype; } diff --git a/target-sparc.c b/target-sparc.c index be4e968e..d830f6cb 100644 --- a/target-sparc.c +++ b/target-sparc.c @@ -19,6 +19,11 @@ static void predefine_sparc(const struct target *self) static void init_sparc32(const struct target *target) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + if (!sparc_version) sparc_version = 8; diff --git a/target-x86.c b/target-x86.c index 956af92e..e69594ed 100644 --- a/target-x86.c +++ b/target-x86.c @@ -33,6 +33,8 @@ static void init_x86_common(const struct target *target) ssize_t_ctype = &long_ctype; wchar_ctype = &int_ctype; wint_ctype = &int_ctype; + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; break; } } @@ -40,6 +42,11 @@ static void init_x86_common(const struct target *target) static void init_i386(const struct target *target) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + init_x86_common(target); } @@ -71,13 +78,31 @@ static void init_x86_64(const struct target *target) int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; wint_ctype = &int_ctype; + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + fast64_ctype = &llong_ctype; + ufast64_ctype = &ullong_ctype; break; case OS_FREEBSD: + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; break; case OS_NETBSD: + fast8_ctype = &int_ctype; + ufast8_ctype = &uint_ctype; + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; wint_ctype = &int_ctype; break; case OS_OPENBSD: + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; diff --git a/target-xtensa.c b/target-xtensa.c index 3e5781c8..26bda47f 100644 --- a/target-xtensa.c +++ b/target-xtensa.c @@ -5,6 +5,11 @@ static void init_xtensa(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &long_ctype; } @@ -23,6 +23,14 @@ struct symbol *least32_ctype = &int_ctype; struct symbol *uleast32_ctype = &uint_ctype; struct symbol *least64_ctype = &llong_ctype; struct symbol *uleast64_ctype = &ullong_ctype; +struct symbol *fast8_ctype = &schar_ctype; +struct symbol *ufast8_ctype = &uchar_ctype; +struct symbol *fast16_ctype = &long_ctype; +struct symbol *ufast16_ctype = &ulong_ctype; +struct symbol *fast32_ctype = &long_ctype; +struct symbol *ufast32_ctype = &ulong_ctype; +struct symbol *fast64_ctype = &long_ctype; +struct symbol *ufast64_ctype = &ulong_ctype; /* * For "__attribute__((aligned))" @@ -214,6 +222,8 @@ void target_init(void) uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; uintmax_ctype = &ullong_ctype; + fast64_ctype = &llong_ctype; + ufast64_ctype = &ullong_ctype; if (target->target_32bit) target = target->target_32bit; break; @@ -21,6 +21,14 @@ extern struct symbol *least32_ctype; extern struct symbol *uleast32_ctype; extern struct symbol *least64_ctype; extern struct symbol *uleast64_ctype; +extern struct symbol *fast8_ctype; +extern struct symbol *ufast8_ctype; +extern struct symbol *fast16_ctype; +extern struct symbol *ufast16_ctype; +extern struct symbol *fast32_ctype; +extern struct symbol *ufast32_ctype; +extern struct symbol *fast64_ctype; +extern struct symbol *ufast64_ctype; /* * For "__attribute__((aligned))" |