X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=sim%2Fppc%2Figen.c;h=f0ff06b31c413e653b3a792cdd7b1f6445f10b0c;hb=a49dd19e81deb6d6c4af0fcadd94be1574f0b7dc;hp=94dcf5130dcac4c53c1e8d2e219b06382d4466f8;hpb=8b0b198558d0fc981f129e2e3dcbe00a0f308449;p=thirdparty%2Fbinutils-gdb.git diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c index 94dcf5130dc..f0ff06b31c4 100644 --- a/sim/ppc/igen.c +++ b/sim/ppc/igen.c @@ -1,10 +1,10 @@ /* This file is part of the program psim. - Copyright (C) 1994-1997, Andrew Cagney + Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,24 +13,22 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + along with this program; if not, see . */ - - #include +#include #include "misc.h" #include "lf.h" #include "table.h" -#include "config.h" +#include "build-config.h" #include "filter.h" -#include "ld-decode.h" #include "ld-cache.h" +#include "ld-decode.h" #include "ld-insn.h" #include "igen.h" @@ -107,6 +105,8 @@ print_function_name(lf *file, switch (*pos) { case '/': case '-': + case '(': + case ')': break; case ' ': nr += lf_putchr(file, '_'); @@ -182,9 +182,9 @@ gen_semantics_h(insn_table *table, lf_printf(file, "\n"); if ((code & generate_calls)) { lf_printf(file, "extern int option_mpc860c0;\n"); - lf_printf(file, "#define PAGE_SIZE 0x1000\n"); + lf_printf(file, "#define MPC860C0_PAGE_SIZE 0x1000\n"); lf_printf(file, "\n"); - lf_printf(file, "EXTERN_SEMANTICS(void)\n"); + lf_printf(file, "PSIM_EXTERN_SEMANTICS(void)\n"); lf_printf(file, "semantic_init(device* root);\n"); lf_printf(file, "\n"); if (generate_expanded_instructions) @@ -218,11 +218,16 @@ gen_semantics_c(insn_table *table, lf_printf(file, "#include \"cpu.h\"\n"); lf_printf(file, "#include \"idecode.h\"\n"); lf_printf(file, "#include \"semantics.h\"\n"); + lf_printf(file, "#include \"tree.h\"\n"); + lf_printf(file, "#ifdef HAVE_COMMON_FPU\n"); + lf_printf(file, "#include \"sim-inline.h\"\n"); + lf_printf(file, "#include \"sim-fpu.h\"\n"); + lf_printf(file, "#endif\n"); lf_printf(file, "#include \"support.h\"\n"); lf_printf(file, "\n"); lf_printf(file, "int option_mpc860c0 = 0;\n"); lf_printf(file, "\n"); - lf_printf(file, "EXTERN_SEMANTICS(void)\n"); + lf_printf(file, "PSIM_EXTERN_SEMANTICS(void)\n"); lf_printf(file, "semantic_init(device* root)\n"); lf_printf(file, "{\n"); lf_printf(file, " option_mpc860c0 = 0;\n"); @@ -302,6 +307,10 @@ gen_icache_c(insn_table *table, lf_printf(file, "#include \"idecode.h\"\n"); lf_printf(file, "#include \"semantics.h\"\n"); lf_printf(file, "#include \"icache.h\"\n"); + lf_printf(file, "#ifdef HAVE_COMMON_FPU\n"); + lf_printf(file, "#include \"sim-inline.h\"\n"); + lf_printf(file, "#include \"sim-fpu.h\"\n"); + lf_printf(file, "#endif\n"); lf_printf(file, "#include \"support.h\"\n"); lf_printf(file, "\n"); insn_table_traverse_function(table, @@ -341,6 +350,7 @@ main(int argc, decode_table *decode_rules = NULL; filter *filters = NULL; insn_table *instructions = NULL; + table_include *includes = NULL; char *real_file_name = NULL; int is_header = 0; int ch; @@ -399,9 +409,49 @@ main(int argc, case 'E': generate_expanded_instructions = 1; break; + case 'G': + { + int enable_p; + char *argp; + if (strncmp (optarg, "no-", strlen ("no-")) == 0) + { + argp = optarg + strlen ("no-"); + enable_p = 0; + } + else if (strncmp (optarg, "!", strlen ("!")) == 0) + { + argp = optarg + strlen ("no-"); + enable_p = 0; + } + else + { + argp = optarg; + enable_p = 1; + } + if (strncmp (argp, "gen-icache", strlen ("gen-icache")) == 0) + { + switch (argp[strlen ("gen-icache")]) + { + case '=': + icache_size = atoi (argp + strlen ("gen-icache") + 1); + code |= generate_with_icache; + break; + case '\0': + code |= generate_with_icache; + break; + default: + error (NULL, "Expecting -Ggen-icache or -Ggen-icache=\n"); + } + } + } case 'I': - icache_size = a2i(optarg); - code |= generate_with_icache; + { + table_include **dir = &includes; + while ((*dir) != NULL) + dir = &(*dir)->next; + (*dir) = ZALLOC (table_include); + (*dir)->dir = strdup (optarg); + } break; case 'N': generate_smp = a2i(optarg); @@ -429,11 +479,12 @@ main(int argc, force_decode_gen_type(optarg); break; case 'i': - if (decode_rules == NULL || cache_rules == NULL) { - fprintf(stderr, "Must specify decode and cache tables\n"); + if (decode_rules == NULL) { + fprintf(stderr, "Must specify decode tables\n"); exit (1); } - instructions = load_insn_table(optarg, decode_rules, filters); + instructions = load_insn_table(optarg, decode_rules, filters, includes, + &cache_rules); fprintf(stderr, "\texpanding ...\n"); insn_table_expand_insns(instructions); break;