genmddump.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Generate code from machine description to recognize rtl as insns.
  2. Copyright (C) 1987-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  11. License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /* This program is used to produce tmp-mddump.md, which represents
  16. md-file with expanded iterators and after define_subst transformation
  17. is performed.
  18. The only argument of the program is a source md-file (e.g.
  19. config/i386/i386.md). STDERR is used for the program output. */
  20. #include "bconfig.h"
  21. #include "system.h"
  22. #include "coretypes.h"
  23. #include "tm.h"
  24. #include "rtl.h"
  25. #include "errors.h"
  26. #include "read-md.h"
  27. #include "gensupport.h"
  28. extern int main (int, char **);
  29. int
  30. main (int argc, char **argv)
  31. {
  32. rtx desc;
  33. int pattern_lineno;
  34. int code; /* not used */
  35. progname = "genmddump";
  36. if (!init_rtx_reader_args (argc, argv))
  37. return (FATAL_EXIT_CODE);
  38. /* Read the machine description. */
  39. while (1)
  40. {
  41. desc = read_md_rtx (&pattern_lineno, &code);
  42. if (desc == NULL)
  43. break;
  44. printf (";; %s: %d\n", read_md_filename, pattern_lineno);
  45. print_inline_rtx (stdout, desc, 0);
  46. printf ("\n\n");
  47. }
  48. fflush (stdout);
  49. return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
  50. }