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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Ben Elliston @ 2000-11-14 16:29 UTC (permalink / raw)
  To: Greg McGary; +Cc: cgen

Hi Greg,

   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'd prefer to see #1.  Macros are bad, m'kay?

Ben

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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:31     ` Frank Ch. Eigler
  0 siblings, 2 replies; 17+ messages in thread
From: Doug Evans @ 2000-11-14 17:18 UTC (permalink / raw)
  To: Ben Elliston; +Cc: Greg McGary, cgen

Ben Elliston writes:
 > Hi Greg,
 > 
 >    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).

I like the readability that the use of A() and others of its ilk adds.

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

[pedantic: _[A-Z]* is owned of compiler]

 > I'd prefer to see #1.  Macros are bad, m'kay?

Like anything they need to be used with care.
The opc.c files are more readable [to me] with the macros.

An alternative is to rename CGEN_{FOO}_{ATTRIBUTE} to
CGEN_{FOO}_A_{ATTRIBUTE}.  Having attributes named like
CGEN_INSN_RELAXABLE kinda bothered me anyway, whereas
I much more like CGEN_INSN_A_RELAXABLE [or s/_A_/_ATTR_/].

On the other hand, another useful clean up is the whole
attribute definition scheme.  Note that CGEN_{FOO}_{ATTRIBUTE}
needn't have the same value across ports.  There's a kludgey
mechanism to support having attributes that you want to have
the same value across ports.  Generally it makes sense to
have all predefined target-independent attributes have the same value
[by `value' I mean "p/d CGEN_{FOO}_{ATTRIBUTE}" in a gdb session
would print the same number].

I think we should pick a direction _before_ deciding on a bandaid
[assuming one doesn't want to bite off the whole enchilada right away].
For the time being, if a fix is needed sooner rather than later is
there a patch that can be done to the i960 simulator?
(if we're going to have a bandaid, let's localize it as much as possible)

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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:24       ` Doug Evans
  2000-11-15 12:31     ` Frank Ch. Eigler
  1 sibling, 2 replies; 17+ messages in thread
From: Greg McGary @ 2000-11-15 11:56 UTC (permalink / raw)
  To: Doug Evans; +Cc: Ben Elliston, cgen

Doug Evans <dje@transmeta.com> writes:

>  >    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).
> 
> I like the readability that the use of A() and others of its ilk adds.

You *can* have that *if* A() uses `##' directly rather than via CONCAT2.
The extra level of expansion allows the PROFILE -> 1 substitution.

There is a third solution solution:

3) Define A like so (e.g., for _HW_):

#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define A(a) (1 << CGEN_HW_##a)
#else
#define A(a) (1 << CGEN_HW_/**/a)
#endif

This replaces the shorter, more attractive, but dangerous definition:

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

> [pedantic: _[A-Z]* is owned of compiler]

Agreed.  It wasn't a real solution anyway...

> An alternative is to rename CGEN_{FOO}_{ATTRIBUTE} to
> CGEN_{FOO}_A_{ATTRIBUTE}.  Having attributes named like
> CGEN_INSN_RELAXABLE kinda bothered me anyway, whereas
> I much more like CGEN_INSN_A_RELAXABLE [or s/_A_/_ATTR_/].

How does this address the original problem?

> For the time being, if a fix is needed sooner rather than later is
> there a patch that can be done to the i960 simulator?
> (if we're going to have a bandaid, let's localize it as much as possible)

There's no rush.  One can sidestep by configuring with `--disable-sim-profile'.

Note that this is a generic problem, and not specific to i960.  Many
CPUs have `-DPROFILE=1' by default in sim/*/configure, and many CGEN
cpu descriptions have have a PROFILE attribute.

Greg

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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 12:24       ` Doug Evans
  1 sibling, 1 reply; 17+ messages in thread
From: Frank Ch. Eigler @ 2000-11-15 12:06 UTC (permalink / raw)
  To: Greg McGary; +Cc: cgen

Hi -

On Wed, Nov 15, 2000 at 12:56:30PM -0700, Greg McGary wrote:
: [...]
: There is a third solution solution:
: 3) Define A like so (e.g., for _HW_):
: 
: #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
: #define A(a) (1 << CGEN_HW_##a)
: #else
: #define A(a) (1 << CGEN_HW_/**/a)
: #endif

Thanks, that's a neat way to solve the problem.  (There is some precedent
elsewhere in the toolchain for assuming ANSI compliance in compilers,
so the non-## case may not even be needed any more.)

If you send a patch (see cgen/desc-cpu.scm and opc-itab.scm), you can get
your name into the ChangeLog.

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6EuyYVZbdDOm/ZT0RAmj0AJ93J23eqmdhooS7mfVAl7aQD7cbjgCfW9Xc
5QSY3pr1188n8AeDfkFLYgc=
=KmIK
-----END PGP SIGNATURE-----

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 11:56     ` Greg McGary
  2000-11-15 12:06       ` Frank Ch. Eigler
