From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13055 invoked by alias); 12 Mar 2002 20:47:51 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 12966 invoked from network); 12 Mar 2002 20:47:50 -0000 Received: from unknown (HELO mms3.broadcom.com) (63.70.210.38) by sources.redhat.com with SMTP; 12 Mar 2002 20:47:50 -0000 Received: from 63.70.210.1 by mms3.broadcom.com with ESMTP (Broadcom MMS-3 SMTP Relay (MMS v4.7)); Tue, 12 Mar 2002 12:47:38 -0800 X-Server-Uuid: 1e1caf3a-b686-11d4-a6a3-00508bfc9ae5 Received: from dt-sj3-118.sj.broadcom.com (dt-sj3-118 [10.21.64.118]) by mail-sj1-5.sj.broadcom.com (8.12.2/8.12.2) with ESMTP id g2CKlg1S011067 for ; Tue, 12 Mar 2002 12:47:42 -0800 (PST) Received: (from cgd@localhost) by dt-sj3-118.sj.broadcom.com ( 8.9.1/SJ8.9.1) id MAA18043; Tue, 12 Mar 2002 12:47:41 -0800 (PST) To: gdb@sources.redhat.com Subject: problem w/ igen, multiple -M models, and -G gen-multi-sim. From: cgd@broadcom.com Date: Tue, 12 Mar 2002 12:47:00 -0000 Message-ID: X-Mailer: Gnus v5.7/Emacs 20.4 MIME-Version: 1.0 X-WSS-ID: 1090B6E0999937-01-01 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00113.txt.bz2 So, doing some MIPS sim hacking last week I noticed an interesting problem, and wanted to investigate it and post about it before forgetting it entirely. (It seems to predate my intrusions into the MIPS code. 8-) Anyway, using the example files in the shar file below (specifically, run_igen.sh, foo.igen and foo.dc), a problem results. (These were all derived from the mips sim, but there were too many instructions there to allow sane debugging. 8-) two instructions in the igen file. same bit encoding for each, but different model lists (and different semantics to go with those different models 8-). run igen w/ -M flag that specifies both models, and -G gen-multi-sim=. the engine which is built calls both functions: semantic_DMxC1_COP1Sa semantic_DMxC1_COP1Sb however, only semantic_DMxC1_COP1Sa is output into the semantics.c file. what's happening is that make_gen_semantics_list() is calling insn_list_insert() to insert the DMxC1_COP1Sb on to the semantics list (OK), but insn_list_insert finds that all of the keys it cares about are the same, thinks it's a duplicate of DMxC1_COP1Sa, and merges it into DMxC1_COP1Sa (not so OK), and as a result no semantic function is generated for DMxC1_COP1Sb. I don't know what the right solution here is, but I figured others might want to be aware of the problem and might have comments. Having talked w/ Andrew a bit about the future of the MIPS sim, it's going to move away from using -M like this, and instead use multiple igen runs to generate simulators for different machines. So, this isn't something that I need a solution to. I just wanted people who might care in the future to have a reference in the list archives. If a solution comes out of this, well, that'd be fine by me, too. 8-) chris ======================================================================= #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.2.1). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 2002-03-12 12:46 PST by . # Source directory was `/projects/bbp_ext7/systems/cgd/proj/gnu/write/gdb/src.igen-bug/mips64-elf/sim/mips'. # # Existing files will *not* be overwritten unless `-c' is specified. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 774 -rw-rw-r-- run_igen.sh # 559 -rw-rw-r-- foo.dc # 527 -rw-rw-r-- foo.igen # save_IFS="${IFS}" IFS="${IFS}:" gettext_dir=FAILED locale_dir=FAILED first_param="$1" for dir in $PATH do if test "$gettext_dir" = FAILED && test -f $dir/gettext \ && ($dir/gettext --version >/dev/null 2>&1) then set `$dir/gettext --version 2>&1` if test "$3" = GNU then gettext_dir=$dir fi fi if test "$locale_dir" = FAILED && test -f $dir/shar \ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) then locale_dir=`$dir/shar --print-text-domain-dir` fi done IFS="$save_IFS" if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED then echo=echo else TEXTDOMAINDIR=$locale_dir export TEXTDOMAINDIR TEXTDOMAIN=sharutils export TEXTDOMAIN echo="$gettext_dir/gettext -s" fi if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"' elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"' elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$2 "$8"' else shar_touch=: echo $echo 'WARNING: not restoring timestamps. Consider getting and' $echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch # if mkdir _sh06977; then $echo 'x -' 'creating lock directory' else $echo 'failed to create lock directory' exit 1 fi # ============= run_igen.sh ============== if test -f 'run_igen.sh' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'run_igen.sh' '(file already exists)' else $echo 'x -' extracting 'run_igen.sh' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'run_igen.sh' && set -e X (cd ../igen && gmake ) X X../igen/igen \ X \ X -Werror \ X -Wnodiscard \ X -F 32,64,f -M mipsIV,mipsIII -G gen-multi-sim=mipsIV -G trace-all -N 0 \ X -G gen-direct-access \ X -G gen-zero-r0 \ X -B 32 \ X -H 31 \ X -i foo.igen \ X -o foo.dc \ X -x \ X -n icache.h -hc tmp-icache.h \ X -n icache.c -c tmp-icache.c \ X -n semantics.h -hs tmp-semantics.h \ X -n semantics.c -s tmp-semantics.c \ X -n idecode.h -hd tmp-idecode.h \ X -n idecode.c -d tmp-idecode.c \ X -n model.h -hm tmp-model.h \ X -n model.c -m tmp-model.c \ X -n support.h -hf tmp-support.h \ X -n support.c -f tmp-support.c \ X -n itable.h -ht tmp-itable.h \ X -n itable.c -t tmp-itable.c \ X -n engine.h -he tmp-engine.h \ X -n engine.c -e tmp-engine.c \ X -n irun.c -r tmp-irun.c SHAR_EOF (set 20 02 03 12 12 45 54 'run_igen.sh'; eval "$shar_touch") && chmod 0664 'run_igen.sh' || $echo 'restore of' 'run_igen.sh' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'run_igen.sh:' 'MD5 check failed' c1cde0b4f6dc81769aa9e46ac1840200 run_igen.sh SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'run_igen.sh'`" test 774 -eq "$shar_count" || $echo 'run_igen.sh:' 'original size' '774,' 'current size' "$shar_count!" fi fi # ============= foo.dc ============== if test -f 'foo.dc' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'foo.dc' '(file already exists)' else $echo 'x -' extracting 'foo.dc' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'foo.dc' && # most instructions # ------ options ------ : Fst : Lst : ff : fl : fe : word : --- fmt --- : model ... # { : mask : value : word } X # Top level - create a very big switch statement. X X padded-switch,combine : 31 : 26 : : : : : : X X switch,combine : 5 : 0 : : : : : : X X switch,combine : 20 : 16 : : : : : : X X switch,combine : 25 : 21 : : : : : : X X switch,combine : 10 : 6 : : : : : : X SHAR_EOF (set 20 02 03 12 10 57 43 'foo.dc'; eval "$shar_touch") && chmod 0664 'foo.dc' || $echo 'restore of' 'foo.dc' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'foo.dc:' 'MD5 check failed' 0cc85f54d1aaffc21fa0a619b2e23020 foo.dc SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'foo.dc'`" test 559 -eq "$shar_count" || $echo 'foo.dc:' 'original size' '559,' 'current size' "$shar_count!" fi fi # ============= foo.igen ============== if test -f 'foo.igen' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'foo.igen' '(file already exists)' else $echo 'x -' extracting 'foo.igen' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'foo.igen' && X X :option:32::insn-specifying-widths:true :option:32::gen-delayed-branch:false X X :model:::mipsIII:mips4000: :model:::mipsIV:mips8000: X X :internal::::illegal: { X SignalException (ReservedInstruction, 0); } X X 000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD "add r, r, r" *mipsIII: *mipsIV: { X foo(); } X X 010001,00,X,01,5.RT,5.FS,00000000000:COP1Sa:64,f::DMxC1 "dm%sc1 r, f" *mipsIII: { X bar(); } X 010001,00,X,01,5.RT,5.FS,00000000000:COP1Sb:64,f::DMxC1 "dm%sc1 r, f" *mipsIV: { X baz(); } SHAR_EOF (set 20 02 03 12 12 34 38 'foo.igen'; eval "$shar_touch") && chmod 0664 'foo.igen' || $echo 'restore of' 'foo.igen' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'foo.igen:' 'MD5 check failed' 86fe1ccfd33f1dd1c746b9b0746cbe2b foo.igen SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'foo.igen'`" test 527 -eq "$shar_count" || $echo 'foo.igen:' 'original size' '527,' 'current size' "$shar_count!" fi fi rm -fr _sh06977 exit 0