From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16693 invoked by alias); 21 Mar 2002 00:47:58 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 16612 invoked from network); 21 Mar 2002 00:47:56 -0000 Received: from unknown (HELO miranda.axis.se) (193.13.178.2) by sources.redhat.com with SMTP; 21 Mar 2002 00:47:56 -0000 Received: from ignucius.axis.se (root@ignucius.axis.se [10.13.1.18]) by miranda.axis.se (8.12.1/8.12.1/Debian -5) with ESMTP id g2L0llDi008742; Thu, 21 Mar 2002 01:47:47 +0100 Received: (from hp@localhost) by ignucius.axis.se (8.9.3/8.9.3/Debian 8.9.3-21) id BAA18254; Thu, 21 Mar 2002 01:47:47 +0100 Date: Wed, 20 Mar 2002 16:47:00 -0000 Message-Id: <200203210047.BAA18254@ignucius.axis.se> From: Hans-Peter Nilsson To: bje@redhat.com CC: hans-peter.nilsson@axis.com, cgen@sources.redhat.com 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)) Subject: [RFA:] support setup-semantics in sim-cpu.scm (was: Re: Confusion: setup-semantics? ...) X-SW-Source: 2002-q1/txt/msg00089.txt.bz2 > From: Ben Elliston > Date: Wed, 30 Jan 2002 12:46:46 +1100 (EST) > >>>>> "Hans-Peter" == Hans-Peter Nilsson writes: > > Hans-Peter> This when generating that big GCC-specific C switch > Hans-Peter> -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 * 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