@ 2000-11-15 12:24       ` Doug Evans
  1 sibling, 0 replies; 17+ messages in thread
From: Doug Evans @ 2000-11-15 12:24 UTC (permalink / raw)
  To: Greg McGary; +Cc: Ben Elliston, cgen

Greg McGary writes:
 > There is a third solution solution:
 > 
 > 3) Define A like so (e.g., for _HW_):
 > 
 > #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 > #define A(a) (1 << CGEN_HW_##a)
 > #else
 > #define A(a) (1 << CGEN_HW_/**/a)
 > #endif

Ah, indeed.

 > > An alternative is to rename CGEN_{FOO}_{ATTRIBUTE} to
 > > CGEN_{FOO}_A_{ATTRIBUTE}.  Having attributes named like
 > > CGEN_INSN_RELAXABLE kinda bothered me anyway, whereas
 > > I much more like CGEN_INSN_A_RELAXABLE [or s/_A_/_ATTR_/].
 > 
 > How does this address the original problem?

because you then use A(ATTR_PROFILE).  I agree the problem is still
there but much less so.

 > Note that this is a generic problem, and not specific to i960.  Many
 > CPUs have `-DPROFILE=1' by default in sim/*/configure, and many CGEN
 > cpu descriptions have have a PROFILE attribute.

