From patchwork Thu Jul 12 06:52:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 170582 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]) by ozlabs.org (Postfix) with SMTP id A79C32C021D for ; Thu, 12 Jul 2012 16:53:21 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342680801; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=gduIePVDZGf0Y3m0D6w638CwHXY=; b=B5UoBN3NgK+gppn SEsHBxemQxlyK8pk8uj2Nm/WX8/s1dHPx8hWEueRAKtpxlPv+ENdAPW0+8ScBKBu +accwOC7jdpQri5v4qeQhtgUQkrzYzDD8G4K+t06OpI/6aqewSKMeckdjd6xGQIT YF90RZmzt1E8aFmfIgXamZJz9ZbE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Pq31ATqogd200WjPuFQpZdYp9TZQGzqrz95kf415MRXJJCtzwoKjPAu9YS9hvP rl7X9ndu9to+brvyAKBhUMS5d0QMtsdCoMtfxxtYAh0ntbMpLIH87wy1bwl0Q1c1 dpf62JJ0RojYneVViGFPUzsxAKgoZm+QdyBjfFT3ZaNzQ=; Received: (qmail 607 invoked by alias); 12 Jul 2012 06:53:08 -0000 Received: (qmail 489 invoked by uid 22791); 12 Jul 2012 06:53:07 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jul 2012 06:52:51 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SpDGc-00019Q-5D from ChungLin_Tang@mentor.com ; Wed, 11 Jul 2012 23:52:50 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Jul 2012 23:52:49 -0700 Received: from [0.0.0.0] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Wed, 11 Jul 2012 23:52:49 -0700 Message-ID: <4FFE7445.7020005@codesourcery.com> Date: Thu, 12 Jul 2012 14:52:53 +0800 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: gcc-patches CC: Sterling Augustine Subject: [PATCH 5/6] Thread pointer built-in functions, xtensa X-IsSubscribed: yes 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 xtensa parts. No other notes. Thanks, Chung-Lin * config/xtensa/xtensa.c (xtensa_expand_builtin_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_THREAD_POINTER. (xtensa_expand_builtin_set_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER. (xtensa_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER and XTENSA_BUILTIN_SET_THREAD_POINTER. (xtensa_init_builtins): Remove __builtin_thread_pointer, __builtin_set_thread_pointer machine-specific builtins. (xtensa_fold_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, XTENSA_BUILTIN_SET_THREAD_POINTER cases. (xtensa_expand_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, XTENSA_BUILTIN_SET_THREAD_POINTER cases. Index: config/xtensa/xtensa.c =================================================================== --- config/xtensa/xtensa.c (revision 189431) +++ config/xtensa/xtensa.c (working copy) @@ -158,6 +158,8 @@ static unsigned int xtensa_function_arg_boundary ( static void xtensa_init_builtins (void); static tree xtensa_fold_builtin (tree, int, tree *, bool); static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int); +static rtx xtensa_expand_builtin_thread_pointer (rtx); +static void xtensa_expand_builtin_set_thread_pointer (rtx); static void xtensa_va_start (tree, rtx); static bool xtensa_frame_pointer_required (void); static rtx xtensa_static_chain (const_tree, bool); @@ -258,6 +260,13 @@ static const int reg_nonleaf_alloc_order[FIRST_PSE #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN xtensa_expand_builtin +#undef TARGET_EXPAND_BUILTIN_THREAD_POINTER +#define TARGET_EXPAND_BUILTIN_THREAD_POINTER \ + xtensa_expand_builtin_thread_pointer +#undef TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER +#define TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER \ + xtensa_expand_builtin_set_thread_pointer + #undef TARGET_PREFERRED_RELOAD_CLASS #define TARGET_PREFERRED_RELOAD_CLASS xtensa_preferred_reload_class #undef TARGET_PREFERRED_OUTPUT_RELOAD_CLASS @@ -3057,8 +3066,6 @@ xtensa_gimplify_va_arg_expr (tree valist, tree typ enum xtensa_builtin { XTENSA_BUILTIN_UMULSIDI3, - XTENSA_BUILTIN_THREAD_POINTER, - XTENSA_BUILTIN_SET_THREAD_POINTER, XTENSA_BUILTIN_max }; @@ -3077,23 +3084,6 @@ xtensa_init_builtins (void) "__umulsidi3", NULL_TREE); TREE_NOTHROW (decl) = 1; TREE_READONLY (decl) = 1; - - if (TARGET_THREADPTR) - { - ftype = build_function_type_list (ptr_type_node, NULL_TREE); - decl = add_builtin_function ("__builtin_thread_pointer", ftype, - XTENSA_BUILTIN_THREAD_POINTER, BUILT_IN_MD, - NULL, NULL_TREE); - TREE_READONLY (decl) = 1; - TREE_NOTHROW (decl) = 1; - - ftype = build_function_type_list (void_type_node, ptr_type_node, - NULL_TREE); - decl = add_builtin_function ("__builtin_set_thread_pointer", ftype, - XTENSA_BUILTIN_SET_THREAD_POINTER, - BUILT_IN_MD, NULL, NULL_TREE); - TREE_NOTHROW (decl) = 1; - } } @@ -3116,10 +3106,6 @@ xtensa_fold_builtin (tree fndecl, int n_args ATTRI fold_convert (unsigned_intDI_type_node, arg1)); break; - case XTENSA_BUILTIN_THREAD_POINTER: - case XTENSA_BUILTIN_SET_THREAD_POINTER: - break; - default: internal_error ("bad builtin code"); break; @@ -3147,25 +3133,25 @@ xtensa_expand_builtin (tree exp, rtx target, implement it. If not, just call the function. */ return expand_call (exp, target, ignore); - case XTENSA_BUILTIN_THREAD_POINTER: - if (!target || !register_operand (target, Pmode)) - target = gen_reg_rtx (Pmode); - emit_insn (gen_load_tp (target)); - return target; - - case XTENSA_BUILTIN_SET_THREAD_POINTER: - arg = expand_normal (CALL_EXPR_ARG (exp, 0)); - if (!register_operand (arg, Pmode)) - arg = copy_to_mode_reg (Pmode, arg); - emit_insn (gen_set_tp (arg)); - return const0_rtx; - default: internal_error ("bad builtin code"); } return NULL_RTX; } +static rtx +xtensa_expand_builtin_thread_pointer (rtx target) +{ + emit_insn (gen_load_tp (target)); + return target; +} + +static void +xtensa_expand_builtin_set_thread_pointer (rtx val) +{ + emit_insn (gen_set_tp (val)); +} + /* Worker function for TARGET_PREFERRED_RELOAD_CLASS. */ static reg_class_t