This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: SH: use register names instead of numbers
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Subject: Re: SH: use register names instead of numbers
- From: Joern Rennecke <amylaar at redhat dot com>
- Date: Wed, 22 Nov 2000 02:53:28 +0000 (GMT)
- Cc: amylaar at redhat dot com, gcc-patches at gcc dot gnu dot org
> + /* Called via traverse_md_constants; emit a #define for
> + the current constant definition. */
> + static int
> + print_md_constant (slot, info)
>
> This is missing a blank line.
Between the comment and the return type?
Should gen_insn_name get a blank line at this place then, too?
> + fprintf (file, "#define %s %s\n", def->name, def->value);
>
> I would recommend putting a prefix here, like MD_%s. Otherwise, you
> risk further namespace pollution. Since the main use is within the MD
> file, the name used in the .h file isn't that critical.
There are a lot of register number definitions in the tm.h files that
would best go into define_constants. So there is not really an extra
namespace pollutions, since definitions in tm.h are very visible, too.
Exporting the defines without a prefix makes it viable to do these
defines just once.
If you think there is also a good application for names that are less
visible, it is simple to add code to have an optional prefix, i.e.
(define_constants "MD_" [
(foo 0)
(bar 1)
])
Would give
#define MD_foo 0
#define MD_bar 1
We could also use the prefix "*" to indicate that no #defines should be
emitted.