nios2-Add-IJMP_REGS-enum.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. From 920a898d2a04933c13eb808a513bc5822e91f70a Mon Sep 17 00:00:00 2001
  2. From: sandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4>
  3. Date: Tue, 12 May 2015 15:57:22 +0000
  4. Subject: [PATCH] gcc/nios2: Add IJMP_REGS enum
  5. 2015-05-12 Chung-Lin Tang <cltang@codesourcery.com>
  6. Sandra Loosemore <sandra@codesourcery.com>
  7. gcc/
  8. * config/nios2/nios2.h (enum reg_class): Add IJMP_REGS enum
  9. value.
  10. (REG_CLASS_NAMES): Add "IJMP_REGS".
  11. (REG_CLASS_CONTENTS): Add new entry for IJMP_REGS.
  12. * config/nios2/nios2.md (indirect_jump,*tablejump): Adjust to
  13. use new "c" register constraint.
  14. * config/nios2/constraint.md (c): New register constraint
  15. corresponding to IJMP_REGS.
  16. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223082 138bc75d-0d04-0410-961f-82ee72b054a4
  17. [Romain: rebase on gcc 5.4]
  18. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  19. ---
  20. gcc/config/nios2/constraints.md | 3 +++
  21. gcc/config/nios2/nios2.h | 11 +++++++----
  22. gcc/config/nios2/nios2.md | 4 ++--
  23. 3 files changed, 12 insertions(+), 6 deletions(-)
  24. diff --git a/gcc/config/nios2/constraints.md b/gcc/config/nios2/constraints.md
  25. index f4bd9f7..735f892 100644
  26. --- a/gcc/config/nios2/constraints.md
  27. +++ b/gcc/config/nios2/constraints.md
  28. @@ -39,6 +39,9 @@
  29. ;; Register constraints
  30. +(define_register_constraint "c" "IJMP_REGS"
  31. + "A register suitable for an indirect jump.")
  32. +
  33. (define_register_constraint "j" "SIB_REGS"
  34. "A register suitable for an indirect sibcall.")
  35. diff --git a/gcc/config/nios2/nios2.h b/gcc/config/nios2/nios2.h
  36. index 117983d..7c329ae 100644
  37. --- a/gcc/config/nios2/nios2.h
  38. +++ b/gcc/config/nios2/nios2.h
  39. @@ -173,6 +173,7 @@ enum reg_class
  40. {
  41. NO_REGS,
  42. SIB_REGS,
  43. + IJMP_REGS,
  44. GP_REGS,
  45. ALL_REGS,
  46. LIM_REG_CLASSES
  47. @@ -183,6 +184,7 @@ enum reg_class
  48. #define REG_CLASS_NAMES \
  49. { "NO_REGS", \
  50. "SIB_REGS", \
  51. + "IJMP_REGS", \
  52. "GP_REGS", \
  53. "ALL_REGS" }
  54. @@ -190,10 +192,11 @@ enum reg_class
  55. #define REG_CLASS_CONTENTS \
  56. { \
  57. - /* NO_REGS */ { 0, 0}, \
  58. - /* SIB_REGS */ { 0xfe0c, 0}, \
  59. - /* GP_REGS */ {~0, 0}, \
  60. - /* ALL_REGS */ {~0,~0} \
  61. + /* NO_REGS */ { 0, 0}, \
  62. + /* SIB_REGS */ { 0xfe0c, 0}, \
  63. + /* IJMP_REGS */ { 0x7fffffff, 0}, \
  64. + /* GP_REGS */ {~0, 0}, \
  65. + /* ALL_REGS */ {~0,~0} \
  66. }
  67. diff --git a/gcc/config/nios2/nios2.md b/gcc/config/nios2/nios2.md
  68. index 7b35d269..36ef101 100644
  69. --- a/gcc/config/nios2/nios2.md
  70. +++ b/gcc/config/nios2/nios2.md
  71. @@ -697,7 +697,7 @@
  72. ; check or adjust for overflow.
  73. (define_insn "indirect_jump"
  74. - [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
  75. + [(set (pc) (match_operand:SI 0 "register_operand" "c"))]
  76. ""
  77. "jmp\\t%0"
  78. [(set_attr "type" "control")])
  79. @@ -811,7 +811,7 @@
  80. (define_insn "*tablejump"
  81. [(set (pc)
  82. - (match_operand:SI 0 "register_operand" "r"))
  83. + (match_operand:SI 0 "register_operand" "c"))
  84. (use (label_ref (match_operand 1 "" "")))]
  85. ""
  86. "jmp\\t%0"
  87. --
  88. 2.5.5