From 768b666466931611b0b39f125cb0645b1cf3d102 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Wed, 10 Jun 2015 15:07:40 +0000 Subject: [PATCH] xtensa: implement trap pattern 2015-06-10 Max Filippov gcc/ * config/xtensa/xtensa.h (TARGET_DEBUG): New definition. * config/xtensa/xtensa.md (define_attr "type"): New type "trap". (define_insn "trap"): New definition. From-SVN: r224330 --- gcc/ChangeLog | 6 ++++++ gcc/config/xtensa/xtensa.h | 1 + gcc/config/xtensa/xtensa.md | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c3854fa5c6e..7c002a4e929 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-10 Max Filippov + + * config/xtensa/xtensa.h (TARGET_DEBUG): New definition. + * config/xtensa/xtensa.md (define_attr "type"): New type "trap". + (define_insn "trap"): New definition. + 2015-06-10 Richard Biener * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Split diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 615f7412fa7..fb8702c92c9 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -67,6 +67,7 @@ extern unsigned xtensa_current_frame_size; #define TARGET_THREADPTR XCHAL_HAVE_THREADPTR #define TARGET_LOOPS XCHAL_HAVE_LOOPS #define TARGET_WINDOWED_ABI (XSHAL_ABI == XTHAL_ABI_WINDOWED) +#define TARGET_DEBUG XCHAL_HAVE_DEBUG #define TARGET_DEFAULT \ ((XCHAL_HAVE_L32R ? 0 : MASK_CONST16) | \ diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 6d84384c950..a577aa30e57 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -86,7 +86,7 @@ ;; Attributes. (define_attr "type" - "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry" + "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry,trap" (const_string "unknown")) (define_attr "mode" @@ -1764,6 +1764,19 @@ [(set_attr "length" "0") (set_attr "type" "nop")]) +(define_insn "trap" + [(trap_if (const_int 1) (const_int 0))] + "" +{ + if (TARGET_DEBUG) + return "break\t1, 15"; + else + return (TARGET_DENSITY ? "ill.n" : "ill"); +} + [(set_attr "type" "trap") + (set_attr "mode" "none") + (set_attr "length" "3")]) + ;; Setting up a frame pointer is tricky for Xtensa because GCC doesn't ;; know if a frame pointer is required until the reload pass, and ;; because there may be an incoming argument value in the hard frame -- 2.30.2