From patchwork Thu Jan 2 17:30:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 306240 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 BC1C32C0084 for ; Fri, 3 Jan 2014 04:30:34 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=x8TBRzWKPC46XZHgaDCLmxMW+Im7+apTOwN3/XMbH4OSNQsp/a4tZ jmpX+93RzDZwytd/O02lXOfoAgYQvaAgvqqNLlnxNIMo2T/05QPB8zVac6fFYEgr XRiH4r/yKFI4m18uGJSU1hN6kClieu3KehIFDJOoEt8jwV3DYlKBe4= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=O3lhw1B+M4xpeuuFlD0ICwJGbdk=; b=wuldsgPCSDISor+f2ysr +zq8nzyIBT6CiIUs2ovr3tUmhQ0k6HvL3CdOzSWVWt6W508Q2QbHJWFtNw2CCcz2 mZ/r1to4WJ7w1PDVsZFaM38tEYw44DG4B8hpe2jomORNFHclyLo2YAUaPODY5sOn 2WzhEROCbUdNnvxF40rCzVM= Received: (qmail 24873 invoked by alias); 2 Jan 2014 17:30:15 -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 24702 invoked by uid 89); 2 Jan 2014 17:30:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 02 Jan 2014 17:30:14 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A607C540BBA; Thu, 2 Jan 2014 18:30:10 +0100 (CET) Date: Thu, 2 Jan 2014 18:30:10 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Inline functions tweeks 2/n: bring some heavy functions offline Message-ID: <20140102173010.GB15068@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, those functions are not inlined since they are too large anyway. I do not think it is disaster. get_attr_length_1 takes a callback that may make it more interesting inlining candidate than others, perhaps. Bootstrapped/regtested x86_64-linux, OK? Honza * gengtype-state.c (fatal_reading_state): Bring offline. * optabs.c (widening_optab_handler): Bring offline. * optabs.h (widening_optab_handler): Likewise. * final.c (get_attr_length_1): Likewise. * gimple.c (gimple_expr_type): LIkewise. * gimple.h (gimple_expr_type): Likewise. Index: gengtype-state.c =================================================================== --- gengtype-state.c (revision 206233) +++ gengtype-state.c (working copy) @@ -283,7 +283,7 @@ state_writer::state_writer () /* Fatal message while reading state. */ -static inline void +static void fatal_reading_state (struct state_token_st* tok, const char*msg) { if (tok) index: optabs.c =================================================================== --- optabs.c (revision 206233) +++ optabs.c (working copy) @@ -297,6 +297,25 @@ widened_mode (enum machine_mode to_mode, return result; } +/* Like optab_handler, but for widening_operations that have a + TO_MODE and a FROM_MODE. */ + +enum insn_code +widening_optab_handler (optab op, enum machine_mode to_mode, + enum machine_mode from_mode) +{ + unsigned scode = (op << 16) | to_mode; + if (to_mode != from_mode && from_mode != VOIDmode) + { + /* ??? Why does find_widening_optab_handler_and_mode attempt to + widen things that can't be widened? E.g. add_optab... */ + if (op > LAST_CONV_OPTAB) + return CODE_FOR_nothing; + scode |= from_mode << 8; + } + return raw_optab_handler (scode); +} + /* Find a widening optab even if it doesn't widen as much as we want. E.g. if from_mode is HImode, and to_mode is DImode, and there is no direct HI->SI insn, then return SI->DI, if that exists. Index: optabs.h =================================================================== --- optabs.h (revision 206233) +++ optabs.h (working copy) @@ -144,6 +144,8 @@ extern enum insn_code find_widening_opta enum machine_mode, int, enum machine_mode *); +extern enum insn_code widening_optab_handler (optab, enum machine_mode, + enum machine_mode); /* An extra flag to control optab_for_tree_code's behavior. This is needed to distinguish between machines with a vector shift that takes a scalar for the @@ -275,25 +277,6 @@ convert_optab_handler (convert_optab op, return raw_optab_handler (scode); } -/* Like optab_handler, but for widening_operations that have a - TO_MODE and a FROM_MODE. */ - -static inline enum insn_code -widening_optab_handler (optab op, enum machine_mode to_mode, - enum machine_mode from_mode) -{ - unsigned scode = (op << 16) | to_mode; - if (to_mode != from_mode && from_mode != VOIDmode) - { - /* ??? Why does find_widening_optab_handler_and_mode attempt to - widen things that can't be widened? E.g. add_optab... */ - if (op > LAST_CONV_OPTAB) - return CODE_FOR_nothing; - scode |= from_mode << 8; - } - return raw_optab_handler (scode); -} - /* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing if the target does not have such an insn. */ Index: final.c =================================================================== --- final.c (revision 206233) +++ final.c (working copy) @@ -371,7 +371,7 @@ init_insn_lengths (void) /* Obtain the current length of an insn. If branch shortening has been done, get its actual length. Otherwise, use FALLBACK_FN to calculate the length. */ -static inline int +static int get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx)) { rtx body; Index: gimple.c =================================================================== --- gimple.c (revision 206233) +++ gimple.c (working copy) @@ -2787,3 +2787,47 @@ gimple_seq_set_location (gimple_seq seq, for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) gimple_set_location (gsi_stmt (i), loc); } + + +/* Return the type of the main expression computed by STMT. Return + void_type_node if the statement computes nothing. */ + +tree +gimple_expr_type (const_gimple stmt) +{ + enum gimple_code code = gimple_code (stmt); + + if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) + { + tree type; + /* In general we want to pass out a type that can be substituted + for both the RHS and the LHS types if there is a possibly + useless conversion involved. That means returning the + original RHS type as far as we can reconstruct it. */ + if (code == GIMPLE_CALL) + { + if (gimple_call_internal_p (stmt) + && gimple_call_internal_fn (stmt) == IFN_MASK_STORE) + type = TREE_TYPE (gimple_call_arg (stmt, 3)); + else + type = gimple_call_return_type (stmt); + } + else + switch (gimple_assign_rhs_code (stmt)) + { + case POINTER_PLUS_EXPR: + type = TREE_TYPE (gimple_assign_rhs1 (stmt)); + break; + + default: + /* As fallback use the type of the LHS. */ + type = TREE_TYPE (gimple_get_lhs (stmt)); + break; + } + return type; + } + else if (code == GIMPLE_COND) + return boolean_type_node; + else + return void_type_node; +} Index: gimple.h =================================================================== --- gimple.h (revision 206233) +++ gimple.h (working copy) @@ -1263,6 +1263,7 @@ extern bool infer_nonnull_range (gimple, extern void sort_case_labels (vec ); extern void preprocess_case_label_vec_for_gimple (vec , tree, tree *); extern void gimple_seq_set_location (gimple_seq , location_t); +extern tree gimple_expr_type (const_gimple stmt); /* Formal (expression) temporary table handling: multiple occurrences of the same scalar expression are evaluated into the same temporary. */ @@ -5607,50 +5608,6 @@ gimple_predict_set_outcome (gimple gs, e gs->subcode &= ~GF_PREDICT_TAKEN; } - -/* Return the type of the main expression computed by STMT. Return - void_type_node if the statement computes nothing. */ - -static inline tree -gimple_expr_type (const_gimple stmt) -{ - enum gimple_code code = gimple_code (stmt); - - if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) - { - tree type; - /* In general we want to pass out a type that can be substituted - for both the RHS and the LHS types if there is a possibly - useless conversion involved. That means returning the - original RHS type as far as we can reconstruct it. */ - if (code == GIMPLE_CALL) - { - if (gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_MASK_STORE) - type = TREE_TYPE (gimple_call_arg (stmt, 3)); - else - type = gimple_call_return_type (stmt); - } - else - switch (gimple_assign_rhs_code (stmt)) - { - case POINTER_PLUS_EXPR: - type = TREE_TYPE (gimple_assign_rhs1 (stmt)); - break; - - default: - /* As fallback use the type of the LHS. */ - type = TREE_TYPE (gimple_get_lhs (stmt)); - break; - } - return type; - } - else if (code == GIMPLE_COND) - return boolean_type_node; - else - return void_type_node; -} - /* Enum and arrays used for allocation stats. Keep in sync with gimple.c:gimple_alloc_kind_names. */ enum gimple_alloc_kind