From patchwork Tue Jun 9 22:14:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 482389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 20E14140758 for ; Wed, 10 Jun 2015 08:15:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Q90HMlYk; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=Xi8FAJ667iG7 yu06g0PnimyBuENALM8hPMIXy3wXByyXV8jIS9lrF5B/gC/FU+ru3x1tpyJzHjNj +Y8k7FZueKGH0BS3/4C9Ww4ZVdQKKbtd1qcM2cIXyN7QsjWtKMg8NSxI4TpWKEjw htPGu7czJVHRUkMWeepKfkivdZUqQMo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=ifEdnpGZSRZuw05GFd O8Mk3e7Xs=; b=Q90HMlYkMt0fvMPFDKfU1O0w4I7mb2128mh3dtDi+imhDJxlnR UXK7aG4E7La70YtXZ1rn3KmLbUtxQaHJ5qeCoBFgw3x/H4YraRfL7k6qecbL50JX t9juGO224PwsFyV8lChQ+STNhpPOMpIA+vUxUFOPqoJ3h9Ziq/P6J+iCk= Received: (qmail 42317 invoked by alias); 9 Jun 2015 22:14:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 42307 invoked by uid 89); 9 Jun 2015 22:14:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-lb0-f177.google.com Received: from mail-lb0-f177.google.com (HELO mail-lb0-f177.google.com) (209.85.217.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 09 Jun 2015 22:14:54 +0000 Received: by lbcue7 with SMTP id ue7so18166406lbc.0 for ; Tue, 09 Jun 2015 15:14:50 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr20074423lbc.112.1433888090586; Tue, 09 Jun 2015 15:14:50 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by mx.google.com with ESMTPSA id o5sm1698123lag.9.2015.06.09.15.14.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 15:14:49 -0700 (PDT) From: Max Filippov To: gcc-patches@gcc.gnu.org Cc: Sterling Augustine , Max Filippov Subject: [PATCH v2] xtensa: implement trap pattern Date: Wed, 10 Jun 2015 01:14:29 +0300 Message-Id: <1433888069-25683-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes 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