From patchwork Tue Aug 10 21:46:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 61418 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 2F7E5B6F0E for ; Wed, 11 Aug 2010 07:46:11 +1000 (EST) Received: (qmail 26111 invoked by alias); 10 Aug 2010 21:46:10 -0000 Received: (qmail 26103 invoked by uid 22791); 10 Aug 2010 21:46:09 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Aug 2010 21:46:04 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7ALk3Ld009493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Aug 2010 17:46:03 -0400 Received: from toll.yyz.redhat.com (toll.yyz.redhat.com [10.15.16.165]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7ALk2rK009418 for ; Tue, 10 Aug 2010 17:46:02 -0400 Message-ID: <4C61C89A.7060308@redhat.com> Date: Tue, 10 Aug 2010 17:46:02 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Thunderbird/3.1.1 MIME-Version: 1.0 To: gcc-patches Subject: patch for compressing living ranges more 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 The following patch from ira-improv branch was approved by Jeff Law. The patch has been committed into the trunk. 2010-08-10 Vladimir Makarov * ira-live.c: Include sbitmap.h. (remove_some_program_points_and_update_live_ranges): Use sbitmaps. Compress live ranges even more. Index: ira-lives.c =================================================================== --- ira-lives.c (revision 163079) +++ ira-lives.c (working copy) @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. #include "toplev.h" #include "params.h" #include "df.h" +#include "sbitmap.h" #include "sparseset.h" #include "ira-int.h" @@ -1308,25 +1309,43 @@ remove_some_program_points_and_update_li ira_object_t obj; ira_object_iterator oi; live_range_t r; - bitmap born_or_died; - bitmap_iterator bi; - - born_or_died = ira_allocate_bitmap (); + sbitmap born_or_dead, born, dead; + sbitmap_iterator sbi; + bool born_p, dead_p, prev_born_p, prev_dead_p; + + born = sbitmap_alloc (ira_max_point); + dead = sbitmap_alloc (ira_max_point); + sbitmap_zero (born); + sbitmap_zero (dead); FOR_EACH_OBJECT (obj, oi) for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next) { ira_assert (r->start <= r->finish); - bitmap_set_bit (born_or_died, r->start); - bitmap_set_bit (born_or_died, r->finish); + SET_BIT (born, r->start); + SET_BIT (dead, r->finish); } + born_or_dead = sbitmap_alloc (ira_max_point); + sbitmap_a_or_b (born_or_dead, born, dead); map = (int *) ira_allocate (sizeof (int) * ira_max_point); - n = 0; - EXECUTE_IF_SET_IN_BITMAP(born_or_died, 0, i, bi) - { - map[i] = n++; - } - ira_free_bitmap (born_or_died); + n = -1; + prev_born_p = prev_dead_p = false; + EXECUTE_IF_SET_IN_SBITMAP (born_or_dead, 0, i, sbi) + { + born_p = TEST_BIT (born, i); + dead_p = TEST_BIT (dead, i); + if ((prev_born_p && ! prev_dead_p && born_p && ! dead_p) + || (prev_dead_p && ! prev_born_p && dead_p && ! born_p)) + map[i] = n; + else + map[i] = ++n; + prev_born_p = born_p; + prev_dead_p = dead_p; + } + sbitmap_free (born_or_dead); + sbitmap_free (born); + sbitmap_free (dead); + n++; if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL) fprintf (ira_dump_file, "Compressing live ranges: from %d to %d - %d%%\n", ira_max_point, n, 100 * n / ira_max_point);