This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: macros in .md files
On Tue, Oct 17, 2000 at 03:22:15PM -0700, Jim Wilson wrote:
> In article <10010172154.AA22433@vlsi1.ultra.nyu.edu> you write:
> >The facility already exists for a target to have its MD file passed
> >through CPP. See md_cppflags in configure.in.
>
> The sparc port used to use this. I hated it. I don't know how many
> times I added a comment, and then had to re-edit it to change
> "can't" to "can not" or make some other similarly silly change.
>
> While the idea of having macros has some merit, I'd disagree that
> using cpp is a good idea. Anything that tries to pass non-C code
> through the C preprocessor is fundamentally broken.
Thank you, Jim. I couldn't agree more.
I haven't done much md-file hacking, but a simple preprocessing
facility does seem like a good idea. Since md-files look like lisp, I
think it should be similar to the macro facilities in Common Lisp or
Scheme.
Joern's sample implementation looks decent as a first draft. I'd
suggest a few changes:
1: (defmacro NAME REPLACMENT) instead of (#define NAME REPLACEMENT),
to make it perfectly clear that this is not the C preprocessor.
2: Have REPLACEMENT be an rtx, not a text string. Therefore it must
be well-formed RTL. (defmacro NAME 42) should still work fine.
I'd also suggest that (include "FILENAME") and (scan_if EXPR ... ) be
implemented before anyone bothers with functional macros.
zw