From patchwork Sun Jul 5 07:51:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 491279 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 B76181409A0 for ; Sun, 5 Jul 2015 17:51:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Za/IXyjG; 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=tQ65Z4NzMVTc6lp5 QmjfZ82lENZL8iZuCHGUsJkayjsqEGanPya6Aw6aCoYYhhE3I/MyiOEQdy9PusOd qatkf4Fr5h0yqgV8RXgESmV2RcsZ3ihOoUH/zZSTBb0jTLFcup3mt5qTz86hOSe0 1E+ah76W9nQK890b6/WiDQHAkO8= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=govpDgph1amN6GhxFgW/fr 1p/u0=; b=Za/IXyjGtg34irpP0ndxNEeB68V0y4rpCuLMY/T9IRpXqQSbeUSAiX r0W66Ew+ZVgJNxwKBrkJfeua/g/DucoYEXiPBZRs+VzxDeQQvdHHKgkcAAQTJ0Ac No6MbKN4Gn99cR0lB2z3Jcop68pucL73jdch0lhJG2vaVO0u8jzoo= Received: (qmail 115141 invoked by alias); 5 Jul 2015 07:51:24 -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 115126 invoked by uid 89); 5 Jul 2015 07:51:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 05 Jul 2015 07:51:22 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-33-2Dswn5w4QBi6hPFustsrjA-1 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 5 Jul 2015 08:51:16 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] Use target-insns.def for trap Date: Sun, 05 Jul 2015 08:51:16 +0100 Message-ID: <87a8vbm497.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 2Dswn5w4QBi6hPFustsrjA-1 Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (trap): New targetm instruction pattern. * builtins.c (expand_builtin_trap): Use it instead of HAVE_*/gen_* interface. * explow.c (allocate_dynamic_stack_space): Likewise. * ifcvt.c (find_if_header): Likewise. Index: gcc/target-insns.def =================================================================== --- gcc/target-insns.def 2015-07-05 08:50:33.976046688 +0100 +++ gcc/target-insns.def 2015-07-05 08:50:33.972046718 +0100 @@ -51,5 +51,6 @@ DEF_TARGET_INSN (sibcall_epilogue, (void DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) +DEF_TARGET_INSN (trap, (void)) DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (untyped_return, (rtx x0, rtx x1)) Index: gcc/builtins.c =================================================================== --- gcc/builtins.c 2015-07-05 08:50:33.976046688 +0100 +++ gcc/builtins.c 2015-07-05 08:50:33.972046718 +0100 @@ -4737,10 +4737,9 @@ expand_builtin_assume_aligned (tree exp, void expand_builtin_trap (void) { -#ifdef HAVE_trap - if (HAVE_trap) + if (targetm.have_trap ()) { - rtx_insn *insn = emit_insn (gen_trap ()); + rtx_insn *insn = emit_insn (targetm.gen_trap ()); /* For trap insns when not accumulating outgoing args force REG_ARGS_SIZE note to prevent crossjumping of calls with different args sizes. */ @@ -4748,7 +4747,6 @@ expand_builtin_trap (void) add_reg_note (insn, REG_ARGS_SIZE, GEN_INT (stack_pointer_delta)); } else -#endif emit_library_call (abort_libfunc, LCT_NORETURN, VOIDmode, 0); emit_barrier (); } Index: gcc/explow.c =================================================================== --- gcc/explow.c 2015-07-05 08:50:33.976046688 +0100 +++ gcc/explow.c 2015-07-05 08:50:33.972046718 +0100 @@ -1422,11 +1422,9 @@ allocate_dynamic_stack_space (rtx size, emit_cmp_and_jump_insns (available, size, GEU, NULL_RTX, Pmode, 1, space_available); -#ifdef HAVE_trap - if (HAVE_trap) - emit_insn (gen_trap ()); + if (targetm.have_trap ()) + emit_insn (targetm.gen_trap ()); else -#endif error ("stack limits not supported on this target"); emit_barrier (); emit_label (space_available); Index: gcc/ifcvt.c =================================================================== --- gcc/ifcvt.c 2015-07-05 08:50:33.976046688 +0100 +++ gcc/ifcvt.c 2015-07-05 08:50:33.976046688 +0100 @@ -67,9 +67,6 @@ #define HAVE_incscc 0 #ifndef HAVE_decscc #define HAVE_decscc 0 #endif -#ifndef HAVE_trap -#define HAVE_trap 0 -#endif #ifndef MAX_CONDITIONAL_EXECUTE #define MAX_CONDITIONAL_EXECUTE \ @@ -3414,7 +3411,7 @@ find_if_header (basic_block test_bb, int && cond_exec_find_if_block (&ce_info)) goto success; - if (HAVE_trap + if (targetm.have_trap () && optab_handler (ctrap_optab, word_mode) != CODE_FOR_nothing && find_cond_trap (test_bb, then_edge, else_edge)) goto success;