xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/genmddump.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Generate code from machine description to recognize rtl as insns.
2*8feb0f0bSmrg    Copyright (C) 1987-2020 Free Software Foundation, Inc.
31debfc3dSmrg 
41debfc3dSmrg    This file is part of GCC.
51debfc3dSmrg 
61debfc3dSmrg    GCC is free software; you can redistribute it and/or modify it
71debfc3dSmrg    under the terms of the GNU General Public License as published by
81debfc3dSmrg    the Free Software Foundation; either version 3, or (at your option)
91debfc3dSmrg    any later version.
101debfc3dSmrg 
111debfc3dSmrg    GCC is distributed in the hope that it will be useful, but WITHOUT
121debfc3dSmrg    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
131debfc3dSmrg    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
141debfc3dSmrg    License for more details.
151debfc3dSmrg 
161debfc3dSmrg    You should have received a copy of the GNU General Public License
171debfc3dSmrg    along with GCC; see the file COPYING3.  If not see
181debfc3dSmrg    <http://www.gnu.org/licenses/>.  */
191debfc3dSmrg 
201debfc3dSmrg 
211debfc3dSmrg /* This program is used to produce tmp-mddump.md, which represents
221debfc3dSmrg    md-file with expanded iterators and after define_subst transformation
231debfc3dSmrg    is performed.
241debfc3dSmrg 
251debfc3dSmrg    The only argument of the program is a source md-file (e.g.
261debfc3dSmrg    config/i386/i386.md).  STDERR is used for the program output.  */
271debfc3dSmrg 
281debfc3dSmrg #include "bconfig.h"
291debfc3dSmrg #include "system.h"
301debfc3dSmrg #include "coretypes.h"
311debfc3dSmrg #include "tm.h"
321debfc3dSmrg #include "rtl.h"
331debfc3dSmrg #include "errors.h"
341debfc3dSmrg #include "read-md.h"
351debfc3dSmrg #include "gensupport.h"
361debfc3dSmrg 
371debfc3dSmrg 
381debfc3dSmrg extern int main (int, const char **);
391debfc3dSmrg 
401debfc3dSmrg int
main(int argc,const char ** argv)411debfc3dSmrg main (int argc, const char **argv)
421debfc3dSmrg {
431debfc3dSmrg   progname = "genmddump";
441debfc3dSmrg 
451debfc3dSmrg   if (!init_rtx_reader_args (argc, argv))
461debfc3dSmrg     return (FATAL_EXIT_CODE);
471debfc3dSmrg 
481debfc3dSmrg   /* Read the machine description.  */
491debfc3dSmrg   md_rtx_info info;
501debfc3dSmrg   while (read_md_rtx (&info))
511debfc3dSmrg     {
521debfc3dSmrg       printf (";; %s: %d\n", info.loc.filename, info.loc.lineno);
531debfc3dSmrg       print_inline_rtx (stdout, info.def, 0);
541debfc3dSmrg       printf ("\n\n");
551debfc3dSmrg     }
561debfc3dSmrg 
571debfc3dSmrg   fflush (stdout);
581debfc3dSmrg   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
591debfc3dSmrg }
60