public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* sim-model.scm @cpu@ vs @prefix@ confusion
@ 2009-08-25  0:38 Dave Korn
  2009-08-25  5:41 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Korn @ 2009-08-25  0:38 UTC (permalink / raw)
  To: cgen

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]


    Hi CGEN,

  It looks to me like there are a couple of spots in -gen-mach-defns where the
 prefix should be used instead of the cpu, specifically when referencing
*_INSN__MAX and in the names of the *_engine_run_* functions.  Certainly
that's how genmloop.sh and friends expect them to look.  I had to apply the
attached patch otherwise I get undefined references in the generated mloop.c,
so here it is.

cgen/ChangeLog:

	* sim-model.scm (-gen-mach-defns): Replace @cpu@ and @CPU@ by @prefix@
	and @PREFIX@ when setting CPU_MAX_INSNS and the CPU_*_ENGINE_FNs.

  I'm not sure about the relation between cpu and prefix yet, but in my
generated files the prefix appears to be a concatenation of isa and cpu.
Maybe in other ports the prefix ends up just being equal to the cpu and that's
why this hasn't caused any problems in /src?  I didn't investigate yet.

    cheers,
      DaveK


[-- Attachment #2: sim-model-cpu2prefix.diff --]
[-- Type: text/x-c, Size: 852 bytes --]

Index: sim-model.scm
===================================================================
--- sim-model.scm	(revision 141)
+++ sim-model.scm	(working copy)
@@ -333,13 +333,13 @@ static void\n"
   CPU_PC_FETCH (cpu) = " (gen-sym (mach-cpu mach)) "_h_pc_get;
   CPU_PC_STORE (cpu) = " (gen-sym (mach-cpu mach)) "_h_pc_set;
   CPU_GET_IDATA (cpu) = @cpu@_get_idata;
-  CPU_MAX_INSNS (cpu) = @CPU@_INSN__MAX;
+  CPU_MAX_INSNS (cpu) = @PREFIX@_INSN__MAX;
   CPU_INSN_NAME (cpu) = cgen_insn_name;
-  CPU_FULL_ENGINE_FN (cpu) = @cpu@_engine_run_full;
+  CPU_FULL_ENGINE_FN (cpu) = @prefix@_engine_run_full;
 #if WITH_FAST
-  CPU_FAST_ENGINE_FN (cpu) = @cpu@_engine_run_fast;
+  CPU_FAST_ENGINE_FN (cpu) = @prefix@_engine_run_fast;
 #else
-  CPU_FAST_ENGINE_FN (cpu) = @cpu@_engine_run_full;
+  CPU_FAST_ENGINE_FN (cpu) = @prefix@_engine_run_full;
 #endif
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sim-model.scm @cpu@ vs @prefix@ confusion
  2009-08-25  0:38 sim-model.scm @cpu@ vs @prefix@ confusion Dave Korn
@ 2009-08-25  5:41 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2009-08-25  5:41 UTC (permalink / raw)
  To: Dave Korn; +Cc: cgen

Dave Korn wrote:
>     Hi CGEN,
>
>   It looks to me like there are a couple of spots in -gen-mach-defns where the
>  prefix should be used instead of the cpu, specifically when referencing
> *_INSN__MAX and in the names of the *_engine_run_* functions.  Certainly
> that's how genmloop.sh and friends expect them to look.  I had to apply the
> attached patch otherwise I get undefined references in the generated mloop.c,
> so here it is.
>
> cgen/ChangeLog:
>
> 	* sim-model.scm (-gen-mach-defns): Replace @cpu@ and @CPU@ by @prefix@
> 	and @PREFIX@ when setting CPU_MAX_INSNS and the CPU_*_ENGINE_FNs.
>
>   I'm not sure about the relation between cpu and prefix yet, but in my
> generated files the prefix appears to be a concatenation of isa and cpu.
> Maybe in other ports the prefix ends up just being equal to the cpu and that's
> why this hasn't caused any problems in /src?  I didn't investigate yet.
>
>     cheers,
>       DaveK
>
>   

Thanks for the patch!
I looked into this and you are correct.
I'll apply the patch tomorrow.

For reference sake, prefix is set here in src/sim/common/cgen.sh.  This 
explains where <cpu>_<isa> is coming from.

if test -z "$isa" ; then
  isa=all
  prefix=$cpu
else
  prefix=${cpu}_$isa
fi

[Seems like the test should be $isa == "" || $isa == "all", but that's 
another patch.]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-25  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-25  0:38 sim-model.scm @cpu@ vs @prefix@ confusion Dave Korn
2009-08-25  5:41 ` Doug Evans

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).