public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] xtensa: implement trap pattern
@ 2015-06-09 22:15 Max Filippov
  2015-06-10 14:38 ` augustine.sterling
  0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2015-06-09 22:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: Sterling Augustine, 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.
---
Changes v1->v2:
- drop break.n, replace break 0, 0 with break 1, 15, coded breakpoint
  that transfers control to debugger if present.

 gcc/config/xtensa/xtensa.h  |  1 +
 gcc/config/xtensa/xtensa.md | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 011411c..584080b 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 6d84384..a577aa3 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
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xtensa: implement trap pattern
  2015-06-09 22:15 [PATCH v2] xtensa: implement trap pattern Max Filippov
@ 2015-06-10 14:38 ` augustine.sterling
  2015-06-10 15:10   ` Max Filippov
  0 siblings, 1 reply; 3+ messages in thread
From: augustine.sterling @ 2015-06-10 14:38 UTC (permalink / raw)
  To: Max Filippov; +Cc: gcc-patches

On Tue, Jun 9, 2015 at 3:14 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> gcc/
>         * config/xtensa/xtensa.h (TARGET_DEBUG): New definition.
>         * config/xtensa/xtensa.md (define_attr "type"): New type "trap".
>         (define_insn "trap"): New definition.
> ---
> Changes v1->v2:
> - drop break.n, replace break 0, 0 with break 1, 15, coded breakpoint
>   that transfers control to debugger if present.

This is OK for xtensa. Please apply.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xtensa: implement trap pattern
  2015-06-10 14:38 ` augustine.sterling
@ 2015-06-10 15:10   ` Max Filippov
  0 siblings, 0 replies; 3+ messages in thread
From: Max Filippov @ 2015-06-10 15:10 UTC (permalink / raw)
  To: augustine.sterling; +Cc: gcc-patches

On Wed, Jun 10, 2015 at 5:37 PM, augustine.sterling@gmail.com
<augustine.sterling@gmail.com> wrote:
> On Tue, Jun 9, 2015 at 3:14 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> gcc/
>>         * config/xtensa/xtensa.h (TARGET_DEBUG): New definition.
>>         * config/xtensa/xtensa.md (define_attr "type"): New type "trap".
>>         (define_insn "trap"): New definition.
>> ---
>> Changes v1->v2:
>> - drop break.n, replace break 0, 0 with break 1, 15, coded breakpoint
>>   that transfers control to debugger if present.
>
> This is OK for xtensa. Please apply.

Applied to trunk. Thanks!

-- Max

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-10 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 22:15 [PATCH v2] xtensa: implement trap pattern Max Filippov
2015-06-10 14:38 ` augustine.sterling
2015-06-10 15:10   ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).