This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] misc cleanups


Prior to checking in some pretty invasive changes, I want to get some
cleanups out of the way.
[which isn't to suggest bigger changes will get checked in shortly -
lots of testing still to do]

2010-02-11  Doug Evans  <dje@sebabeach.org>

	* desc-cpu.scm (/gen-cpu-open): Remove comment on K&R support.
	* utils-cgen.scm (gen-define-with-symcat): Remove K&R support.

	* utils-sim.scm (compute-sformat-argbufs!): Use more consistent name
	for name of empty sbuf.

	* iformat.scm (/sfmt-search-key, /ifmt-lookup-sfmt!): Add assert.

	* insn.scm (<insn>): Add initial value for members fmt-desc, ifmt,
	sfmt, tmp.
	(/sub-insn-ifields): Delete old commented out code.
	(/sub-insn-make!, /parse-insn-format-symbol): Ditto.
	* operand.scm (/anyof-merge-setter, anyof-merge-semantics): Ditto.

	* sim-decode.scm (/gen-decode-insn-globals): Tweak formatting of
	generated code.

Index: desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.31
diff -u -p -r1.31 desc-cpu.scm
--- desc-cpu.scm	25 Jan 2010 03:50:43 -0000	1.31
+++ desc-cpu.scm	12 Feb 2010 02:01:15 -0000
@@ -783,11 +783,7 @@ static void
    CGEN_CPU_OPEN_END:     terminates arguments
 
    ??? Simultaneous multiple isas might not make sense, but it's not (yet)
-   precluded.
-
-   ??? We only support ISO C stdargs here, not K&R.
-   Laziness, plus experiment to see if anything requires K&R - eventually
-   K&R will no longer be supported - e.g. GDB is currently trying this.  */
+   precluded.  */
 
 CGEN_CPU_DESC
 @arch@_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
