From 9850d2d83eb919dc9e333e8ad9d7f308d2d1967b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 6 Dec 2021 02:18:31 -0500 Subject: [PATCH] sim: igen: migrate to standard uintXX_t types Move off the custom local 64-bit types and to the standard uintXX_t types that C11 provides. --- sim/igen/gen-idecode.c | 4 ++-- sim/igen/igen.c | 2 +- sim/igen/ld-decode.c | 2 +- sim/igen/ld-insn.c | 2 +- sim/igen/ld-insn.h | 2 +- sim/igen/misc.h | 24 +++--------------------- 6 files changed, 9 insertions(+), 27 deletions(-) diff --git a/sim/igen/gen-idecode.c b/sim/igen/gen-idecode.c index 5e87e15b344..d16cab54b29 100644 --- a/sim/igen/gen-idecode.c +++ b/sim/igen/gen-idecode.c @@ -984,8 +984,8 @@ print_idecode_globals (lf *file) lf_printf (file, "\n"); lf_printf (file, "typedef struct _idecode_table_entry {\n"); lf_printf (file, " int shift;\n"); - lf_printf (file, " unsigned%d mask;\n", options.insn_bit_size); - lf_printf (file, " unsigned%d value;\n", options.insn_bit_size); + lf_printf (file, " uint%d_t mask;\n", options.insn_bit_size); + lf_printf (file, " uint%d_t value;\n", options.insn_bit_size); lf_printf (file, " void *function_or_table;\n"); lf_printf (file, "} idecode_table_entry;\n"); } diff --git a/sim/igen/igen.c b/sim/igen/igen.c index 2389ccd711d..ba856401fa9 100644 --- a/sim/igen/igen.c +++ b/sim/igen/igen.c @@ -759,7 +759,7 @@ static void gen_idecode_h (lf *file, gen_table *gen, insn_table *insns, cache_entry *cache_rules) { - lf_printf (file, "typedef unsigned%d %sinstruction_word;\n", + lf_printf (file, "typedef uint%d_t %sinstruction_word;\n", options.insn_bit_size, options.module.global.prefix.l); if (options.gen.delayed_branch) { diff --git a/sim/igen/ld-decode.c b/sim/igen/ld-decode.c index 3875bdb53c4..da0e9da93c3 100644 --- a/sim/igen/ld-decode.c +++ b/sim/igen/ld-decode.c @@ -70,7 +70,7 @@ static const name_map decode_search_map[] = { static void -set_bits (int bit[max_insn_bit_size], unsigned64 value) +set_bits (int bit[max_insn_bit_size], uint64_t value) { int bit_nr; for (bit_nr = 0; bit_nr < max_insn_bit_size; bit_nr++) diff --git a/sim/igen/ld-insn.c b/sim/igen/ld-insn.c index 6727d9f6cbd..20c1f77b33f 100644 --- a/sim/igen/ld-insn.c +++ b/sim/igen/ld-insn.c @@ -203,7 +203,7 @@ parse_insn_word (line_ref *line, char *string, int word_nr) { /* when the length/pos field is omited, an integer field is always binary */ - unsigned64 val = 0; + uint64_t val = 0; int i; for (i = 0; i < strlen_val; i++) { diff --git a/sim/igen/ld-insn.h b/sim/igen/ld-insn.h index dba2e63e6c2..4859bae3b09 100644 --- a/sim/igen/ld-insn.h +++ b/sim/igen/ld-insn.h @@ -21,7 +21,7 @@ -typedef unsigned64 insn_uint; +typedef uint64_t insn_uint; /* Common among most entries: diff --git a/sim/igen/misc.h b/sim/igen/misc.h index 48c21263c65..a1cae768179 100644 --- a/sim/igen/misc.h +++ b/sim/igen/misc.h @@ -30,29 +30,11 @@ enum }; -/* Define a 64bit data type */ - -#if defined __GNUC__ || defined _WIN32 -#ifdef __GNUC__ - -typedef long long signed64; -typedef unsigned long long unsigned64; - -#else /* _WIN32 */ - -typedef __int64 signed64; -typedef unsigned __int64 unsigned64; - -#endif /* _WIN32 */ -#else /* Not GNUC or WIN32 */ -/* Not supported */ -#endif - - -#include #include -#include +#include +#include #include +#include #if !defined (__attribute__) && (!defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) #define __attribute__(arg) -- 2.30.2