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]
Other format: [Raw text]

[RFA:] support setup-semantics in sim-cpu.scm (was: Re: Confusion: setup-semantics? ...)


> From: Ben Elliston <bje@redhat.com>
> Date: Wed, 30 Jan 2002 12:46:46 +1100 (EST)

> >>>>> "Hans-Peter" == Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:
> 
>   Hans-Peter> This when generating that big GCC-specific C switch
>   Hans-Peter> <arch>-switch.c, which seems generated from sim-cpu.scm.  From
>   Hans-Peter> what little scheme I understand (I'm blissfully naive), it seems
>   Hans-Peter> only sid-cpu.scm, not sim-cpu.scm, supports setup-semantics.
>   Hans-Peter> I'd use it for purposes similar to that of arm.cpu.
>   Hans-Peter> Should it work?
> 
> I think you are correct.  The setup-semantics work might need to be
> back-ported to sim-cpu.scm.  Much of the work is completely analogous;
> it shouldn't be too difficult.

Is this the right approach?  The right thing seems to happen for
play.cpu, when I test by inserting (setup-semantics (c-call VOID
"gobbledegook" pc)) in the defin-isa body, with both
(cgen-semantics.c) and (cgen-sem-switch.c).  (After removing
addv2, that is.)  To wit: I just copied the "if" clause in front
of the gen-semantic-code call in -gen-sem-case in sid-cpu.scm,
replacing rtl-c++ with rtl-c and made it part of
gen-semantic-code, but wrapping the two parts in string-append.

By the way, sid-cpu.scm does not emit the setup-semantics code
in its gen-semantic-code define as below.  Instead it's emitted
at the call site of gen-semantics-code, but only at one of the
two places, and then at a third place.  I don't know if that's
right or wrong, but it looks like it could lack support for
setup-semantics in some conditions.  I'm probably confused.
Maybe a comment is missing.

Ok to commit?

2002-03-20  Hans-Peter Nilsson  <hp@axis.com>

	* sim-cpu.scm (gen-semantic-code): Prepend with setup-semantics
	code.

*** sim-cpu.scm.old	Tue Jan 29 00:30:59 2002
--- sim-cpu.scm	Thu Mar 21 01:07:13 2002
*************** SEM_FN_NAME (@prefix@,init_idesc_table) 
*** 529,543 ****
  ; Return C code to perform the semantics of INSN.
  
  (define (gen-semantic-code insn)
!   ; Indicate generating code for INSN.
!   ; Use the compiled form if available.
!   ; The case when they're not available is for virtual insns.
!   (let ((sem (insn-compiled-semantics insn)))
!     (if sem
! 	(rtl-c-parsed VOID sem nil
! 		      #:rtl-cover-fns? #t #:owner insn)
! 	(rtl-c VOID (insn-semantics insn) nil
! 	       #:rtl-cover-fns? #t #:owner insn)))
  )
  
  ; Return definition of C function to perform INSN.
--- 529,554 ----
  ; Return C code to perform the semantics of INSN.
  
  (define (gen-semantic-code insn)
!   (string-append
!    (if (and (insn-real? insn)
! 	    (isa-setup-semantics (current-isa)))
!        (string-append
! 	"  "
! 	(rtl-c VOID (isa-setup-semantics (current-isa)) nil
! 	       #:rtl-cover-fns? #t
! 	       #:owner insn)
! 	"\n")
!        "")
! 
!    ; Indicate generating code for INSN.
!    ; Use the compiled form if available.
!    ; The case when they're not available is for virtual insns.
!    (let ((sem (insn-compiled-semantics insn)))
!      (if sem
! 	 (rtl-c-parsed VOID sem nil
! 		       #:rtl-cover-fns? #t #:owner insn)
! 	 (rtl-c VOID (insn-semantics insn) nil
! 		#:rtl-cover-fns? #t #:owner insn))))
  )
  
  ; Return definition of C function to perform INSN.

brgds, H-P


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