genopt.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # Generate rs6000-tables.opt from the list of CPUs in rs6000-cpus.def.
  3. # Copyright (C) 2011-2015 Free Software Foundation, Inc.
  4. #
  5. # This file is part of GCC.
  6. #
  7. # GCC is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3, or (at your option)
  10. # any later version.
  11. #
  12. # GCC is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with GCC; see the file COPYING3. If not see
  19. # <http://www.gnu.org/licenses/>.
  20. cat <<EOF
  21. ; -*- buffer-read-only: t -*-
  22. ; Generated automatically by genopt.sh from rs6000-cpus.def.
  23. ; Copyright (C) 2011-2015 Free Software Foundation, Inc.
  24. ;
  25. ; This file is part of GCC.
  26. ;
  27. ; GCC is free software; you can redistribute it and/or modify it under
  28. ; the terms of the GNU General Public License as published by the Free
  29. ; Software Foundation; either version 3, or (at your option) any later
  30. ; version.
  31. ;
  32. ; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  33. ; WARRANTY; without even the implied warranty of MERCHANTABILITY or
  34. ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  35. ; for more details.
  36. ;
  37. ; You should have received a copy of the GNU General Public License
  38. ; along with GCC; see the file COPYING3. If not see
  39. ; <http://www.gnu.org/licenses/>.
  40. Enum
  41. Name(rs6000_cpu_opt_value) Type(int)
  42. Known CPUs (for use with the -mcpu= and -mtune= options):
  43. EnumValue
  44. Enum(rs6000_cpu_opt_value) String(native) Value(RS6000_CPU_OPTION_NATIVE) DriverOnly
  45. EOF
  46. awk -F'[(, ]+' '
  47. BEGIN {
  48. value = 0
  49. }
  50. /^RS6000_CPU/ {
  51. name = $2
  52. gsub("\"", "", name)
  53. print "EnumValue"
  54. print "Enum(rs6000_cpu_opt_value) String(" name ") Value(" value ")"
  55. print ""
  56. value++
  57. }' $1/rs6000-cpus.def