Clean up pass of mode handling.
Make use of mode name vs <mode> object more consistent and clear.
* hardware.scm (/keyword-read): Default mode to the mode name,
not the <mode> object.
(/hw-parse-indices): Parse mode name and pass mode object to
<hw-asm> constructor.
(/hw-parse-values): Ditto.
(<hw-register> parse!): Pass mode name to /hw-parse-indices
and /hw-parse-values.
(<hw-memory> parse!): Ditto.
(<hw-address> parse!): Ditto.
* mode.scm (/mode-table): New global, replaces mode-list.
Modes stored in hashtable instead of list.
(/mode-class-table): New global.
(mode-list-non-alias-values): Update.
(mode:eq?, mode-compatible?, mode:add!): Update.
(mode:lookup): Restrict arg to the mode's name. All callers updated.
(mode-maybe-lookup): New function.
(mode-real-name): Restrict arg to a <mode> object. All callers updated.
(mode-real-mode, mode-sem-mode, mode-bigger?): Ditto.
(mode-find, mode-set-word-modes!): Update
(mode-ensure-word-sizes-defined): Update.
(/sort-mode-classes!): New function.
(mode-builtin!): Update. Sort mode classes here.
(mode-finish!): Sort mode classes here too.
* rtl-c.scm (/rtl-c-get): Restrict mode arg to a <mode> object.
All callers updated.
(rtl-c-set-quiet): Allow mode to be name of object.
(rtl-c-set-trace): Ditto.
* rtl-traverse.scm (rtl-eval-with-estate): Restrict mode arg to
<mode> object. All callers updated.
* rtl.scm (rtx-sem-mode): Restrict arg to <mode> object.
(rtx-lazy-sem-mode): Ditto.
(<rtx-temp> make!): Assert mode arg is a <mode> object.
(rtx-env-make): Allow var-list modes to be name or object.
* sem-frags.scm (/frag-expr-assq-locals): New function.
(/frag-compute-locals!): Call it.
(/sfrag-create-cse-mapping): Renamed from sfrag-create-cse-mapping.
All callers updated.
* semantics.scm (/build-mem-operand!): Handle mode aliases.
Add support for controlling warnings/errors.
Add tests for iformat description errors.
* dev.scm (cload): New option #:diag.
* read.scm (<reader>): New member verify-iformat?.
(/parse-diagnostic, parse-warning): New functions.
(parse-error): Guts moved to /parse-diagnostic.
(/set-diagnostic-options!): New function.
(cpu-load): New arg diagnostic-options, all callers updated.
Recognize -w diagnostic-option-list.
* ifield.scm (ifields-base-ifields): Move here from iformat.scm.
(ifld-simple-ifields, ifields-simple-ifields): New function.
* insn.scm (/parse-insn-format-iflds): New function.
(/parse-insn-format): Guts moved to /parse-insn-format-iflds.
New arg isa, all callers updated. Do some basic validation of the
ifield list if requested.
* mach.scm (/sanity-check-insns): Improve error message text.
* doc/running.text: Document -w option.
* ifield.scm (ifld-beyond-base?): Remove args base-bitsize,
total-bitsize. All callers updated.
* insn.scm (<insn>): Rename member ifld-values to /insn-value.
New member /insn-base-value.
(insn-base-value): New function.
* mach.scm (/sanity-check-insns): New function.
(arch-analyze-insns!): Call it.
* rtl-c.scm (/rtl-c-get): Convert symbols to strings before passing
to string-append.
(*): Remove trailing ":" from error messages passed to estate-error.
* read.scm (rtl-version-equal?): New function.
(rtl-version-at-least?, rtl-version-older?): New functions.
* *.scm: Use / to prefix "local" vars/fns, for r6rs compliance.
* pmacros.scm (/pmacro-builtin-splice): Refer to $unsplice for
rtl versions >= 0.9.
(pmacros-init!): Tweak to prepare for $<pmacro> for builtin pmacros.
DJ Delorie [Wed, 2 Sep 2009 02:10:36 +0000 (02:10 +0000)]
[cgen]
* cpu/mep.opc (parse_signed16_range): Mark as potentially unused.
(parse_unsigned16_range): Likewise.
(mep_cgen_insn_supported_asm): Make BSR12 check dependent on VLIW
isa.
Doug Evans [Thu, 20 Aug 2009 17:03:29 +0000 (17:03 +0000)]
* gas-test.scm (<keyword> test-data): Catch invalid requests,
flag a warning and compensate.
(<hw-address test-data): Tweak for readability.
(<hw-iaddress test-data): Ditto.
(cgen-build.sh): Convert symbols to strings before passing to
string-append.
(cgen-allinsn.exp): Ditto.
Doug Evans [Tue, 18 Aug 2009 16:34:41 +0000 (16:34 +0000)]
* gas-test.scm (<hw-asm>, test-data): Handle () values.
(<keyword>, test-data): Convert symbols to strings before passing
to string-append.
(<hw-index>, test-data): Enumerate all cases. Emit correctly sized
result for scalars.
* operand.scm (hw-index-scalar): Set `name'.
(hw-index-anyof, hw-index-derived): Ditto.
Doug Evans [Fri, 7 Aug 2009 21:29:20 +0000 (21:29 +0000)]
Add -t option for tracing things like commands, pmacro expansion.
* dev.scm (cload): New arg #:trace.
* pmacros.scm (-pmacro-expand): Rewrite pmacro tracing.
(pmacro-trace): New arg `loc'. Rewrite pmacro tracing.
(pmacro-debug): Call pmacro-trace instead of -pmacro-expand.
* read.scm (<reader>): New members trace-commands?, trace-pmacros?.
(-reader-process-expanded-1!): Trace commands if requested.
(-reader-process!): Call pmacro-trace of pmacro tracing requested.
(-set-trace-options!): New function.
(-init-reader!): New function.
(cpu-load): New arg trace-options, all callers updated.
Call -init-reader! and -set-trace-options!.
(cgen-usage): Improve output formatting.
(common-arguments): New option -t.
(-cgen): Process -t.
* utils-cgen.scm (single-location->string): Renamed from
pretty-print-single-location. All callers updated.
(location->string): Renamed from pretty-print-location.
All callers updated.
(source-properties-location->string): New function.
* doc/running.texi: Document -t.
Doug Evans [Thu, 6 Aug 2009 16:40:44 +0000 (16:40 +0000)]
Track source location better, for better error messages.
* pmacros.scm (-pmacro-eval): Delete, unused.
(pmacro-expand, -pmacro-expand): New arg `loc', all callers updated.
(-pmacro-expand-expr-list, -smacro-apply): Ditto.
(scan-list, scan): Ditto.
(-pmacro-builtin-pmacro, -pmacro-builtin-let, -pmacro-builtin-if,
-pmacro-builtin-case, -pmacro-builtin-cond, -pmacro-builtin-begin,
-pmacro-builtin-andif, -pmacro-builtin-orif): Ditto.
(scan-list1): New function.
(-pmacro-build-lambda): New arg `loc', all callers updated. Rewrite.
* read.scm (<reader>): New member `location'.
(-reader-lookup-command): Renamed from reader-lookup-command,
all callers updated.
(reader-error): Rewrite to produce better source location info.
(current-reader-location): New function.
(-reader-process-expanded-1!): Renamed from -reader-process-expanded-1.
All callers updated. Record source location of expression.
(reader-process-expanded!): Renamed from reader-process-expanded.
All callers updated.
(-reader-process!): Renamed from reader-process. New arg `loc'.
All callers updated. Record source location of define-pmacro.
* utils-cgen.scm (<location>): New class.
(single-location): New (pseudo) class.
(pretty-print-single-location, pretty-print-location): New functions.
(location-top, location-push-single, location-push): New functions.
(unspecified-location, current-input-location): New functions.
(location-property): New object property.
(location-property-set!): New function.
(<source-ident>): Renamed from <ordered-ident>. New member `location'.
All uses updated.
* testsuite/location-1.test: New testcase.
* testsuite/run-tests.sh: Fix fail count handling.
* testsuite/test-utils.sh.in (run_cgen): New option `-f'. Allow tests
to expect cgen to fail.
* pmacros.scm (*): Use "pmacro" instead of "macro" more consistently.
* read.scm (-cmd-include): Renamed from include. All callers updated.
(-cmd-if): Renamed from cmd-if. All callers updated.
Use reader-process-expanded! on then/else clauses instead of eval1.
Use hash tables to record ifields, operands, insns, macro-insns.
* attr.scm (attr-builtin!): Tweak some comments.
* hardware.scm (hardware-builtin!): Call all-isas-attr-value.
* ifield.scm (<ifield>): Subclass from <ordered-ident> instead of
<ident>.
(<multi-ifield>): New constructor.
(ifield-builtin!): Add isa attr to f-nil, f-anyof.
* insn.scm (<insn>): Subclass from <ordered-ident> instead of
<ident>.
(-sub-insn-make!): Add hack to avoid differences in generated code.
(multi-insn-instantiate!): Add total number of multi-insns to
logging message.
* mach.scm (<arch>): Rename members ifld-list, op-list, insn-list,
minsn-list to foo-table. New member next-ordinal.
Update getters/setters.
(arch-ifld-list, arch-op-list, arch-insn-list, arch-minsn-list):
New functions.
(-get-next-ordinal!, -get-lowest-ordinal): New function.
(-make-ident-object-table, -ident-object-table->list,
-ident-object-table-add!, -ident-object-table-lookup): New functions.
(current-ifld-list, current-ifld-add! current-ifld-lookup,
-ifld-already-defined?): Rewrite.
(current-op-list, current-op-add! current-op-lookup,
-op-already-defined?): Rewrite.
(current-raw-insn-list, insn-list-car, insn-list-splice!): Delete.
(current-insn-list, current-insn-add! current-insn-lookup,
-insn-already-defined?): Rewrite.
(current-minsn-list, current-minsn-add! current-minsn-lookup,
-minsn-already-defined?): Rewrite.
(all-isas-attr-value, all-isas-attr, attr-isa-list): New functions.
(MAX-VIRTUAL-INSNS): Define.
(arch-analyze-insns!): Add hack to avoid differences in generated code.
Update use of arch-insn-list.
(mach-init!): Initialize ifld-table, op-table, insn-table, minsn-table.
(arch-finish!): Delete references to ifld-table, op-table, insn-table,
minsn-table.
* minsn.scm (<macro-insn>): Subclass from <ordered-ident> instead of
<ident>. New constructor.
* operand.scm (<operand>): Subclass from <ordered-ident> instead of
<ident>.
* sid.scm (-virtual-insn-add!): New function.
(-create-virtual-insns!): Call it.
(-fill-sim-insn-list!): Rewrite.
* sim.scm (-virtual-insn-add!, -create-virtual-insns!): New functions.
(sim-finish!): Move contents to -create-virtual-insns!, and call it.
* utils-cgen.scm (<ordered-ident>): New class.
(obj-ordinal, obj-set-ordinal!): New functions.
(add-ident-methods!): Delete.
* model.scm (parse-insn-timing): Change logging message to level 3.