875-xtensa-implement-trap-pattern.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 2b4b5775554c91a63ccae4ee566db696b633652e Mon Sep 17 00:00:00 2001
  2. From: jcmvbkbc <jcmvbkbc@138bc75d-0d04-0410-961f-82ee72b054a4>
  3. Date: Wed, 10 Jun 2015 15:07:40 +0000
  4. Subject: [PATCH] xtensa: implement trap pattern
  5. 2015-06-10 Max Filippov <jcmvbkbc@gmail.com>
  6. gcc/
  7. * config/xtensa/xtensa.h (TARGET_DEBUG): New definition.
  8. * config/xtensa/xtensa.md (define_attr "type"): New type "trap".
  9. (define_insn "trap"): New definition.
  10. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  11. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224330 138bc75d-0d04-0410-961f-82ee72b054a4
  12. ---
  13. gcc/config/xtensa/xtensa.h | 1 +
  14. gcc/config/xtensa/xtensa.md | 15 ++++++++++++++-
  15. 2 files changed, 15 insertions(+), 1 deletion(-)
  16. diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
  17. index 615f741..fb8702c 100644
  18. --- a/gcc/config/xtensa/xtensa.h
  19. +++ b/gcc/config/xtensa/xtensa.h
  20. @@ -67,6 +67,7 @@ extern unsigned xtensa_current_frame_size;
  21. #define TARGET_THREADPTR XCHAL_HAVE_THREADPTR
  22. #define TARGET_LOOPS XCHAL_HAVE_LOOPS
  23. #define TARGET_WINDOWED_ABI (XSHAL_ABI == XTHAL_ABI_WINDOWED)
  24. +#define TARGET_DEBUG XCHAL_HAVE_DEBUG
  25. #define TARGET_DEFAULT \
  26. ((XCHAL_HAVE_L32R ? 0 : MASK_CONST16) | \
  27. diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
  28. index 6d84384..a577aa3 100644
  29. --- a/gcc/config/xtensa/xtensa.md
  30. +++ b/gcc/config/xtensa/xtensa.md
  31. @@ -86,7 +86,7 @@
  32. ;; Attributes.
  33. (define_attr "type"
  34. - "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry"
  35. + "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry,trap"
  36. (const_string "unknown"))
  37. (define_attr "mode"
  38. @@ -1764,6 +1764,19 @@
  39. [(set_attr "length" "0")
  40. (set_attr "type" "nop")])
  41. +(define_insn "trap"
  42. + [(trap_if (const_int 1) (const_int 0))]
  43. + ""
  44. +{
  45. + if (TARGET_DEBUG)
  46. + return "break\t1, 15";
  47. + else
  48. + return (TARGET_DENSITY ? "ill.n" : "ill");
  49. +}
  50. + [(set_attr "type" "trap")
  51. + (set_attr "mode" "none")
  52. + (set_attr "length" "3")])
  53. +
  54. ;; Setting up a frame pointer is tricky for Xtensa because GCC doesn't
  55. ;; know if a frame pointer is required until the reload pass, and
  56. ;; because there may be an incoming argument value in the hard frame
  57. --
  58. 2.1.4