Index: iformat.scm
===================================================================
RCS file: /cvs/src/src/cgen/iformat.scm,v
retrieving revision 1.15
diff -u -p -r1.15 iformat.scm
--- iformat.scm	23 Nov 2009 09:03:00 -0000	1.15
+++ iformat.scm	12 Feb 2010 02:01:15 -0000
@@ -259,6 +259,8 @@
 ; fragments in pbb simulators).  Don't cause spurious differences.
 
 (define (/sfmt-search-key insn cti? sorted-used-iflds sem-in-ops sem-out-ops)
+  (assert (insn-ifmt insn))
+
   (let ((op-key (lambda (op)
 		  (string-append " ("
 				 (or (->string (obj-attr-value insn 'sanitize))
@@ -484,6 +486,8 @@
 ; We assume INSN's <iformat> has already been recorded.
 
 (define (/ifmt-lookup-sfmt! insn fmt-desc sfmt-list)
+  (assert (insn-ifmt insn))
+
   (let* ((search-key (/sfmt-search-key insn (-fmt-desc-cti? fmt-desc)
 				       (-fmt-desc-used-iflds fmt-desc)
 				       (-fmt-desc-in-ops fmt-desc)
Index: insn.scm
===================================================================
RCS file: /cvs/src/src/cgen/insn.scm,v
retrieving revision 1.40
diff -u -p -r1.40 insn.scm
--- insn.scm	23 Nov 2009 09:03:01 -0000	1.40
+++ insn.scm	12 Feb 2010 02:01:15 -0000
@@ -32,16 +32,16 @@
 
 		; The <fmt-desc> of the insn.
 		; This is used to help calculate the ifmt,sfmt members.
-		fmt-desc
+		(fmt-desc . #f)
 
 		; The <iformat> of the insn.
-		ifmt
+		(ifmt . #f)
 
 		; The <sformat> of the insn.
-		sfmt
+		(sfmt . #f)
 
 		; Temp slot for use by applications.
-		tmp
+		(tmp . #f)
 
 		; Instruction semantics.
 		; This is the rtl in source form, as provided in the
@@ -205,8 +205,6 @@
 ; {value-names} is a list of names of {anyof-operands}.
 
 (define (/sub-insn-ifields insn anyof-operands value-names new-values)
-  ; (debug-repl-env insn anyof-operands value-names new-values)
-
   ; Delete ifields of {anyof-operands} and add those for {new-values}.
   (let ((iflds
 	 (append!
@@ -227,7 +225,6 @@
 	; IFLD-LIST is an unsorted list of <ifield> elements.
 	(find-preceder
 	 (lambda (ifld-list owner)
-	   ;(debug-repl-env ifld-list owner)
 	   (cond ((ifield? owner)
 		  owner)
 		 ((anyof-operand? owner)
@@ -240,7 +237,6 @@
 					     (anyof-instance? (derived-ifield-owner f))
 					     (eq? name (obj:name (anyof-instance-parent (derived-ifield-owner f))))))
 				      ifld-list)))
-		    ;(debug-repl-env ifld-list owner)
 		    (assert result)
 		    result))
 		 ((operand? owner) ; derived operands are handled here too
@@ -271,7 +267,6 @@
 ; ANYOF-OPERANDS.  Each element is a <derived-operand>.
 
 (define (/sub-insn-make! insn anyof-operands new-values)
-  ;(debug-repl-env insn anyof-operands new-values)
   (assert (= (length anyof-operands) (length new-values)))
   (assert (all-true? (map anyof-operand? anyof-operands)))
   (assert (all-true? (map derived-operand? new-values)))
@@ -286,10 +281,6 @@
 		     anyof-operands new-values)
 	 " ...\n")
 
-;  (if (eq? '@sib+disp8-QI-disp32-8
-;	   (obj:name (car new-values)))
-;      (debug-repl-env insn anyof-operands new-values))
-
   (let* ((value-names (map obj:name anyof-operands))
 	 (ifields (/sub-insn-ifields insn anyof-operands value-names new-values))
 	 (known-values (ifld-known-values ifields)))
@@ -545,7 +536,6 @@
 ; Subroutine of /parse-insn-format to parse a symbol ifield spec.
 
 (define (/parse-insn-format-symbol context isa-name-list sym)
-  ;(debug-repl-env sym)
   (let ((op (current-op-lookup sym isa-name-list)))
     (if op
 	(cond ((derived-operand? op)
Index: operand.scm
===================================================================
RCS file: /cvs/src/src/cgen/operand.scm,v
retrieving revision 1.32
diff -u -p -r1.32 operand.scm
--- operand.scm	25 Jan 2010 00:40:29 -0000	1.32
+++ operand.scm	12 Feb 2010 02:01:16 -0000
@@ -1253,7 +1253,6 @@
 ; ((add a b)-object), then return (mem QI (add a b)).
 
 (define (/anyof-merge-getter getter value-names values)
-  ;(debug-repl-env getter value-names values)
   ; ??? This implementation is a quick hack, intended to evolve or be replaced.
   (cond ((not getter)
 	 #f)
@@ -1282,7 +1281,6 @@
 ; ??? `newval' in this context is a reserved word.
 
 (define (/anyof-merge-setter setter value-names values)
-  ;(debug-repl-env setter value-names values)
   ; ??? This implementation is a quick hack, intended to evolve or be replaced.
   (cond ((not setter)
 	 #f)
@@ -1313,7 +1311,6 @@
 ; ((add a b)-object), then return (mem QI (add a b)).
 
 (define (anyof-merge-semantics semantics value-names values)
-  ;(debug-repl-env semantics value-names values)
   ; ??? This implementation is a quick hack, intended to evolve or be replaced.
   (let ((result
 	 (cond ((not semantics)
Index: sim-decode.scm
===================================================================
RCS file: /cvs/src/src/cgen/sim-decode.scm,v
retrieving revision 1.15
diff -u -p -r1.15 sim-decode.scm
--- sim-decode.scm	23 Nov 2009 00:59:57 -0000	1.15
+++ sim-decode.scm	12 Feb 2010 02:01:16 -0000
@@ -70,7 +70,8 @@ static const struct insn_sem @prefix@_in
    "\
 };
 
-static const struct insn_sem @prefix@_insn_sem_invalid = {
+static const struct insn_sem @prefix@_insn_sem_invalid =
+{
   VIRTUAL_INSN_X_INVALID, @PREFIX@_INSN_X_INVALID, @PREFIX@_SFMT_EMPTY"
    (if (and (with-parallel?) (not (with-parallel-only?)))
        ", NOPAR, NOPAR"
Index: utils-cgen.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-cgen.scm,v
retrieving revision 1.26
diff -u -p -r1.26 utils-cgen.scm
--- utils-cgen.scm	25 Jan 2010 00:40:29 -0000	1.26
+++ utils-cgen.scm	12 Feb 2010 02:01:17 -0000
@@ -964,25 +964,12 @@ Mark an entry as being sanitized.
   *UNSPECIFIED*
 )
 
-;; Return a pair of definitions for a C macro that concatenates its
-;; argument symbols.  The definitions are conditional on ANSI C
-;; semantics: one contains ANSI concat operators (##), and the other
-;; uses the empty-comment trick (/**/).  We must do this, rather than
-;; use CONCATn(...) as defined in include/symcat.h, in order to avoid
-;; spuriously expanding our macro's args.
+;; Return the definition of a C macro that concatenates its argument symbols.
 
 (define (gen-define-with-symcat head . args)
   (string-append
-   "\
-#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-#define "
-   head (string-map (lambda (elm) (string-append "##" elm)) args)
-   "
-#else
-#define "
-   head (string-map (lambda (elm) (string-append "/**/" elm)) args)
-   "
-#endif
-"
-   )
+   "#define "
+   head
+   (string-map (lambda (elm) (string-append "##" elm)) args)
+   "\n")
 )
Index: utils-sim.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-sim.scm,v
retrieving revision 1.21
diff -u -p -r1.21 utils-sim.scm
--- utils-sim.scm	23 Nov 2009 09:03:01 -0000	1.21
+++ utils-sim.scm	12 Feb 2010 02:01:17 -0000
@@ -333,7 +333,7 @@
     ; itself.
     (let ((nub-sbufs (list (build-sbuf (car sfmt-contents))))
 	  (empty-sbuf (make <sformat-argbuf>
-			'fmt-empty "no operands" atlist-empty
+			'sfmt-empty "no operands" atlist-empty
 			nil))
 	  )
       (sfmt-set-sbuf! (caar sfmt-contents) (car nub-sbufs))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]