In a way, yes, but it only hits the i960 because the others
have their desc.c/opc.c files built in the opcodes dir.
[pedantic: it's still a problem that needs a general solution]

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-14 17:18   ` Doug Evans
  2000-11-15 11:56     ` Greg McGary
@ 2000-11-15 12:31     ` Frank Ch. Eigler
  1 sibling, 0 replies; 17+ messages in thread
From: Frank Ch. Eigler @ 2000-11-15 12:31 UTC (permalink / raw)
  To: Doug Evans; +Cc: Greg McGary, cgen

Hi -

On Tue, Nov 14, 2000 at 05:17:34PM -0800, Doug Evans wrote:
: [...]
: On the other hand, another useful clean up is the whole
: attribute definition scheme.  Note that CGEN_{FOO}_{ATTRIBUTE}
: needn't have the same value across ports.  [...]

Right.  It would be nice to add enough metadata to this so that
files for multiple targets can be generated, linked together,
and analyzed by target-independent logic.

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6EvKIVZbdDOm/ZT0RArCCAJ0RgQU/pKnNHnykGzTvlCmnubL5gwCfTaGp
iyrHzZ024YrnjRUGxx+8n8Q=
=Zfd8
-----END PGP SIGNATURE-----

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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
  0 siblings, 2 replies; 17+ messages in thread
From: Greg McGary @ 2000-11-15 12:54 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: cgen

"Frank Ch. Eigler" <fche@redhat.com> writes:

> On Wed, Nov 15, 2000 at 12:56:30PM -0700, Greg McGary wrote:
> : #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
> : #define A(a) (1 << CGEN_HW_##a)
> : #else
> : #define A(a) (1 << CGEN_HW_/**/a)
> : #endif
> 
> Thanks, that's a neat way to solve the problem.  (There is some precedent
> elsewhere in the toolchain for assuming ANSI compliance in compilers,
> so the non-## case may not even be needed any more.)

OK.  I'd rather assume ANSI.  If it ever becomes a bootstrap issue, we
can fix it then.  I don't foresee that it can cause bootstrap problems
until CGEN output becomes part of GCC.

I left these two alone, since XCONCAT* means that the caller wants
args to be expanded prior to concatenation (though the extra expansion
is already provided by defining SEM_FN_NAME() as an intermediate):

sem.c:#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_semf_,fn)
sem.c:#define SEM_FN_NAME(cpu,fn) XCONCAT3 (cpu,_sem_,fn)


> If you send a patch (see cgen/desc-cpu.scm and opc-itab.scm), you can get
> your name into the ChangeLog.

Yippee!  Everlasting fame!  8^)

FYI, I plan to do more CGEN hacking in the coming weeks & months.  I'd
like to get write-after-approval permission on the CVS repo.  Is that
agreeable?  With whom should I set it up?  I already have an account
`gkm@sourceware.cygnus.com' for GCC, and executed an assignment of all
future changes for GCC/gas/ld/binutils several years ago.  Are sim & cgen
considered part of binutils for copyright assignment purposes, or must
I execute a new assignment?

(Tested minimally by building sim for i960)

2000-11-15  Greg McGary  <greg@mcgary.org>

	* desc-cpu.scm (gen-ifld-defns, gen-hw-table-defns,
	-gen-hash-defines, gen-operand-table, gen-insn-table):
	Replace CONCAT[23] with inline concatination via `##'.
	* opc-itab.scm (-gen-ifmt-table, -gen-insn-opcode-table,
	-gen-macro-insn-table): Likewise.
	* opc-opinst.scm (-gen-operand-instance-tables): Likewise.

Index: desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.2
diff -u -p -r1.2 desc-cpu.scm
--- desc-cpu.scm	2000/10/02 19:13:53	1.2
+++ desc-cpu.scm	2000/11/15 20:31:05
@@ -135,7 +135,7 @@ static const CGEN_MACH @arch@_cgen_mach_
      "\
 /* The instruction field table.  */
 
-#define A(a) (1 << CONCAT2 (CGEN_IFLD_,a))
+#define A(a) (1 << CGEN_IFLD_##a)
 
 const CGEN_IFLD @arch@_cgen_ifld_table[] =
 {
@@ -251,7 +251,7 @@ const CGEN_IFLD @arch@_cgen_ifld_table[]
 
 /* The hardware table.  */
 
-#define A(a) (1 << CONCAT2 (CGEN_HW_,a))
+#define A(a) (1 << CGEN_HW_##a)
 
 const CGEN_HW_ENTRY @arch@_cgen_hw_table[] =
 {
@@ -294,7 +294,7 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
   (string-list
    "#define CGEN_ARCH @arch@\n\n"
    "/* Given symbol S, return @arch@_cgen_<S>.  */\n"
-   "#define CGEN_SYM(s) CONCAT3 (@arch@,_cgen_,s)\n\n"
+   "#define CGEN_SYM(s) @arch@##_cgen_##s\n\n"
    "/* Selected cpu families.  */\n"
    ; FIXME: Move to sim's arch.h.
    (string-map (lambda (cpu)
@@ -384,8 +384,8 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
      "\
 /* The operand table.  */
 
-#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a))
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
+#define A(a) (1 << CGEN_OPERAND_##a)
+#define OPERAND(op) @ARCH@_OPERAND_##op
 
 const CGEN_OPERAND @arch@_cgen_operand_table[] =
 {
@@ -478,7 +478,7 @@ const CGEN_OPERAND @arch@_cgen_operand_t
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#define A(a) (1 << CGEN_INSN_##a)
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The instruction table.  */
Index: opc-itab.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-itab.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-itab.scm
--- opc-itab.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-itab.scm	2000/11/15 20:31:05
@@ -214,7 +214,7 @@
 (define (-gen-ifmt-table)
   (string-write
    "/* Instruction formats.  */\n\n"
-   "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+   "#define F(f) & @arch@_cgen_ifld_table[@ARCH@_##f]\n\n"
    (string-list-map -gen-ifmt-table-1 (current-ifmt-list))
    "#undef F\n\n"
    )
@@ -351,9 +351,9 @@
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#define A(a) (1 << CGEN_INSN_##a)
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
+#define OPERAND(op) @ARCH@_OPERAND_##op
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The instruction table.  */
@@ -549,7 +549,7 @@ static unsigned int dis_hash_insn PARAMS
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
      "/* Formats for ALIAS macro-insns.  */\n\n"
-     "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+     "#define F(f) & @arch@_cgen_ifld_table[@ARCH@_##f]\n\n"
      (lambda ()
        (string-write-map -gen-ifmt-table-1
 			 (map insn-ifmt (find (lambda (minsn)
@@ -569,9 +569,9 @@ static unsigned int dis_hash_insn PARAMS
 				"  { 0, 0 }\n};\n\n")))
 			 minsn-list))
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#define A(a) (1 << CGEN_INSN_##a)
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
+#define OPERAND(op) @ARCH@_OPERAND_##op
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The macro instruction table.  */
Index: opc-opinst.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-opinst.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-opinst.scm
--- opc-opinst.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-opinst.scm	2000/11/15 20:31:05
@@ -66,7 +66,7 @@
 #define OUTPUT CGEN_OPINST_OUTPUT
 #define END CGEN_OPINST_END
 #define COND_REF CGEN_OPINST_COND_REF
-#define OP_ENT(op) CONCAT2 (@ARCH@_OPERAND_,op)
+#define OP_ENT(op) @ARCH@_OPERAND_##op
 
 "
    (lambda () (string-write-map -gen-operand-instance-table (current-sfmt-list)))

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 12:54         ` Greg McGary
@ 2000-11-15 14:34           ` Doug Evans
  2000-11-15 14:53           ` Frank Ch. Eigler
  1 sibling, 0 replies; 17+ messages in thread
From: Doug Evans @ 2000-11-15 14:34 UTC (permalink / raw)
  To: Greg McGary; +Cc: Frank Ch. Eigler, cgen

Greg McGary writes:
 > OK.  I'd rather assume ANSI.  If it ever becomes a bootstrap issue, we
 > can fix it then.  I don't foresee that it can cause bootstrap problems
 > until CGEN output becomes part of GCC.

Has binutils been declared ANSI-only compilable?

[pedantic: for cross-compilation, e.g. embedded ports, e.g. most/all
current cgen ports, that's ok.  I'm thinking about situations like
a native sparc port.]

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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-15 15:32             ` sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute Ben Elliston
  1 sibling, 2 replies; 17+ messages in thread
From: Frank Ch. Eigler @ 2000-11-15 14:53 UTC (permalink / raw)
  To: Greg McGary; +Cc: cgen

Hi -

On Wed, Nov 15, 2000 at 01:54:11PM -0700, Greg McGary wrote:
: > If you send a patch (see cgen/desc-cpu.scm and opc-itab.scm), you can get
: > your name into the ChangeLog.
: 
: Yippee!  Everlasting fame!  8^)

.. and then some.


: FYI, I plan to do more CGEN hacking in the coming weeks & months.  I'd
: like to get write-after-approval permission on the CVS repo.  [...]

I'm not opposed - perhaps after a later batch of patches?
(You already have physical access to the repository that includes cgen.)


: [...]  Are sim & cgen considered part of binutils for copyright assignment
: purposes, or must I execute a new assignment?

sim is considered part of gdb for copyright; if that's already covered, fine.
cgen is (C) Red Hat, so a separate assignment/disclaimer will be needed.


: (Tested minimally by building sim for i960)
: 
: 2000-11-15  Greg McGary  <greg@mcgary.org>
: 
: 	* desc-cpu.scm (gen-ifld-defns, gen-hw-table-defns,
: 	-gen-hash-defines, gen-operand-table, gen-insn-table):
: 	Replace CONCAT[23] with inline concatination via `##'.
: 	* opc-itab.scm (-gen-ifmt-table, -gen-insn-opcode-table,
: 	-gen-macro-insn-table): Likewise.
: 	* opc-opinst.scm (-gen-operand-instance-tables): Likewise.
: [...]

Let's hold off on this actually until the question of dependence
of binutils on ANSI C is cleared up.  Can you raise it in
binutils@sources.redhat.com?


- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6ExPIVZbdDOm/ZT0RAm6pAJ0eDUxtZSnFdaWvqnBhGy00MoXpZgCdGF7h
OiesKG5DGUn2tFQ1unnodRg=
=EFfp
-----END PGP SIGNATURE-----

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Greg McGary @ 2000-11-15 15:28 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: cgen

"Frank Ch. Eigler" <fche@redhat.com> writes:

> I'm not opposed - perhaps after a later batch of patches?

Whenever you like.

> sim is considered part of gdb for copyright; if that's already covered, fine.

Yes, I assigned future gdb changes as well--forgot to mention that one

> cgen is (C) Red Hat, so a separate assignment/disclaimer will be needed.

Can you direct me to the document?  The only reference I find to
copyright assignment on sources.redhat.com is for eCos.

> Let's hold off on this actually until the question of dependence
> of binutils on ANSI C is cleared up.  Can you raise it in
> binutils@sources.redhat.com?

Sure, will do.

Greg

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 14:53           ` Frank Ch. Eigler
  2000-11-15 15:28             ` Greg McGary
@ 2000-11-15 15:32             ` Ben Elliston
  2000-11-15 15:35               ` Greg McGary
  1 sibling, 1 reply; 17+ messages in thread
From: Ben Elliston @ 2000-11-15 15:32 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: Greg McGary, cgen

   : FYI, I plan to do more CGEN hacking in the coming weeks & months.  I'd
   : like to get write-after-approval permission on the CVS repo.  [...]

   I'm not opposed - perhaps after a later batch of patches?
   (You already have physical access to the repository that includes cgen.)

I'm not sure what the concern is -- we're able to check patches in for you.

   Let's hold off on this actually until the question of dependence of
   binutils on ANSI C is cleared up.  Can you raise it in
   binutils@sources.redhat.com?

Heh -- good luck.  I raised this last year and was met with fierce
opposition.  It's the old bootstrapping argument.

Ben

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Greg McGary @ 2000-11-15 15:35 UTC (permalink / raw)
  To: Ben Elliston; +Cc: Frank Ch. Eigler, cgen

Ben Elliston <bje@redhat.com> writes:

>    I'm not opposed - perhaps after a later batch of patches?
>    (You already have physical access to the repository that includes cgen.)
> 
> I'm not sure what the concern is -- we're able to check patches in for you.

No big concern.  Have it your way.

>    Let's hold off on this actually until the question of dependence of
>    binutils on ANSI C is cleared up.  Can you raise it in
>    binutils@sources.redhat.com?
> 
> Heh -- good luck.  I raised this last year and was met with fierce
> opposition.  It's the old bootstrapping argument.

I don't suppose things have changed all that much in a year.
I'll just redo the patch the ugly way and resubmit.

Greg

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 15:35               ` Greg McGary
@ 2000-11-15 16:03                 ` Doug Evans
  2000-11-15 17:06                   ` Greg McGary
  0 siblings, 1 reply; 17+ messages in thread
From: Doug Evans @ 2000-11-15 16:03 UTC (permalink / raw)
  To: Greg McGary; +Cc: Ben Elliston, Frank Ch. Eigler, cgen

Greg McGary writes:
 > > Heh -- good luck.  I raised this last year and was met with fierce
 > > opposition.  It's the old bootstrapping argument.
 > 
 > I don't suppose things have changed all that much in a year.
 > I'll just redo the patch the ugly way and resubmit.

There is a way to clean it up a teensy bit.
Tuck all the random ifdef crud in one macro and then have cgen use
that macro.

something like

#if defined (__STDC__) || blah ...
#define CGEN_HAVE_STRINGIZE 1
#else
#define CGEN_HAVE_STRINGIZE 0
#endif

You might even throw that in include/opcodes/cgen.h.

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 16:03                 ` Doug Evans
@ 2000-11-15 17:06                   ` Greg McGary
  2000-11-15 17:15                     ` Greg McGary
  0 siblings, 1 reply; 17+ messages in thread
From: Greg McGary @ 2000-11-15 17:06 UTC (permalink / raw)
  To: Doug Evans; +Cc: Ben Elliston, Frank Ch. Eigler, cgen

Doug Evans <dje@transmeta.com> writes:

> There is a way to clean it up a teensy bit.
> Tuck all the random ifdef crud in one macro and then have cgen use
> that macro.
> 
> something like
> 
> #if defined (__STDC__) || blah ...
> #define CGEN_HAVE_STRINGIZE 1
> #else
> #define CGEN_HAVE_STRINGIZE 0
> #endif
> 
> You might even throw that in include/opcodes/cgen.h.

IMO, it's better done in symcat.h, which should be responsible for
all things related to symbol concatenation, including defining the
convenience symbol.  I'd rather save that for later, so as not to
expand this patch beyond the scope of CGEN.

Here's a new patch:

2000-11-15  Greg McGary  <greg@mcgary.org>

	* utils-cgen.scm (gen-define-with-symcat): New function.
	* desc-cpu.scm (gen-ifld-defns): Use it.
	(gen-hw-table-defns): Use it.
	(-gen-hash-defines): Use it.
	(gen-operand-table): Use it.
	(gen-insn-table): Use it.  Remove spurious `#undef MNEM'.
	* opc-itab.scm (-gen-ifmt-table): Use it.
	(-gen-insn-opcode-table): Use it.
	(-gen-macro-insn-table): Use it.
	* opc-opinst.scm (-gen-operand-instance-tables): Use it.
	* sim-cpu.scm (cgen-semantics.c): Use it.
	(cgen-sem-switch.c): Use it.

Index: utils-cgen.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-cgen.scm,v
retrieving revision 1.2
diff -u -p -r1.2 utils-cgen.scm
--- utils-cgen.scm	2000/10/13 11:21:57	1.2
+++ utils-cgen.scm	2000/11/16 01:04:48
@@ -636,3 +636,26 @@ Mark an entry as being sanitized.
 
   *UNSPECIFIED*
 )
+
+; Return a pair of definitions for a C macro that concatenates its
+; argument symbols.  The definitions are conditional on ANSI C
+; semantics: one contains ANSI concat operators (##), and the other
+; uses the empty-comment trick (/**/).  We must do this, rather than
+; use CONCATn(...) as defined in include/symcat.h, in order to avoid
+; spuriously expanding our macro's args.
+
+(define (gen-define-with-symcat head . args)
+  (string-append
+   "\
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+"
+   head (string-map (lambda (elm) (string-append "##" elm)) args)
+   "
+#else
+"
+   head (string-map (lambda (elm) (string-append "/**/" elm)) args)
+   "
+#endif
+"
+   )
+)
Index: desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.2
diff -u -p -r1.2 desc-cpu.scm
--- desc-cpu.scm	2000/10/02 19:13:53	1.2
+++ desc-cpu.scm	2000/11/16 01:04:40
@@ -132,11 +132,12 @@ static const CGEN_MACH @arch@_cgen_mach_
 	 (all-attrs (current-ifld-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-list
-     "\
+     "
 /* The instruction field table.  */
-
-#define A(a) (1 << CONCAT2 (CGEN_IFLD_,a))
 
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_IFLD_" "a)")
+     "
 const CGEN_IFLD @arch@_cgen_ifld_table[] =
 {
 "
@@ -248,11 +249,11 @@ const CGEN_IFLD @arch@_cgen_ifld_table[]
      (string-list-map gen-defn (current-kw-list))
      (string-list-map -gen-hw-defn (current-hw-list))
      "
-
 /* The hardware table.  */
 
-#define A(a) (1 << CONCAT2 (CGEN_HW_,a))
-
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_HW_" "a)")
+     "
 const CGEN_HW_ENTRY @arch@_cgen_hw_table[] =
 {
 "
@@ -294,8 +295,8 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
   (string-list
    "#define CGEN_ARCH @arch@\n\n"
    "/* Given symbol S, return @arch@_cgen_<S>.  */\n"
-   "#define CGEN_SYM(s) CONCAT3 (@arch@,_cgen_,s)\n\n"
-   "/* Selected cpu families.  */\n"
+   (gen-define-with-symcat "CGEN_SYM(s) @arch@" "_cgen_" "s")
+   "\n\n/* Selected cpu families.  */\n"
    ; FIXME: Move to sim's arch.h.
    (string-map (lambda (cpu)
 		 (gen-obj-sanitize cpu
@@ -381,12 +382,13 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
   (let* ((all-attrs (current-op-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-list
-     "\
+     "
 /* The operand table.  */
-
-#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a))
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_OPERAND_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
+"
 const CGEN_OPERAND @arch@_cgen_operand_table[] =
 {
 "
@@ -477,12 +479,13 @@ const CGEN_OPERAND @arch@_cgen_operand_t
   (let* ((all-attrs (current-insn-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
-     "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
-#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
-
+     "
 /* The instruction table.  */
 
+#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+"
 static const CGEN_IBASE @arch@_cgen_insn_table[MAX_INSNS] =
 {
   /* Special null first entry.
@@ -499,9 +502,8 @@ static const CGEN_IBASE @arch@_cgen_insn
      "\
 };
 
-#undef A
-#undef MNEM
 #undef OP
+#undef A
 
 "
      )
Index: opc-itab.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-itab.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-itab.scm
--- opc-itab.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-itab.scm	2000/11/16 01:04:43
@@ -214,7 +214,7 @@
 (define (-gen-ifmt-table)
   (string-write
    "/* Instruction formats.  */\n\n"
-   "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+   (gen-define-with-symcat "F(f) & @arch@_cgen_ifld_table[@ARCH@_" "f]\n\n")
    (string-list-map -gen-ifmt-table-1 (current-ifmt-list))
    "#undef F\n\n"
    )
@@ -350,10 +350,10 @@
   (let* ((all-attrs (current-insn-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The instruction table.  */
@@ -376,8 +376,8 @@ static const CGEN_OPCODE @arch@_cgen_ins
 };
 
 #undef A
-#undef MNEM
 #undef OPERAND
+#undef MNEM
 #undef OP
 
 "
@@ -549,7 +549,7 @@ static unsigned int dis_hash_insn PARAMS
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
      "/* Formats for ALIAS macro-insns.  */\n\n"
-     "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+     (gen-define-with-symcat "F(f) & @arch@_cgen_ifld_table[@ARCH@_" "f]\n\n")
      (lambda ()
        (string-write-map -gen-ifmt-table-1
 			 (map insn-ifmt (find (lambda (minsn)
@@ -568,10 +568,10 @@ static unsigned int dis_hash_insn PARAMS
 					    (minsn-expansions minsn))
 				"  { 0, 0 }\n};\n\n")))
 			 minsn-list))
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The macro instruction table.  */
@@ -606,8 +606,8 @@ static const CGEN_OPCODE @arch@_cgen_mac
 };
 
 #undef A
-#undef MNEM
 #undef OPERAND
+#undef MNEM
 #undef OP
 \n"
     ))
Index: opc-opinst.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-opinst.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-opinst.scm
--- opc-opinst.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-opinst.scm	2000/11/16 01:04:43
@@ -62,20 +62,22 @@
    "\
 /* Operand references.  */
 
+"
+   (gen-define-with-symcat "OP_ENT(op) @ARCH@_OPERAND_" "op")
+"\
 #define INPUT CGEN_OPINST_INPUT
 #define OUTPUT CGEN_OPINST_OUTPUT
 #define END CGEN_OPINST_END
 #define COND_REF CGEN_OPINST_COND_REF
-#define OP_ENT(op) CONCAT2 (@ARCH@_OPERAND_,op)
 
 "
    (lambda () (string-write-map -gen-operand-instance-table (current-sfmt-list)))
    "\
+#undef OP_ENT
 #undef INPUT
 #undef OUTPUT
 #undef END
 #undef COND_REF
-#undef OP_ENT
 
 "
    )
Index: sim-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/sim-cpu.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sim-cpu.scm
--- sim-cpu.scm	2000/07/28 04:11:52	1.1.1.1
+++ sim-cpu.scm	2000/11/16 01:04:47
@@ -1001,9 +1001,10 @@ void
 #include \"cgen-ops.h\"
 
 #undef GET_ATTR
-#define GET_ATTR(cpu, num, attr) \
-CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
-
+"
+   (gen-define-with-symcat "GET_ATTR(cpu, num, attr) \
+CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_" "attr)")
+"
 /* This is used so that we can compile two copies of the semantic code,
    one with full feature support and one without that runs fast(er).
    FAST_P, when desired, is defined on the command line, -DFAST_P=1.  */
@@ -1112,9 +1113,10 @@ CGEN_ATTR_VALUE (NULL, abuf->idesc->attr
 #endif
 
 #undef GET_ATTR
-#define GET_ATTR(cpu, num, attr) \
-CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
-
+"
+   (gen-define-with-symcat "GET_ATTR(cpu, num, attr) \
+CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_" "attr)")
+"
 {
 
 #if WITH_SCACHE_PBB

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

* Re: sim's -DPROFILE=1 conflicts with CGEN's PROFILE attribute
  2000-11-15 17:06                   ` Greg McGary
@ 2000-11-15 17:15                     ` Greg McGary
  0 siblings, 0 replies; 17+ messages in thread
From: Greg McGary @ 2000-11-15 17:15 UTC (permalink / raw)
  To: Doug Evans; +Cc: Ben Elliston, Frank Ch. Eigler, cgen

Greg McGary <greg@mcgary.org> writes:

> Index: utils-cgen.scm

This part of the diff I just posted was stale.

Here's a diff of the diffs:

@@ -283,11 +284,11 @@
 +  (string-append
 +   "\
 +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
-+"
++#define "
 +   head (string-map (lambda (elm) (string-append "##" elm)) args)
 +   "
 +#else
-+"
++#define "
 +   head (string-map (lambda (elm) (string-append "/**/" elm)) args)
 +   "
 +#endif


Here's the whole thing again:

Index: utils-cgen.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-cgen.scm,v
retrieving revision 1.2
diff -u -p -r1.2 utils-cgen.scm
--- utils-cgen.scm	2000/10/13 11:21:57	1.2
+++ utils-cgen.scm	2000/11/16 01:14:19
@@ -636,3 +636,26 @@ Mark an entry as being sanitized.
 
   *UNSPECIFIED*
 )
+
+; Return a pair of definitions for a C macro that concatenates its
+; argument symbols.  The definitions are conditional on ANSI C
+; semantics: one contains ANSI concat operators (##), and the other
+; uses the empty-comment trick (/**/).  We must do this, rather than
+; use CONCATn(...) as defined in include/symcat.h, in order to avoid
+; spuriously expanding our macro's args.
+
+(define (gen-define-with-symcat head . args)
+  (string-append
+   "\
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define "
+   head (string-map (lambda (elm) (string-append "##" elm)) args)
+   "
+#else
+#define "
+   head (string-map (lambda (elm) (string-append "/**/" elm)) args)
+   "
+#endif
+"
+   )
+)
Index: desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.2
diff -u -p -r1.2 desc-cpu.scm
--- desc-cpu.scm	2000/10/02 19:13:53	1.2
+++ desc-cpu.scm	2000/11/16 01:14:11
@@ -132,11 +132,12 @@ static const CGEN_MACH @arch@_cgen_mach_
 	 (all-attrs (current-ifld-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-list
-     "\
+     "
 /* The instruction field table.  */
-
-#define A(a) (1 << CONCAT2 (CGEN_IFLD_,a))
 
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_IFLD_" "a)")
+     "
 const CGEN_IFLD @arch@_cgen_ifld_table[] =
 {
 "
@@ -248,11 +249,11 @@ const CGEN_IFLD @arch@_cgen_ifld_table[]
      (string-list-map gen-defn (current-kw-list))
      (string-list-map -gen-hw-defn (current-hw-list))
      "
-
 /* The hardware table.  */
 
-#define A(a) (1 << CONCAT2 (CGEN_HW_,a))
-
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_HW_" "a)")
+     "
 const CGEN_HW_ENTRY @arch@_cgen_hw_table[] =
 {
 "
@@ -294,8 +295,8 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
   (string-list
    "#define CGEN_ARCH @arch@\n\n"
    "/* Given symbol S, return @arch@_cgen_<S>.  */\n"
-   "#define CGEN_SYM(s) CONCAT3 (@arch@,_cgen_,s)\n\n"
-   "/* Selected cpu families.  */\n"
+   (gen-define-with-symcat "CGEN_SYM(s) @arch@" "_cgen_" "s")
+   "\n\n/* Selected cpu families.  */\n"
    ; FIXME: Move to sim's arch.h.
    (string-map (lambda (cpu)
 		 (gen-obj-sanitize cpu
@@ -381,12 +382,13 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table
   (let* ((all-attrs (current-op-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-list
-     "\
+     "
 /* The operand table.  */
-
-#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a))
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_OPERAND_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
+"
 const CGEN_OPERAND @arch@_cgen_operand_table[] =
 {
 "
@@ -477,12 +479,13 @@ const CGEN_OPERAND @arch@_cgen_operand_t
   (let* ((all-attrs (current-insn-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
-     "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
-#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
-
+     "
 /* The instruction table.  */
 
+#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
+"
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+"
 static const CGEN_IBASE @arch@_cgen_insn_table[MAX_INSNS] =
 {
   /* Special null first entry.
@@ -499,9 +502,8 @@ static const CGEN_IBASE @arch@_cgen_insn
      "\
 };
 
-#undef A
-#undef MNEM
 #undef OP
+#undef A
 
 "
      )
Index: opc-itab.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-itab.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-itab.scm
--- opc-itab.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-itab.scm	2000/11/16 01:14:14
@@ -214,7 +214,7 @@
 (define (-gen-ifmt-table)
   (string-write
    "/* Instruction formats.  */\n\n"
-   "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+   (gen-define-with-symcat "F(f) & @arch@_cgen_ifld_table[@ARCH@_" "f]\n\n")
    (string-list-map -gen-ifmt-table-1 (current-ifmt-list))
    "#undef F\n\n"
    )
@@ -350,10 +350,10 @@
   (let* ((all-attrs (current-insn-attr-list))
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The instruction table.  */
@@ -376,8 +376,8 @@ static const CGEN_OPCODE @arch@_cgen_ins
 };
 
 #undef A
-#undef MNEM
 #undef OPERAND
+#undef MNEM
 #undef OP
 
 "
@@ -549,7 +549,7 @@ static unsigned int dis_hash_insn PARAMS
 	 (num-non-bools (attr-count-non-bools all-attrs)))
     (string-write
      "/* Formats for ALIAS macro-insns.  */\n\n"
-     "#define F(f) & @arch@_cgen_ifld_table[CONCAT2 (@ARCH@_,f)]\n\n"
+     (gen-define-with-symcat "F(f) & @arch@_cgen_ifld_table[@ARCH@_" "f]\n\n")
      (lambda ()
        (string-write-map -gen-ifmt-table-1
 			 (map insn-ifmt (find (lambda (minsn)
@@ -568,10 +568,10 @@ static unsigned int dis_hash_insn PARAMS
 					    (minsn-expansions minsn))
 				"  { 0, 0 }\n};\n\n")))
 			 minsn-list))
+     (gen-define-with-symcat "A(a) (1 << CGEN_INSN_" "a)")
+     (gen-define-with-symcat "OPERAND(op) @ARCH@_OPERAND_" "op")
      "\
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (@ARCH@_OPERAND_,op)
 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
 
 /* The macro instruction table.  */
@@ -606,8 +606,8 @@ static const CGEN_OPCODE @arch@_cgen_mac
 };
 
 #undef A
-#undef MNEM
 #undef OPERAND
+#undef MNEM
 #undef OP
 \n"
     ))
Index: opc-opinst.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-opinst.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 opc-opinst.scm
--- opc-opinst.scm	2000/07/28 04:11:52	1.1.1.1
+++ opc-opinst.scm	2000/11/16 01:14:14
@@ -62,20 +62,22 @@
    "\
 /* Operand references.  */
 
+"
+   (gen-define-with-symcat "OP_ENT(op) @ARCH@_OPERAND_" "op")
+"\
 #define INPUT CGEN_OPINST_INPUT
 #define OUTPUT CGEN_OPINST_OUTPUT
 #define END CGEN_OPINST_END
 #define COND_REF CGEN_OPINST_COND_REF
-#define OP_ENT(op) CONCAT2 (@ARCH@_OPERAND_,op)
 
 "
    (lambda () (string-write-map -gen-operand-instance-table (current-sfmt-list)))
    "\
+#undef OP_ENT
 #undef INPUT
 #undef OUTPUT
 #undef END
 #undef COND_REF
-#undef OP_ENT
 
 "
    )
Index: sim-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/sim-cpu.scm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sim-cpu.scm
--- sim-cpu.scm	2000/07/28 04:11:52	1.1.1.1
+++ sim-cpu.scm	2000/11/16 01:14:18
@@ -1001,9 +1001,10 @@ void
 #include \"cgen-ops.h\"
 
 #undef GET_ATTR
-#define GET_ATTR(cpu, num, attr) \
-CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
-
+"
+   (gen-define-with-symcat "GET_ATTR(cpu, num, attr) \
+CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_" "attr)")
+"
 /* This is used so that we can compile two copies of the semantic code,
    one with full feature support and one without that runs fast(er).
    FAST_P, when desired, is defined on the command line, -DFAST_P=1.  */
@@ -1112,9 +1113,10 @@ CGEN_ATTR_VALUE (NULL, abuf->idesc->attr
 #endif
 
 #undef GET_ATTR
-#define GET_ATTR(cpu, num, attr) \
-CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_##attr)
-
+"
+   (gen-define-with-symcat "GET_ATTR(cpu, num, attr) \
+CGEN_ATTR_VALUE (NULL, abuf->idesc->attrs, CGEN_INSN_" "attr)")
+"
 {
 
 #if WITH_SCACHE_PBB

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

* Copyright assignment
  2000-11-15 15:28             ` Greg McGary
@ 2000-11-20 11:17               ` Frank Ch. Eigler
  0 siblings, 0 replies; 17+ messages in thread
From: Frank Ch. Eigler @ 2000-11-20 11:17 UTC (permalink / raw)
  To: Greg McGary; +Cc: cgen

Hi -

On Wed, Nov 15, 2000 at 04:28:10PM -0700, Greg McGary wrote:
: [...]
: > cgen is (C) Red Hat, so a separate assignment/disclaimer will be needed.
: 
: Can you direct me to the document?  The only reference I find to
: copyright assignment on sources.redhat.com is for eCos.

For now, let's assume that the Source Navigator copyright
assignment/disclaimer form will be adequate (with the
appropriate substitution of the program name).  That form
is here:

	< http://sources.redhat.com/sourcenav/contrib.html >

I'll post more information (including a more appropriate postal
address for the form's return) shortly.

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6GXiqVZbdDOm/ZT0RAt+gAJ4xwG5eNQ+3qkJn36egJVZ4NxiQswCeOH5G
kOULkdEnDylKXfrdModilTU=
=MMiM
-----END PGP SIGNATURE-----

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