public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
To: bje@redhat.com
Cc: hans-peter.nilsson@axis.com, cgen@sources.redhat.com
Subject: [RFA:] support setup-semantics in sim-cpu.scm (was: Re: Confusion: setup-semantics?  ...)
Date: Wed, 20 Mar 2002 16:47:00 -0000	[thread overview]
Message-ID: <200203210047.BAA18254@ignucius.axis.se> (raw)
In-Reply-To: <15447.20614.371737.126875@scooby.brisbane.redhat.com> (message from Ben Elliston on Wed, 30 Jan 2002 12:46:46 +1100 (EST))

> 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

  parent reply	other threads:[~2002-03-21  0:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-28 16:03 Confusion: setup-semantics? PC not updated? Immediate operands? Hans-Peter Nilsson
2002-01-29 17:47 ` Ben Elliston
2002-01-29 18:34   ` Hans-Peter Nilsson
2002-01-29 20:06   ` Frank Ch. Eigler
2002-01-30  7:10     ` Hans-Peter Nilsson
2002-03-20 16:47   ` Hans-Peter Nilsson [this message]
2002-04-18 15:20     ` [RFA:] support setup-semantics in sim-cpu.scm (was: Re: Confusion: setup-semantics? ...) Hans-Peter Nilsson
2002-06-19 15:46     ` [RFA:] support setup-semantics in sim-cpu.scm Hans-Peter Nilsson
2002-03-22  9:16 ` Confusion: setup-semantics? PC not updated? Immediate operands? Doug Evans
2002-03-22  9:20 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200203210047.BAA18254@ignucius.axis.se \
    --to=hans-peter.nilsson@axis.com \
    --cc=bje@redhat.com \
    --cc=cgen@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).