From patchwork Thu Nov 15 21:53:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 199432 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 3BF6F2C0419 for ; Fri, 16 Nov 2012 08:56:00 +1100 (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=1353621360; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Date:To:Subject:User-Agent: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=ESr0QYv pr+dntpISp5SUt5+9jF8=; b=SwTVWkLbfTmAbjfHXzsAzz25z3BKBoM4Amoxk49 o1IEry1ResMnAT4jlhcQJSwyX5tBZ1qEwH2Smc0YlygbP/9JGiF23s8jckVyQCJR BExqdkHY2lqKuzUXXBN65UQGDpuCjXOaFqWKTT2xzKrEaOVZHmxr4KBx0N6mBLWj /iTg= 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:X-Google-DKIM-Signature:Received:Received:Received:Received:Date:To:Subject:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=DXSr9Qlf8hTuhA6rPS8Kj/3c2iZH41vnN68NlccB84ojhL78tCWEqPbTLX6UoA 9aOw7M5lGec/fOxFXLUorrH+7DiaNOiSS8kqTKS8bp8PLy03NSalRjiEhOFH8d9d Ckq/2vQjoEWO3Iygt9IPqIstAaNJIYh01R0+QB2IV4wv0=; Received: (qmail 10741 invoked by alias); 15 Nov 2012 21:54:18 -0000 Received: (qmail 10663 invoked by uid 22791); 15 Nov 2012 21:54:15 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_CP X-Spam-Check-By: sourceware.org Received: from mail-ea0-f201.google.com (HELO mail-ea0-f201.google.com) (209.85.215.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Nov 2012 21:53:59 +0000 Received: by mail-ea0-f201.google.com with SMTP id b14so135686eaa.2 for ; Thu, 15 Nov 2012 13:53:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:to:subject:user-agent:mime-version:content-type :content-transfer-encoding:message-id:from:x-gm-message-state; bh=KVkdspqKVzRPhcJxyboi6XpkabiFLJv+NWnm5FelgNw=; b=MdlLbL70N9He+G39OzzKrr/LcG0JxhQKCICByEV5woZvkvcAFazlFhX5fTgeUwadLc 6twK+lDAeWFEavvDlmvPMpMuTL1iZVsBimJqCpAfKVues503c9/v7yq9mhyO8t+D5DQj E8bOv+jicy6BkCB0yM6CUH83AzjShWkT23kEZlR0JaHUh2uCaWDN/s6fF8Vbwv2gOgv/ 5z0Qfuo9P9OuKYaC7MsjhdIPVUuCfTFuG+X5x8ZCo4Qf8Squ/jbbX6moufzsxmEMEeip vKs+xunQ/P77eoHNnFPKCYPTOGeXIqXHRXiEabZypJxkJK9burVwYiFibmmEtyTuccZ2 bT/A== Received: by 10.14.216.7 with SMTP id f7mr3301268eep.4.1353016437792; Thu, 15 Nov 2012 13:53:57 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z47si4118328eel.0.2012.11.15.13.53.57 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 15 Nov 2012 13:53:57 -0800 (PST) Received: from torture.tor.corp.google.com (torture.tor.corp.google.com [172.30.222.16]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 64D1E200302; Thu, 15 Nov 2012 13:53:57 -0800 (PST) Received: by torture.tor.corp.google.com (Postfix, from userid 54752) id D83B0C0916; Thu, 15 Nov 2012 16:53:56 -0500 (EST) Date: Thu, 15 Nov 2012 16:53:56 -0500 To: bernds@codesourcery.com, gcc-patches@gcc.gnu.org Subject: VEC re-write [patch 13/25] User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-Id: <20121115215356.D83B0C0916@torture.tor.corp.google.com> From: dnovillo@google.com (Diego Novillo) X-Gm-Message-State: ALoCoQlZlIi4gPH7FQVZs6MIcYuSwYrfDwutZwwKvTc2pEOP7wQPc9x19dZirgv7D6hOKDjysY5EiiW1tzHX3DTgIxhdY0ClbInDI8Aake8bsK1R7201VxpW61sxunzdox8Cwt2FAF4LCzvtoKCOvb5g6W0GbjfMB1dd0DQ+erneHc0EwEdv2LLS8MNCokVH/5iBxKV6ekhA 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 2012-11-15 Diego Novillo Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * config/c6x/c6x.c: Use new vec API in vec.h. diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 32807d8..175e119 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -119,14 +119,12 @@ typedef struct unsigned int unit_mask; } c6x_sched_insn_info; -DEF_VEC_O(c6x_sched_insn_info); -DEF_VEC_ALLOC_O(c6x_sched_insn_info, heap); /* Record a c6x_sched_insn_info structure for every insn in the function. */ -static VEC(c6x_sched_insn_info, heap) *insn_info; +static vec insn_info; -#define INSN_INFO_LENGTH (VEC_length (c6x_sched_insn_info, insn_info)) -#define INSN_INFO_ENTRY(N) (VEC_index (c6x_sched_insn_info, insn_info, (N))) +#define INSN_INFO_LENGTH (insn_info).length () +#define INSN_INFO_ENTRY(N) (insn_info[(N)]) static bool done_cfi_sections; @@ -1971,7 +1969,7 @@ c6x_get_unit_specifier (rtx insn) { enum attr_units units; - if (insn_info) + if (insn_info.exists ()) { int unit = INSN_INFO_ENTRY (INSN_UID (insn)).reservation; return c6x_unit_names[unit][0]; @@ -2023,7 +2021,7 @@ c6x_print_unit_specifier_field (FILE *file, rtx insn) return; } - if (insn_info) + if (insn_info.exists ()) { int unit = INSN_INFO_ENTRY (INSN_UID (insn)).reservation; fputs (".", file); @@ -3422,7 +3420,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, int i; unsigned tmp_mask; int best_reg, old_reg; - VEC (du_head_p, heap) *involved_chains = NULL; + vec involved_chains = vec(); unit_req_table new_reqs; for (i = 0, tmp_mask = op_mask; tmp_mask; i++) @@ -3433,14 +3431,14 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, if (info->op_info[i].n_chains != 1) goto out_fail; op_chain = regrename_chain_from_id (info->op_info[i].heads[0]->id); - VEC_safe_push (du_head_p, heap, involved_chains, op_chain); + involved_chains.safe_push (op_chain); tmp_mask &= ~(1 << i); } - if (VEC_length (du_head_p, involved_chains) > 1) + if (involved_chains.length () > 1) goto out_fail; - this_head = VEC_index (du_head_p, involved_chains, 0); + this_head = involved_chains[0]; if (this_head->cannot_rename) goto out_fail; @@ -3448,8 +3446,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, { unsigned int mask1, mask2, mask_changed; int count, side1, side2, req1, req2; - insn_rr_info *this_rr = &VEC_index (insn_rr_info, insn_rr, - INSN_UID (chain->insn)); + insn_rr_info *this_rr = &insn_rr[INSN_UID (chain->insn)]; count = get_unit_reqs (chain->insn, &req1, &side1, &req2, &side2); @@ -3508,7 +3505,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, memcpy (reqs, new_reqs, sizeof (unit_req_table)); out_fail: - VEC_free (du_head_p, heap, involved_chains); + involved_chains.release (); } /* Find insns in LOOP which would, if shifted to the other side @@ -3555,7 +3552,7 @@ reshuffle_units (basic_block loop) if (!get_unit_operand_masks (insn, &mask1, &mask2)) continue; - info = &VEC_index (insn_rr_info, insn_rr, INSN_UID (insn)); + info = &insn_rr[INSN_UID (insn)]; if (info->op_info == NULL) continue; @@ -3707,7 +3704,7 @@ insn_set_clock (rtx insn, int cycle) unsigned uid = INSN_UID (insn); if (uid >= INSN_INFO_LENGTH) - VEC_safe_grow (c6x_sched_insn_info, heap, insn_info, uid * 5 / 4 + 10); + insn_info.safe_grow (uid * 5 / 4 + 10); INSN_INFO_ENTRY (uid).clock = cycle; INSN_INFO_ENTRY (uid).new_cond = NULL; @@ -4361,7 +4358,7 @@ c6x_variable_issue (FILE *dump ATTRIBUTE_UNUSED, ss.last_scheduled_iter0 = insn; if (GET_CODE (PATTERN (insn)) != USE && GET_CODE (PATTERN (insn)) != CLOBBER) ss.issued_this_cycle++; - if (insn_info) + if (insn_info.exists ()) { state_t st_after = alloca (dfa_state_size); int curr_clock = ss.curr_sched_clock; @@ -5537,7 +5534,7 @@ hwloop_optimize (hwloop_info loop) gcc_assert (loop->incoming_dest == loop->head); entry_edge = NULL; - FOR_EACH_VEC_ELT (edge, loop->incoming, i, entry_edge) + FOR_EACH_VEC_SAFE_ELT (loop->incoming, i, entry_edge) if (entry_edge->flags & EDGE_FALLTHRU) break; if (entry_edge == NULL) @@ -5777,7 +5774,7 @@ hwloop_optimize (hwloop_info loop) seq = get_insns (); - if (!single_succ_p (entry_bb) || VEC_length (edge, loop->incoming) > 1) + if (!single_succ_p (entry_bb) || vec_safe_length (loop->incoming) > 1) { basic_block new_bb; edge e; @@ -5809,7 +5806,7 @@ hwloop_optimize (hwloop_info loop) end_sequence (); /* Make sure we don't try to schedule this loop again. */ - for (ix = 0; VEC_iterate (basic_block, loop->blocks, ix, bb); ix++) + for (ix = 0; loop->blocks.iterate (ix, &bb); ix++) bb->flags |= BB_DISABLE_SCHEDULE; return true; @@ -5928,7 +5925,7 @@ c6x_reorg (void) { int sz = get_max_uid () * 3 / 2 + 1; - insn_info = VEC_alloc (c6x_sched_insn_info, heap, sz); + insn_info.create (sz); } /* Make sure the real-jump insns we create are not deleted. When modulo- @@ -5993,9 +5990,7 @@ c6x_function_end (FILE *file, const char *fname) { c6x_output_fn_unwind (file); - if (insn_info) - VEC_free (c6x_sched_insn_info, heap, insn_info); - insn_info = NULL; + insn_info.release (); if (!flag_inhibit_size_directive) ASM_OUTPUT_MEASURED_SIZE (file, fname);