Doug Evans [Sat, 24 Oct 2009 18:00:20 +0000 (18:00 +0000)]
* doc/rtl.texi: Add note that different ifields, operands, insns,
and minsns may occur with the same name in different isas.
Add note on the canonical form of rtl expressions.
Doug Evans [Sat, 24 Oct 2009 00:01:26 +0000 (00:01 +0000)]
* decode.scm: Tweak various comments.
(/opcode-slots): Add FIXME.
(/build-decode-table-guts): Add assert.
* utils-sim.scm (/gen-set-itype-and-extract): New function.
(/gen-bracketed-set-itype-and-extract): New function.
(/gen-decode-default-entry): Rewrite.
(/table-guts-to-mask, /all-opcode-bits-used?): New functions.
(/gen-decode-insn-entry): New arg table-guts-thus-far, all callers
updated. Don't unnecessarily emit check for whether all opcode bits
have been examined.
(/gen-decode-expr-set-itype): Delete.
(/gen-decode-expr-entry): Update.
(/gen-decode-table-entry): New arg table-guts-thus-far, all callers
updated. Keep track of decoder tables used thus far.
(/gen-decoder-switch): Ditto.
* utils.scm (word-bit-value): New function.
* rtl-c.scm (estate-make-for-rtl-c): Delete args context, owner,
rtl-cover-fns?, macro?. All callers updated.
(estate-make-for-normal-rtl-c): Delete, have all callers call
estate-make-for-rtl-c directly.
(rtl-c-parsed): Pass #:outer-expr to estate-make-for-rtl-c.
(rtl-c, rtl-c-expr-parsed, rtl-c-expr, rtl-c++-parsed, rtl-c++): Ditto.
* rtl-c.scm (/par-replace-set-dest-expr-fn): New function,
replaces /par-replace-set-dests.
(/par-replace-set-src-expr-fn): New function, replaces
/par-replace-set-srcs.
(s-parallel): Rewrite.
* rtl.scm (rtx-pretty-strdump): New function.
* rtl-traverse.scm (/rtx-canon-error): Use it.
(<eval-state>): New member outer-expr.
(estate-error): Include outer expression in error message if present.
* xc16x.cpu (h-cr): New hardware.
(muls): Comment out parts that won't compile, add fixme.
(mulu, divl, divlu, jmpabs, jmpa-, jmprel, jbc, jnbs, callr): Ditto.
(scxti, scxtmg, scxtm, bclear, bclr18, bset19, bitset, bmov): Ditto.
(bmovn, band, bor, bxor, bcmp, bfldl, bfldh): Ditto.
Rewrite rtl processing to require it to be "canonicalized" first,
and write a full canonicalizer / expression checker.
Remove all appearances of DFLT in canonical rtl.
* attr.scm (/attr-eval atval owner): Call rtx-canonicalize,
then rtx-simplify.
* iformat.scm (ifmt-analyze) Use canonical semantics.
* insn (<insn>): New member canonical-semantics.
* mach.scm (<arch>): New member multi-insns-instantiated?.
(/instantiate-multi-insns!): New function.
(/canonicalize-insns!): New function.
(arch-analyze-insns!): Canonicalize insn semantics before processing
them.
* mode.scm (/mode-set-word-params!): New function.
(mode-void?): New function.
(mode-compatible?): VOID is compatible with VOID.
(/mode-word-sizes-defined?): New global.
(mode-set-word-modes!): Use/set it.
(mode-ensure-word-sizes-defined): Update.
(mode-builtin!): New builtin "modes" SYM, INSN, MACH.
Redo WI/UWI/AI/IAI handling.
(op:new-mode): No longer accept DFLT.
(<derived-operand> constructor): Ensure all fields are initialized.
(<anyof-operand> constructor): Ditto.
(/derived-parse-ifield-assertion): Delete arg `args'.
All callers updated.
* rtl-c.scm (<rtl-c-eval-state>): New member `for-insn?'.
(rtl-c): Call rtx-canonicalize instead of rtx-compile.
(rtl-c-expr, rtl-c++): Ditto.
(/rtl-c-get): Use mode of operand, not containing expression.
(rtl-c-set-quiet, rtl-c-set-trace): Remove DFLT support.
(/rtx-use-sem-fn?): Don't check for (insn? owner), check
estate-for-insn? instead.
(s-unop): Use mode of expression, not first operand.
(s-binop, s-binop-with-bit, s-shop, s-cmpop): Ditto.
(s-sequence): Remove DFLT support.
(ifield): Use mode of expression, not UINT.
(pc): Comment out, unused.
(int-attr): New rtx kind.
(attr): Deprecate.
(set, set-quiet): Pass src to rtl-c-set-{trace,quiet} for expansion.
* rtl-traverse.scm (/rtx-canon-debug?): New global.
(/make-cstate): New function.
(/cstate-context, /cstate-outer-expr): New functions.
(/rtx-canon-error): New function.
(/rtx-lookup-hw, /rtx-pick-mode, /rtx-pick-mode3, /rtx-pick-op-mode,
/rtx-get-last-cond-case-rtx): New functions.
(/rtx-canon-*): New functions.
(/rtx-canner-table, /rtx-operand-canoners): New globals.
(/rtx-make-canon-table, /rtx-special-expr-canoners): New functions.
(/rtx-option, /rtx-option-list?): Rewrite.
(rtx-munge-mode&options): Replaces /rtx-munge-mode&options.
Rewritten, all callers updated.
(/rtx-canon-expr, /rtx-canon): New functions.
(rtx-canonicalize): Move here from rtl-xform.scm and rewrite.
(rtx-canonicalize-stmt): New function.
(tstate-make): Remove arg `set?'. All callers updated.
(tstate-new-set?): Delete.
(/rtx-traverse-options, /rtx-traverse-*mode): Delete,
moved to /rtx-canon-*.
(/rtx-traverse-normal-operand): New function.
(/rtx-traverse-rtx-list): Delete arg `mode', all callers updated.
(/rtx-traverse-rtx, /rtx-traverse-setrtx,, /rtx-traverse-testrtx,
/rtx-traverse-condrtx, /rtx-traverse-casertx, /rtx-traverse-locals,
/rtx-traverse-iteration, /rtx-traverse-env, /rtx-traverse-attrs):
Ditto.
(/rtx-traverse-symbol, /rtx-traverse-string, /rtx-traverse-number,
/rtx-traverse-symornum, /rtx-traverse-object): Delete.
(/rtx-make-traverser-table): Update.
(/rtx-traverse-operands): Remove mode processing, now done during
canonicalization.
(/rtx-traverse-expr): Delete arg `mode', all callers updated.
(/rtx-traverse): Ditto.
(rtx-init-traverser-tables!): New function.
* rtl-xform (/rtx-verify-no-dflt-modes-expr-fn): New function.
(rtx-verify-no-dflt-modes): New function.
(/rtx-simplify-expr-fn): Update, `arg' mode deleted.
(rtx-simplify-insn): Use insn-canonical-semantics.
(rtx-canonicalize): Moved to rtl-traverse.scm.
(/compile-expr-fn, rtx-compile): Delete.
(/rtx-trim-rtx-list): New function.
(/rtx-trim-for-doc): Handle set, if.
* rtl.scm (<rtx-func>): New members result-mode, matchexpr-index.
(/rtx-valid-mode-types): Update.
(/rtx-valid-matches): Update.
(/rtx-find-matchexpr-index): New function.
(rtx-lookup): Require rtx-kind to be the rtx name.
(def-rtx-node): New arg result-mode, all callers updated.
(def-rtx-syntax-node, def-rtx-operand-node): Ditto.
(rtx-lazy-sem-mode): Delete.
(/rtx-closure-make): New arg `mode', all callers updated.
(rtx-make-ifield, rtx-make-operand, rtx-make-local): Ditto.
(rtx-operand-obj): Rewrite.
(rtx-make-xop): New functions.
(/hw): Renamed from `hw', all callers updated.
Use the correct mode instead of DFLT for the index.
(rtl-builtin!): Call rtx-init-traversal-tables!.
(rtl-finish!): Update.
* rtx-funcs.scm (all rtx functions): New parameter: result-mode.
Update mode arg-type.
(pc): Comment out.
(int-attr): New rtx kind.
(attr): Deprecate.
* sem-frags.scm (/frag-hash-compute!): Update, mode arg deleted.
(/frag-cost-compute!): Ditto.
* semantics.scm (/build-operand!): Delete args op-name, op.
New arg op-expr. All callers updated.
(/build-mem-operand!): Remove DFLT support.
(semantic-compile): Update process-expr!, mode arg deleted.
* sid-cpu.scm (gen-semantic-code): Specify #:for-insn? in
rtl-c++ calls.
(/gen-sem-case, /gen-sfrag-code): Ditto.
* sid.scm (/op-gen-set-trace1): Renamed from /op-gen-set-trace.
(/op-gen-set-trace): New function. If not doing profiling,
call /op-gen-set-quiet.
* sim-cpu.scm (gen-semantic-code): Specify #:for-insn? in rtl-c calls.
* utils-gen.scm (/gen-ifld-extract-base): Update call to rtl-c.
(/gen-ifld-extract-beyond, gen-multi-ifld-extract): Ditto.
* utils.scm (find-first-index): New function.
* doc/rtl.texi: Delete docs for `attr'. Add `int-attr'.
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.