This is the mail archive of the cgen@sources.redhat.com 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]

Updated patch: rtl.scm & operand.scm


Hi -

I include the new patch here this time.  It's better in that it
formally stores the operand's pretty-name, but some cleanup would
still be nice (to use it and store it systematically).

Now the nice hw names are printed for all cases I have come across,
without hurting the profiling logic in sim.scm.


- FChE



2001-01-08  Frank Ch. Eigler  <fche@redhat.com>

	* operand.scm (<operand> pretty-sem-name): New field.
	(<operand> make): Initialize it from hw-name.
	(op:set-pretty-sem-name!): New function.
	(<operand> gen-pretty-name): Default to fetching new field.
	* rtl.scm (hw): Copy hw-name to pretty-sem-name instead.  Restore
	sem-name setting from -rtx-hw-name.

Index: operand.scm
===================================================================
@@ -20,20 +20,24 @@
 	      '(<ident>)
 	      '(
 		; Name as used in semantic code.
 		; Generally this is the same as NAME.  It is changed by the
 		; `operand:' rtx function.  One reason is to set a "pretty"
 		; name in tracing output (most useful in memory operands).
 		; A more important reason is to help match semantic operands
 		; with function unit input/output arguments.
 		sem-name
 
+		; Pretty name as used in tracing code.
+		; Generally this is the same as the hardware element's name.
+		pretty-sem-name
+
 		; Semantic name of hardware element refered to by this operand.
 		hw-name
 
 		; Hardware type of operand, a subclass of <hardware-base>.
 		; This is computed lazily from HW-NAME as many hardware
 		; elements can have the same semantic name.  Applications
 		; that require a unique hardware element to be refered to are
 		; required to ensure duplicates are discarded (usually done
 		; by keeping the appropriate machs).
 		; FIXME: Rename to hw.
@@ -90,40 +94,42 @@
 	      nil)
 )
 
 ; The default make! assigns the default h/w selector.
 
 (method-make!
  <operand> 'make!
  (lambda (self name comment attrs hw-name mode-name index handlers getter setter)
    (elm-set! self 'name name)
    (elm-set! self 'sem-name name)
+   (elm-set! self 'pretty-sem-name hw-name)
    (elm-set! self 'comment comment)
    (elm-set! self 'attrs attrs)
    (elm-set! self 'hw-name hw-name)
    (elm-set! self 'mode-name mode-name)
    (elm-set! self 'selector hw-selector-default)
    (elm-set! self 'index index)
    (elm-set! self 'handlers handlers)
    (elm-set! self 'getter getter)
    (elm-set! self 'setter setter)
    self)
 )
 
 ; FIXME: The prefix field- doesn't seem right.  Indices needn't be
 ; ifields, though for operands defined in .cpu files they usually are.
 (method-make-forward! <operand> 'index '(field-start field-length))
 
 ; Accessor fns
 
 (define op:sem-name (elm-make-getter <operand> 'sem-name))
 (define op:set-sem-name! (elm-make-setter <operand> 'sem-name))
+(define op:set-pretty-sem-name! (elm-make-setter <operand> 'pretty-sem-name))
 (define op:hw-name (elm-make-getter <operand> 'hw-name))
 (define op:mode-name (elm-make-getter <operand> 'mode-name))
 (define op:selector (elm-make-getter <operand> 'selector))
 ; FIXME: op:index should be named op:hwindex.
 (define op:index (elm-make-getter <operand> 'index))
 (define op:handlers (elm-make-getter <operand> 'handlers))
 (define op:getter (elm-make-getter <operand> 'getter))
 (define op:setter (elm-make-getter <operand> 'setter))
 (define op:num (elm-make-getter <operand> 'num))
 (define op:set-num! (elm-make-setter <operand> 'num))
@@ -208,21 +214,23 @@
 ;
 ; FIXME: The current implementation is a quick hack.  Parallel execution
 ; support can create operands with long names.  e.g. h-memory-add-WI-src2-slo16
 ; The eventual way this will be handled is to record with each operand the
 ; entry number (or some such) in the operand instance table so that for
 ; registers we can compute the register's name.
 
 (method-make!
  <operand> 'gen-pretty-name
  (lambda (self mode)
-   (let* ((name (if (elm-bound? self 'sem-name) (elm-get self 'sem-name) (obj:name self)))
+   (let* ((name (if (elm-bound? self 'pretty-sem-name) (elm-get self 'pretty-sem-name) 
+		    (if (elm-bound? self 'sem-name) (elm-get self 'sem-name)
+			(obj:name self))))
 	  (pname (cond ((string=? "h-memory" (string-take 8 name)) "memory")
 		       ((string=? "h-" (string-take 2 name)) (string-drop 2 name))
 		       (else name))))
      (string-append "\"" pname "\"")))
 )
 
 ; PC support.
 ; This is a subclass of <operand>, used to give the simulator a place to
 ; hang a couple of methods.
 ; At the moment we only support one pc, a reasonable place to stop for now.
Index: rtl.scm
===================================================================
@@ -2024,25 +2024,27 @@
 			    (make <hw-index> 'anonymous 'rtx DFLT
 				  (-rtx-closure-make estate index-arg))))
 		       (else (parse-error "hw" "invalid index" index-arg))))
 
       (if (not (hw-mode-ok? hw (obj:name mode) (elm-xget result 'index)))
 	  (parse-error "hw" "invalid mode for hardware" mode-name))
 
       (elm-xset! result 'type hw)
       (elm-xset! result 'mode mode)
 
+      (op:set-pretty-sem-name! result hw-name)
+
       ; The name of the operand must include the index so that multiple copies
       ; of a hardware object (e.g. h-gr[0], h-gr[14]) can be distinguished.
       (let ((name (-rtx-hw-name hw hw-name index-arg)))
 	(send result 'set-name! name)
-	(op:set-sem-name! result hw-name))
+	(op:set-sem-name! result name))
 
       ; Empty comment and attribute.
       ; ??? Stick the arguments in the comment for debugging purposes?
       (send result 'set-comment! "")
       (send result 'set-atlist! atlist-empty)
 
       result))
 )
 
 ; This is shorthand for (hw estate mode hw-name regno selector).

PGP signature


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