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@xxxxxxxxx> --- builtin.c | 4 ++++ target.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/builtin.c b/builtin.c index bb9ec65b2d20..dcf8200ec002 100644 --- a/builtin.c +++ b/builtin.c @@ -391,6 +391,9 @@ static void declare_one_builtin(const struct builtin_fn *entry) static void declare_builtins(const struct builtin_fn tbl[]) { + if (!tbl) + return; + while (tbl->name) declare_one_builtin(tbl++); } @@ -587,5 +590,6 @@ void init_builtins(int stream) { declare_builtins(builtins_common); + declare_builtins(arch_target->builtins); init_linearized_builtins(stream); } diff --git a/target.h b/target.h index a89e21b63563..1202c0be1ac9 100644 --- a/target.h +++ b/target.h @@ -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); }; -- 2.27.0