public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
@ 2000-11-14 12:40 Greg McGary
  2000-11-14 16:29 ` Ben Elliston
  0 siblings, 1 reply; 17+ messages in thread
From: Greg McGary @ 2000-11-14 12:40 UTC (permalink / raw)
  To: cgen

sim/configure sets sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1" by
default, so sim compilations get -DPROFILE=1.

i960-desc.c, as generated by CGEN, contains this code:

------------------------------------------------------------------------------
...
#define A(a) (1 << CONCAT2 (CGEN_HW_,a))

const CGEN_HW_ENTRY i960_cgen_hw_table[] =
{
...
  { "h-pc", HW_H_PC, CGEN_ASM_NONE, 0, { 0|A(PROFILE)|A(PC), { (1<<MACH_BASE) } } },
  { "h-gr", HW_H_GR, CGEN_ASM_KEYWORD, (PTR) & i960_cgen_opval_h_gr, { 0|A(CACHE_ADDR)|A(PROFILE), { (1<<MACH_BASE) } } },
  { "h-cc", HW_H_CC, CGEN_ASM_KEYWORD, (PTR) & i960_cgen_opval_h_cc, { 0|A(CACHE_ADDR)|A(PROFILE), { (1<<MACH_BASE) } } },
  { 0, 0, CGEN_ASM_NONE, 0, {0, {0}} }
};
...
------------------------------------------------------------------------------

Now, A(PROFILE) erroneously expands to (1 << CGEN_HW_1) rather than
the intended (1 << CGEN_HW_PROFILE).

I see a couple solutions, and will provide a patch for whichever the
maintainers prefer:

1) fix desc-cpu.scm to no longer define & use A(x), but rather generate
   (1<<CGEN_HW_x) in-line.  Same for other definitions & uses of shorthand A(x).
2) shift an underscore from the definition of A(x) and into the arg,
   like so:
	#define A(a) (1 << CONCAT2 (CGEN_HW,a))
	use: A(_PROFILE)

I prefer (1) as the only reliable solution.  (2) is still subject to
A's argument being predefined.

Greg

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

end of thread, other threads:[~2000-11-20 11:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-14 12:40 sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute Greg McGary
2000-11-14 16:29 ` Ben Elliston
2000-11-14 17:18   ` Doug Evans
2000-11-15 11:56     ` Greg McGary
2000-11-15 12:06       ` Frank Ch. Eigler
2000-11-15 12:54         ` Greg McGary
2000-11-15 14:34           ` Doug Evans
2000-11-15 14:53           ` Frank Ch. Eigler
2000-11-15 15:28             ` Greg McGary
2000-11-20 11:17               ` Copyright assignment Frank Ch. Eigler
2000-11-15 15:32             ` sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute Ben Elliston
2000-11-15 15:35               ` Greg McGary
2000-11-15 16:03                 ` Doug Evans
2000-11-15 17:06                   ` Greg McGary
2000-11-15 17:15                     ` Greg McGary
2000-11-15 12:24       ` Doug Evans
2000-11-15 12:31     ` Frank Ch. Eigler

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