diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-06-10 18:09:33 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-06-12 21:41:32 +0200 |
commit | f72b16c3864a0072748b955dfa5e9126d998f08b (patch) | |
tree | 73ee55ecb59349d626ccd9d89e7227bb0c1deae5 | |
parent | f8dc0b0fc2a06238700a4939fad1f76e748fdf12 (diff) | |
download | sparse-f72b16c3864a0072748b955dfa5e9126d998f08b.tar.gz |
builtin: add support for arch-specific builtins
Now that a table is used for the declaration of builtin functions
it's easy to support arch-specific builtins.
The main objective is to not 'pollute' the main table with
arch-specfic entries for uncommon architectures.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | builtin.c | 4 | ||||
-rw-r--r-- | target.h | 4 |
2 files changed, 8 insertions, 0 deletions
@@ -391,6 +391,9 @@ static void declare_builtin(int stream, const struct builtin_fn *entry) static void declare_builtins(int stream, const struct builtin_fn tbl[]) { + if (!tbl) + return; + while (tbl->name) declare_builtin(stream, tbl++); } @@ -586,5 +589,6 @@ static const struct builtin_fn builtins_common[] = { void init_builtins(int stream) { declare_builtins(stream, builtins_common); + declare_builtins(stream, arch_target->builtins); init_linearized_builtins(stream); } @@ -54,6 +54,8 @@ extern int bits_in_enum; extern int enum_alignment; +struct builtin_fn; + struct target { enum machine mach; enum bitness bitness; @@ -71,6 +73,8 @@ struct target { const struct target *target_32bit; const struct target *target_64bit; + const struct builtin_fn *builtins; + void (*init)(const struct target *self); void (*predefine)(const struct target *self); }; |