3 * ld-insn.c (parse_function_record): When -Wnodiscard, suppress
4 discarded function warning.
6 * igen.c (main): Clarify -Wnodiscard.
8 * ld-insn.c (parse_function_record): For functions, allow use of
9 instruction style function model records
11 * ld-insn.h (nr_function_model_fields): Define.
15 * igen.c (print_itrace_prefix): Generate call to trace_prefix
16 instead of trace_one_insn.
17 (print_itrace): Generate trace_prefix call if any tracing enabled,
18 (print_itrace): Nest generated call to trace_generic inside
19 conditional for any tracing enabled.
20 (print_itrace_prefix): Do not pass PHASE to trace_prefix.
24 * gen-engine.c (print_run_body): Add bitsize suffix to IMEM macro.
25 * gen-icache.c (print_icache_body): Ditto.
26 * gen-idecode.c (print_idecode_ifetch): Ditto.
28 * gen-icache.c (print_icache_body): Mark successive instruction
31 * ld-insn.c (parse_insn_word): Only report insn-width problems
34 * igen.h: Add flag for warning about invalid instruction widths.
35 * igen.c: Parse -Wwidth option.
37 * gen-support.c (gen_support_h): Map instruction_word onto
38 <PREFIX>_instruction_word when needed.
39 (print_support_function_name): Use support prefix.
40 (gen_support_h): Ditto for <PREFIX>_idecode_issue.
44 * gen-support.c (gen_support_h): Generate new macro CPU_.
48 * gen-engine.c (gen_engine_h): Don't assume a model is present.
49 (gen_engine_c): Ditto.
51 * igen.c (gen_run_c): Ditto.
53 * gen-engine.c (print_run_body): Use CIA_GET & CIA_SET instead of
54 CPU_CIA. Parameterize with CPU argument.
58 * gen.h (struct _gen_list): Replace processor with model.
60 * igen.c (gen_idecode_h): Update.
61 (gen_run_c): For generated switch, use model->full_name.
63 * gen.c (print_gen_entry_path): Ditto.
65 (gen_entry_expand_insns): Ditto.
66 (make_gen_tables): Ditto.
68 * igen.c (gen_run_c): Add extra argument `nr_cpus' to generated
69 function sim_engine_run. Pass argument on to engine_run.
71 * gen-engine.c (print_engine_run_function_header): Add extra
72 argument `nr_cpus' to generated function engine_run.
73 (print_run_body): Fix SMP case.
75 * gen-support.c (support_c_function): Call sim_engine_abort when
76 internal function fails to long jump.
80 * gen-semantics.c (print_semantic_body): Use GPR_SET to zero
85 * gen-semantics.c (print_semantic_body): Fix handling of
86 hardwired zero register.
90 * igen.h (struct _igen_gen_options): Add member default_model.
92 * igen.c (gen_run_c): Default to the first machine in the
94 (main): Add MODEL parameter to gen-multi-sim option.
96 * gen.h (function_decl_type): Declare enum.
98 * gen-engine.c (print_engine_run_function_header), gen-engine.h:
99 Make global, pass function_decl_type as argument.
100 (gen_engine_h, gen_engine_c): Update call.
102 * gen-idecode.c (print_idecode_issue_function_header),
103 gen-idecode.h: Pass function_decl_type as argument.
105 * igen.c (gen_idecode_h): For multi-sim, delcare global variable
108 * igen.c (gen_run_c): For multi-sim, initialize globals
109 idecode_issue and engine_run.
113 * ld-insn.c (parse_insn_model_record): Allow multiple model names
114 to be specified in a single instruction model record.
115 (dump_insn_model_entry): Update.
117 * ld-insn.h (struct _insn_model_entry): Replace member name with
118 the filter names. Document syntax change.
122 * gen-engine.c (print_run_body): Add hooks for adding code before
123 and after an instruction has been issued.
127 * gen-idecode.c (print_jump_until_stop_body): Use `#if 0' instead of
128 `#ifdef 0' around this.
132 * ld-decode.c (load_decode_table): Don't assume NULL is an integer
137 * ld-insn.h: Document mnemonic string format.
141 * gen-icache.c (print_icache_extraction): Force result of atol to
144 * ld-insn.c (parse_function_record): Separate handling of old and
145 ney fynction records.
146 (load_insn_table): For %s record, hack function name & type after
149 * filter.h (filter_is_subset): Reverse argument names, wrong
152 * ld-insn.c (load_insn_table): Move include code to.
153 (parse_include_record): New function. Check for filtering of
154 include statement by both flags and models.
155 (load_insn_table): Check for model filtering of cache and model
157 (parse_model_data_record): Check for model & flag filtering of
159 (parse_function_record): Check for model & flag filtering of
162 * ld-insn.h: Define record_filter_models_field. Add filter-models
163 field to all but instruction records.
164 (struct _function_entry, struct _cache_entry): Add models field.
165 (nr_function_fields): Make parm field mandatory.
169 * igen.c (main): Change -I option to -I<directory>. Add optional
170 size to -Ggen-icache option. Add -Gno-... support.
172 * igen.h (struct _igen_options): Add include field.
174 * ld-insn.c (enum insn_record_type, insn_type_map): Add
176 (load_insn_table): Call table_push when include record.
178 * table.c (struct _open table, struct table): Make table object an
179 indirect ptr to the current table file.
180 (current_line, new_table_entry, next_line): Make file arg type
182 (table_open): Use table_push.
183 (table_read): Point variable file at current table, at eof, pop
186 * table.h, table.c (table_push): New function.
190 * gen-semantics.c (print_semantic_body): Use CIA not
191 cia.ip. Escape newlines at end of generated call to
196 * igen.c (print_itrace): Output line-ref to igen source file when
197 generating trace statements.
198 (print_itrace_prefix, print_itrace_format): Escape newline at end
199 of each line of generated call to trace function.
203 * gen-support.c (gen_support_h): Generate #define NIA. Definition
204 dependant on gen-delayed-branch mode.
206 * ld-insn.c (parse_insn_mnemonic_record): Check for opening and
207 closing double quote in mnemonic field.
208 (parse_option_record): Add gen-delayed-branch option.
212 * gen.c (insn_list_insert): Missing \n in warning.
214 * ld-insn.c (load_insn_table): Only notify of discarded
215 instrctions when warn.discard enabled.
217 * igen.h: Add option.warn.discard, default enabled.
219 * igen.c (main): Add -Wnodiscard option.
221 * ld-insn.c (record_type): For old record type, check the number
222 of fields is correct.
223 (load_insn_table): Allow insn assembler and insn model records to
225 (parse_insn_model_record): Rename from parse_insn_model_records.
226 Parse only one record.
227 (parse_insn_mnemonic_record): Rename from
228 parse_insn_mnemonic_records. Parse only one record.
232 * gen-itable.c (gen_itable_h): [nr_itable_* + 1] to avoid
233 illegal zero-sized array.
234 (itable_print_set): likewise, avoid empty initializers.
238 * configure.in: i386-windows is a cross, so don't expect
239 libiberty to be there.
240 * configure: updated.
244 * igen.c (print_function_name): Put the format name after the
245 function / instruction name, not before.
246 (print_itrace): Better format trace code.
250 * gen.c (insns_bit_useless): Don't treat string fields restricted
251 to a range of values as useless.
255 * igen.c (gen_run_c): Handle non-multi-sim case.
257 * gen-support.c (gen_support_h): Define SD_ - to replace _SD.
262 * gen-semantics.c (print_semantic_body): Trace the instruction
263 after it has been validated.
264 (print_semantic_body): Count the instruction using sim-profile.
268 * gen-itable.c (gen_itable_h): Collect summary info on instruction
269 table when traversing it.
270 (gen_itable_h): Output an enum defining the max size of each of
271 the itable string members.
275 * igen.c (gen_run_c): New function. Generate sim_engine_run that
276 looks at the currently selected architecture.
278 * gen-engine.c, gen-idecode.c: Add multi-sim support - generate
279 one engine per model.
281 * gen-semantics.c, gen-icache.c gen-support.c:
284 * ld-insn.h, ld-insn-h (load_insn_table): Rewrite. table.h only
285 returns a line at a time. Parse multi-word instructions. Add
288 * table.h, table.c: Simplify. Only parse a single line at a time.
289 ld-insn can handle the rest.
291 * filter.h, filter.c (filter_parse, filter_add, filter_is_subset,
292 filter_is_common, filter_is_member, filter_next): New filter
294 (dump_filter): Ditto.
296 * gen.h, gen.c: New file. Takes the insn table and turns it into
297 a set of decode tables and semantic functions.
299 * ld-insn.c: Copy generator code from here.
304 * misc.h (NZALLOC): Allocate an N element array of TYPE.
306 * table.h, table.c: Simplify table parser so that it only
307 understands colon delimited lines and code blocks.
308 (table_read): Parse '{' ... '}' as a code block.
309 (table_print_code): New function, print out a code block to file.
310 (main): Add suport for standalone testing.
312 * ld-insn.h, ld-insn.c:
317 * gen-idecode.c (error_leaf_contains_multiple_insn): Make static.
318 (print_jump_definition, print_jump, print_jump_internal_function,
319 print_jump_insn, print_jump_until_stop_body): Delete, moved to
322 * igen.c (print_itrace_format): Delete unused variable chp.
323 (gen-engine.h): Include.
325 * table.c (current_file_name, current_line_entry,
326 current_line_entry): Make static.
330 * configure.in: Define AR_FOR_BUILD, AR_FLAGS_FOR_BUILD,
331 RANLIB_FOR_BUILD and CFLAGS_FOR_BUILD.
332 * configure.in: Include simulator common/aclocal.m4.
333 * configure.in: Add --enable-sim-warnings option.
334 * configure: Re-generate.
338 * Makefile.in (tmp-filter): New rule.
339 (igen.o, tmp-table, tmp-ld-decode, tmp-ld-cache, tmp-ld-insn,
340 ld-decode.o, ld-cache.o, ld-insn.o): Fix dependencies.
342 * gen.h, gen.c: New files.
344 * Makefile.in (gen.o, tmp-gen): New rules, update all
349 * ld-insn.c (load_insn_table): Accept %s as a function type.
353 * igen.c (print_itrace_prefix): Move printing of insn prefix to
355 (print_itrace_format): Drop printing of MY_NAME in instruction
356 trace. Printing of insn prefix moved.
357 (print_itrace): Ditto.
361 * gen-icache.c (print_icache_function_header): Pass
362 table_line_entry instead of separate file and line.
364 * table.c (table_entry_read): Set assembler source file/line-nr to
365 the current not initial file.
366 (table_entry_read): Fix line numbering of source files.
368 table.h (table_line_entry): New structure. Exactly specifies a
370 (table_*_entry): Add this to all.
372 table.c (table_entry_print_cpp_line_nr): Change to use values from
373 a table_line_entry struct.
374 (table_entry_read): Save table_line_entry in all structures read.
376 gen-icache.c, gen-support.c, gen-idecode.c, gen-semantics.c,
377 gen-model.c: Update all references.
381 * igen.c (print_my_defines): Define MY_NAME - a string. For
382 MY_PREFIX, undefine the name of the function incase some dumb
383 header defined it. it.
384 (print_itrace): Use MY_NAME not MY_PREFIX.
386 * lf.c (lf_write): New function write an N character buffer to the
389 * igen.c (print_itrace): When available, use the assembler to
390 print the insn-trace.
391 (print_itrace_prefix): New function, print first part of call to
393 (print_itrace_format): New function, print fmt argument for
396 * table.c (table_entry_read): Save any assembler lines instead of
401 * gen-icache.c (print_icache_body): Process immeds.
403 * gen-semantics.c (print_semantic_body): When computing NIA, skip
404 any immed words that follow the instruction word.
406 * ld-insn.c (parse_insn_format): Parse immeds appended to an
409 * igen.c (main): Allow any register to be specified as the zero
411 (semantic_zero_reg): Global, index to zero register.
413 * gen-semantics.c (print_semantic_body): Zero selected register.
417 * igen.h: Stop options and code gen type bit masks overlaping.
421 * gen-semantics.c (print_semantic_body): Incorrect test for
426 * gen-semantics.c (print_semantic_body): Use common sim-engine
431 * gen-semantics.c (print_semantic_body): Add code to clear r0.
433 * igen.c (main): Add new option zero-r0, which adds code to clear
438 * igen.c (print_itrace): Fix so line-nr is passed to trace
441 * gen-idecode.c (print_idecode_validate): Correct FP code.
443 * gen-support.c (gen_support_h): Always pass MY_INDEX to support
445 (print_support_function_name): Ditto.
449 * igen.c (print_itrace): Call trace_one_insn to trace
450 instructions, rather than doing it directly.
454 * gen-engine.c (engine_switch_leaf): Remove extra %s.
455 (print_engine_floating_point_unavailable): Wrap in #ifdef
456 UNUSED/#endif, until somebody uses it.
458 * gen-idecode.c (error_leaf_contains_multiple_insn): Remove unused
460 (print_jump_until_stop_body): Wrap in #ifdef UNUSED/#endif, until
462 (print_idecode_validate): Use long formats to print long values.
464 * gen-semantics.c (print_idecode_invalid): Set name to "unknown"
465 if we get an unexpected type.
469 * igen.c (print_itrace): Pass SD as well as CPU to calls to
472 * gen-support.c (gen_support_h): Always pass sim_cia cia to
474 (print_support_function_name): Ditto.
478 * gen-support.c (support_c_function): Remove unnecessary memset of
480 * gen-semantics.c (print_semantic_body): Wasn't closing
485 * ld-insn.c (load_insn_table): Report instructions that do not
486 have at least a format and name.
487 (insn_table_find_opcode_field): Check progress is being made.
489 * gen-support.c (support_c_function): Report empty function body.
493 * ld-insn.c (insn_table_expand_opcode): Allow reserved fields to
495 (insn_table_expand_insns): Allow special rules to apply to groups
496 of instructions when all members of the group match the special
499 * gen-semantics.c (print_c_semantic): Ditto.
500 * igen.c (print_semantic_function_formal): Ditto.
501 (print_semantic_function_type): Ditto.
502 * igen.c (print_icache_function_formal): Ditto.
503 * gen-idecode.c (print_idecode_issue_function_body): Ditto.
505 * gen-idecode.c (gen_idecode_h): Prepend the global_prefix to the
506 instruction_address type.
508 * gen-semantics.c (print_semantic_body): Call cpu_error when an
509 unimplemented instruction is encountered - gives the interpreter
510 the chance to stop correctly.
514 * igen.c (print_function_name): Allow dot's in instruction names.
518 * igen.c (main), igen.h: Support new option - delayed-branch -
519 generate code to drive a delayed branch processor.
521 * gen-idecode.c (gen_idecode_h): Define instruction_address type.
523 * igen.c (print_icache_function_formal): Replace address_word with
525 (print_semantic_function_formal): Ditto.
526 (print_semantic_function_type): Ditto.
527 * gen-idecode.c (print_idecode_issue_function_body): Ditto.
529 * gen-semantics.c (print_semantic_body): Ditto.
530 (print_c_semantic): Ditto.
532 * gen-support.c (support_c_function): Return a zeroed CIA instead
533 of just zero - works with any cia type.
535 * igen.c (print_itrace): For delayed branch case, print just the
540 * igen.c (print_itrace): Use TRACE_FOO_P and trace_printf.
544 * Makefile.in (INSTALL): Set to @INSTALL@.
545 (INSTALL_XFORM, INSTALL_XFORM1): Remove.
549 * Makefile.in (INSTALL): Change install.sh to install-sh.
553 * gen-support.c (gen_support_c): sim-state.h renamed to sim-main.h.
554 * gen-idecode.c (gen_idecode_c): Likewise.
555 * igen.c (gen_semantics_c): Likewise.
559 * gen-icache.c (print_icache_body): No longer define cpu/sd,
560 support.h now defines CPU/SD globally.
562 * gen-model.c (gen_model_h): Ditto.
564 * gen-idecode.c (print_idecode_issue_function_body): Ditto.
566 (print_jump_until_stop_body): Ditto.
567 (print_idecode_validate): Ditto.
569 * gen-icache.c (print_icache_body): Ditto.
571 * gen-semantics.c (print_semantic_body): Ditto.
573 * igen.c (print_semantic_function_formal): Rename cpu to sim_cpu,
575 (print_icache_function_formal): Ditto.
577 * gen-support.c (print_support_function_name): Include sd/cpu arg
578 in support function argument list.
579 (support_c_function): Generate code to cpu/sd from sd/cpu.
580 (gen_support_h): Define _SD the argument prefix for all support
581 functions. Define SD/CPU to determine sd/cpu from value of _SD
586 * gen-support.c (gen_support_c): Update for renaming of engine to
590 * gen-idecode.c (gen_idecode_c): Ditto.
594 * ld-decode.c (load_decode_table): Rename slash to reserved.
595 (dump_decode_rule): Ditto.
597 * ld-insn.c (parse_insn_format): Differentiate between a `/' -
598 reserved bit - and a `*' - wild card.
599 (parse_insn_format): Change is_slash to more informative reserved.
600 (dump_insn_field): Ditto.
601 (insn_field_is_constant): Ditto.
602 (insn_table_expand_opcode): Ditto.
604 * gen-idecode.c (print_idecode_validate): Make check_mask and
605 check_val the correct integer size.
606 (print_idecode_validate): Fix reserved bit check for 64 bit
611 * ld-insn.c (parse_insn_format): Accept '*' as an alternative of
612 `/' in bit fields. `/' denotes a wild bit.
616 * igen.h, igen.c (main): New options. Control generation of
617 conditional issue and slot verification code.
621 * gen-support.c (print_support_function_name): Prepend the global
622 name prefix when applicable. Provide #define to map the user
623 specified name the generated globaly unique one.
627 * gen-idecode.c (print_idecode_validate): Wrap each of the checks
628 - reserved bits, floating point and slot validation - with a
629 #ifdef so that they are optional.
633 * gen-idecode.c (error_leaf_contains_multiple_insn): New function
634 - report the error of a leaf node in the decision tree containing
635 several instructions.
636 (print_idecode_table_leaf): Detect a leaf with multiple instructions.
637 (print_idecode_switch_leaf): Ditto.
639 * gen-semantics.h, gen-semantics.c (print_idecode_illegal,
640 print_idecode_invalid): Rename former to latter. Add argument so
641 that one function can generate all invalid instruction cases -
642 illegal, fp-unavailable, wrong-slot.
643 * gen-engine.c: Update.
645 * gen-idecode.c: Use print_idecode_invalid to generate a function
646 call for cases when fp-unavailable and the slot is wrong.
648 * gen-idecode.c (print_idecode_validate): New check, generate code
649 to verify that the instruction slot is correct.
651 * igen.c (main): Simplify options.
655 * igen.c (print_itrace): Remove source line reference for trace
656 code - let the user see the generated file.
657 (print_itrace): Print the trace code rather than reference a
662 * igen.c (print_semantic_function_actual): Pass either the
663 processor - smp - or the engine - mono - into semantic functions.
666 * gen-icache.c (print_icache_body): Dependant on smp, derive
667 processor from engine or engine from processor, and hence ensuring
668 that both are defined in all semantic functions.
672 * ld-insn.c (parse_insn_format): Make the width field optional.
673 If missing assume that the number of characters in the value
674 determines the number of bits in the field.
678 * ld-insn.c (insn_table_expand_opcode): Replace assertion with
679 more useful error message.
683 * misc.c (error): Output errors on stderr.
685 * ld-insn.c (parse_insn_format): Skip any leading spaces.
686 Verify the width of instructions being parsed.
688 * table.c (table_entry_read): Parse CPP's convention for
689 specifying original file name/line-nr.
693 * ld-insn.c (parse_insn_format): Allow trailing spaces in
696 * Makefile.in: Create using ../ppc/Makefile.in as a starting
698 * configure.in: Ditto vis ../ppc/configure.in
702 * gen-support.c (gen_support_c): Always include engine.h instead
704 * gen-idecode.c (gen_idecode_c): Ditto.
706 * words.h (instruction_word): Remove instruction_word - now
708 (address_word): New. Used by igen.
710 * lf.c (lf_print_function_type_function): New, pass a function to
711 print out the type instead of a constant string.
713 * igen.h, igen.c (print_semantic_function_formal,
714 SEMANTIC_FUNCTION_FORMAL): Relace macro with function.
715 (print_semantic_function_actual, SEMANTIC_FUNCTION_ACTUAL): Ditto.
716 (print_semantic_function_type, SEMANTIC_FUNCTION_TYPE): Ditto.
717 (print_icache_function_type, ICACHE_FUNCTION_TYPE): Ditto.
718 (print_icache_function_formal, ICACHE_FUNCTION_FORMAL): Ditto.
719 (print_icache_function_actual, ICACHE_FUNCTION_ACTUAL): Ditto.
720 * gen-idecode.c (print_idecode_table): Update.
721 (idecode_switch_leaf): Update.
722 (print_idecode_switch_function_header): Ditto.
723 (print_idecode_floating_point_unavailable): Ditto.
724 (print_idecode_issue_function_header): Ditto.
725 * igen.c (gen_icache_h): Ditto.
726 * gen-engine.c (print_engine_table): Ditto.
727 (engine_switch_leaf): Ditto.
728 * gen-support.c (print_support_function_name): Ditto.
729 * gen-semantics.c (print_semantic_function_header): Update.
731 * gen-icache.c (print_icache_function_header): Update.
732 (print_icache_function): Update.
733 (print_icache_internal_function_declaration): Update.
734 (print_icache_internal_function_definition): Update.
736 * gen-idecode.c (gen_idecode_h): Drop including of idecode_*.h
737 files, will at some stage need to move it into support.
739 * igen.h, igen.c (main): New option -e <engine> - generate a full
740 simulation engine. Previously this was the -d <idecode-file>
742 * gen-engine.h, gen-engine.c: Copies of gen-idecode.*. Will need
743 to clean these up so that that call upon the updated gen-idecode
746 * gen-idecode.h, gen-idecode.c: Prune out any code not relevant to
747 generating a decode table.
749 * Makefile.in (igen): Add dependencies for new gen-engine.* files.
751 * igen.h, igen.c (main): New option -M - Control what is returned
752 by semantic functions - -1/NIA vs CIA+N/NIA. Add
753 generate_semantic_returning_modified_nia_only to igen_code enum.
754 * gen-semantics.c (print_semantic_body): As an alternative, make
755 NIA == -1 instead of CIA+insn_size by default.
757 * igen.h, igen.c (main, global_name_prefix, global_uname_prefix):
758 New option -P <prefix> - Prepend all generated functions with the
760 (gen_idecode_c): Adjust.
761 * gen-icache.c (print_icache_struct): Ditto.
762 * gen-support.c (gen_support_c): Ditto.
766 * igen.c (main): Correct usage. Missleading message about ucase
767 options dumping internal tables. -F now includes rather then
768 excludes instructions.
770 * misc.h, misc.c (a2i): Make 64bit.
772 * ld-insn.h (max_insn_bit_size, default_insn_bit_size): Increase
773 max to 64bits, expect trouble. Make the default 32 bits.
774 * gen-idecode.c (print_idecode_table): Change EXTRACTED*
775 et.al. macro's to use the insn_bit_size instead of assuming 32
777 * gen-icache.c (print_icache_extraction): Ditto.
778 * gen-idecode.c (idecode_switch_start): Ditto.
779 * gen-idecode.c (gen_idecode_c): Ditto
781 * igen.h (insn_specifying_widths), igen.c (main): New option -W.
782 Indicates that the instruction field of the table is specifying
783 bit widths instead of bit offsets.
784 * ld-insn.c (parse_insn_format): Parse instruction fields
787 * misc.c (a2i): Allow binary numbers to be specified using the
789 * ld-insn.c: Allow such numbers to appear in the instruction
792 * table.c (table_entry_read): Make // a valid comment character.
793 (table_entry_read): Skip lines containing a leading " - these may
794 eventually be used in a disasembler.
798 * filter.c, filter.h, gen-engine.c, gen-engine.h, gen-icache.c,
799 gen-icache.h, gen-idecode.c, gen-idecode.h, gen-itable.c,
800 gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c,
801 gen-semantics.h, gen-support.c, gen-support.h, igen.c, igen.h,
802 ld-cache.c, ld-cache.h, ld-decode.c, ld-decode.h, ld-insn.c,
803 ld-insn.h, lf.c, lf.h, misc.c, misc.h, table.c, table.h: Copy in
804 from the ../ppc directory.
806 * filter_host.c, filter_host.h: Copy in from the ../ppc directory
807 renaming from filter_filename.[hc]