This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
- To: cgen at sourceware dot cygnus dot com
- Subject: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
- From: Greg McGary <greg at mcgary dot org>
- Date: Tue, 14 Nov 2000 13:39:49 -0700
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