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.
* cpu/simplify.inc (*): One line doc strings don't need \n.
(df): Invoke define-full-ifield instead of claiming it's an alias.
(dno): Define.
(dnop): Mark as deprecated.
* cpu/play.cpu: Add example of hardware `layout'.
* doc/porting.tex: Add docs on simplify.inc.
* doc/rtl.texi: Cleanup pass over "Simplification macros",
and other things.
* ifield.scm: Whitespace/formatting cleanup.
* ifield.scm (-multi-ifield-parse): Watch for missing subfields.
DJ Delorie [Wed, 8 Jul 2009 05:37:28 +0000 (05:37 +0000)]
* cpu/mep-ivc2.cpu (cpmovtocsar0_C3, cpmovtocsar1_C3,
cpmovtocc_C3, cpmovtocsar0_P0S_P1, cpmovtocsar1_P0S_P1,
cpmovtocc_P0S_P1): Mark volatile. Note which registers are
written to.
DJ Delorie [Tue, 7 Jul 2009 01:55:59 +0000 (01:55 +0000)]
[cgen]
* cpu/mep-core.cpu (fsft, ssarb): Mark as VOLATILE.
* cpu/mep-ivc2.cpu (many): Add VOLATILE to more insns that make
unspecified accesses to control registers.
DJ Delorie [Wed, 24 Jun 2009 03:06:40 +0000 (03:06 +0000)]
[cgen]
* intrinsics.scm: Updates to support IVC2.
(belongs-to-group?): Check IVC2 slots.
(-slots-attribute): New.
(targets::attributes): Add SLOTS.
(target:add-well-known-intrinsics): Add CPMOV.
(md-insn): Add CPTYPE and CRET?.
(add-md-insn): Likewise.
(add-intrinsic-for-isa): Disable the duplicate tests, as IVC2 has
duplicate insns with different bit patterns.
(write-cgen-insn?): Add cret? support.
(intrinsics.h): Add vector types.
(runtime-op): Add vector support.
(intrinsic-protos.h): Let GCC define its types. Add cret? support.
* cpu/mep-core.cpu: Add CPTYPE and CRET attributes.
* cpu/mep-ivc2.cpu: Update all insns to include type information.
(h-cr-ivc2): Default to typeless.
(h-ccr-ivc2): Fix register width.
(SLOTS): Fix values and default.
(ivc2_*): Add control register names.
(crop, crqp, crpp, croc, crqc, crpc): Default to typeless.
Doug Evans [Thu, 18 Jun 2009 18:12:32 +0000 (18:12 +0000)]
* dev.scm (cload): Change #:arch argument to take the path to the
.cpu file instead of just the name of the architecture.
* read.scm (arch-path): Remove trailing '/'.
(cpu-load): Set `arch-path' to directory of .cpu file.
(-cgen): Don't set `arch-path' here.
(include): Update.
* doc/porting.texi: Update.
DJ Delorie [Fri, 22 May 2009 17:37:43 +0000 (17:37 +0000)]
[cgen]
* cpu/mep.opc (mep_examine_ivc2_insns): Fix bug in ivc2 decoder.
(mep_config_map): Regenerate.
* cpu/mep-ivc2.cpu (h-ccr-ivc2): Add generic names as well as
ivc2-specific names.
(simm8p20): New.
(cmovc): move to after field definitions, use ivc2-specific
register names.
(cpmovi_b_P0S_P1): New.
[utils/mep]
* mepcfgtool.c (do_cgen_config_opc): Propagate endianness and VLIW
size to default configuration.
DJ Delorie [Mon, 20 Apr 2009 19:38:09 +0000 (19:38 +0000)]
* intrinsics.scm (intrinsics-analyze!): Include aliases.
(guess-mode): Drop COP* syntax.
(need-insn): Add "--syscall--" to the list.
(enum-type): Drop COP* syntax.
(intrinsics.h): Likewise.
(intrinsic-protos.h): Change file header to allow it to be
included.
DJ Delorie [Sat, 18 Apr 2009 02:56:43 +0000 (02:56 +0000)]
[cgen]
* cpu/mep-c5.cpu (f-12s20): Change to signed.
(lhucpm1): Limit to C5 mach.
(dsp0,dsp1): Rewrite as aliases so that intrinsics are generated.
* cpu/mep-core.cpu (extend-cdisp10): New.
(f-cdisp10): Change to signed, use extend-cdisp10 to sign extend.
Dave Brolley [Wed, 18 Oct 2006 18:04:40 +0000 (18:04 +0000)]
2006-10-18 Dave Brolley <brolley@redhat.com>
* Contribute the following changes:
2006-07-11 Dave Brolley <brolley@redhat.com>
* cpu/sh64-compact.cpu (movual, movual2): New insns.
(movcol): New insn.
* cpu/sh.cpu (sh4a-nofpu-models): New pmacro.
* sid.scm (-op-gen-delayed-set-maybe-trace): If delay used, note the
hardware or memory mode which was used.
* sid-cpu.scm (hw-need-write-stack?): New function.
(-gen-hw-stream-and-destream-fns): Compute stack-regs. Use it to
identify hardware which uses write stacks.
(useful-mode-names): Renamed to write-stack-memory-mode-names.
Initialized to an empty list.
(-gen-writestacks, -gen-reset-fn, -gen-unified-write-fn): Use
hw-need-write-stack?.
* hardware.scm (used-in-delay-rtl?): New member of <hardware-base>.
(define-getters <hardware-base>): Define used-in-delay-rtl?.
(used-in-delay-rtl?): New method of <hardware-base>.
(hw-used-in-delay-rtl?): New function.
2006-06-20 Dave Brolley <brolley@redhat.com>
* sid.scm (gen-attr-type): Removed.
* cpu/sh.cpu (SH2a-nofpu-MACH): Add sh5.
(SH2a-MACH): Add sh5.
(sh2a-nofpu-models): Add units for sh5.
(sh2a-fpu-models): Likewise.
2006-06-15 Dave Brolley <brolley@redhat.com>
* cpu/sh-sim.cpu: New file.
* cpu/sh-sid.cpu: New file.
* cpu/sh64-media.cpu (dshci): Add xtiming argument and splice it in.
(All fields): Remap for (insn-lsb0? #f)
(All insns): Add timing specs.
* cpu/sh64-compact.cpu (dshcf,dshcop): Replace 'ignored' argument with
'xattrs' and .splice it in.
(32-BIT-INSN,SH4-GROUP,SH4A-GROUP): New insn attributes.
(h-frc,h-drc): Add PROFILE attribute.
(h-fpccr): Removed.
(h-vbr): New hardware.
(All fields): Remap for (insn-lsb0? #f)
(f-imm20-hi,f-imm20-lo,f-imm20): New fields.
(fr0,fmovm,fmovn,imm20,imm12x4,imm12x8,vbr): New operands.
(fpscr): Use h-fpscr.
(fsdm,fsdn): Use h-fsd.
(dshci): Add xtiming argument and splice it in.
(dr,xd): pmacros removed.
(All insns): Add timing specs, *-MACH attribibutes,
SH4{A}-GROUP attributes.
(divu,mulr,ldc-vbr,ldc-sr,ldcl-vbr,movl12,movl13,stcl-vbr): New insns.
* cpu/sh.cpu): Include sh-sid.cpu or sh-sim.cpu depending on whether
we're being processed for sim or sid.
(define-arch): Change insn-lsb0? for #f. Add machs sh2e, sh2a-fpu,
sh2a-nofpu, sh4-nofpu, sh4a-nofpu, sh4a, sh4al.
(define-isa compact): Add (isa-parallel-insns 2).
(define-isa media): Add (isa-parallel-insns 2). Add
(default-insn-word-bitsize 32). Change base-insn-bitsize to 32.
(define-mach): Add sh2e, sh2a-fpu, sh2a-nofpu, sh4-nofpu, sh4a-nofpu,
sh4a, sh4al
(SH2-MACH, SH2e-MACH, SH2a-nofpu-MACH, SH2a-MACH, SH3-MACH)
(SH3e-MACH, SH4-nofpu-MACH, SH4-MACH, SH4a-nofpu-MACH, SH4a-MACH)
(SH4al-MACH, SH5-MACH): New pmacros.
(common-units, common-fp-units, sh2a-nofpu-units, sh2a-fpu-units)
(sh4-nofpu-units, sh4-common-fp-units, sh5-media-units)
(sh5-media-fp-units, common-model, common-model-with-fp)
(sh3-model, sh3e-model): New pmacros.
(define-model sh2): New model.
(define-model sh2e): New model.
(define-model sh3): New model.
(define-model sh3e): New model.
(define-model sh2a-nofpu): New model.
(define-model sh2a-fpu): New model.
(define-model sh4-nofpu): New model.
(define-model sh4): New model.
(define-model sh4a-nofpu): New model.
(define-model sh4a): New model.
(define-model sh4al): New model.
(define-model sh5-media): New model.
(define-model sh5): Add all units.
(all-models, sh2e-models, sh2a-nofpu-models, sh2a-fpu-models)
(sh3-models, sh3e-models, sh4-nofpu-models, sh4-models)
(sh5-media-models, shad-models, fsqrt-models): New pmacros.
(h-pc): Add PROFILE attribute.
(h-fr): Likewise.
(h-tr): Likewise.
(h-gr,h-grc): Likewise.
(h-cr): Set h-sr in setter.
(h-frbit): Get/Set h-fpscr.
(h-szbit,h-prbit): Likewise.
(h-fp): Add PROFILE attribute. Now indexed by even indices 0-62.
Add getter and setter.
(h-fc): Add PROFILE attribute. Now indexed by quad indices 0-60.
Adjust getter and setter.
(h-fmtx): Add PROFILE attribute. Now indexed by 0, 16, 32 and 48.
Adjust getter and setter.
(h-dr): Add PROFILE attribute. Now indexed by even indices 0-62.
(h-fsd,h-fmov): New hardware.
Dave Brolley [Fri, 14 Jul 2006 18:49:32 +0000 (18:49 +0000)]
2006-07-14 Dave Brolley <brolley@redhat.com>
* sid.scm (-op-gen-delayed-set-maybe-trace): If delay used, note the
hardware or memory mode which was used.
* sid-cpu.scm (hw-need-write-stack?): New function.
(-gen-hw-stream-and-destream-fns): Compute stack-regs. Use it to
identify hardware which uses write stacks.
(useful-mode-names): Renamed to write-stack-memory-mode-names.
Initialized to an empty list.
(-gen-writestacks, -gen-reset-fn, -gen-unified-write-fn): Use
hw-need-write-stack?.
* hardware.scm (used-in-delay-rtl?): New member of <hardware-base>.
(define-getters <hardware-base>): Define used-in-delay-rtl?.
(used-in-delay-rtl?): New method of <hardware-base>.
(hw-used-in-delay-rtl?): New function.
Dave Brolley [Tue, 9 May 2006 16:17:07 +0000 (16:17 +0000)]
2006-05-09 Dave Brolley <brolley@redhat.com>
* read.scm (include): Use arch-path as file location.
(arch-path): Define it with a default setting.
(-cgen): Update arch-path when "-a" option is specified.