From patchwork Wed Feb 13 13:26:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Greenhalgh X-Patchwork-Id: 220133 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 A5D042C0085 for ; Thu, 14 Feb 2013 00:27:06 +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=1361366827; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=w9c5V58OETMG1gQkvl9p KxzXu3k=; b=Cf6nWxbz8IiAlNyYGft4bSHcxN74E3PoKADvEh04FGCN1BXJmnIW pdSGxRjm+cMizlxKizJ+gzhBP2x8ldSeO+OOtZY2QexZxJJ4sfQG34Lkg6cssCTB +mHUeItHJhk15COV5jmA4YE7sBKhgTe0rucfMbaFvGDB08uXDk6l5p4= 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:From:To:Cc:Subject:Date:Message-Id:MIME-Version:X-MC-Unique:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=hjlnYUW2DNtbfZFoM6LSIokVa4tS7/P5kRJoo4twdgn6qE+pot4SaUkbEbA8ns aYqpp5aXdksm0fT2vD8IAu98mUlYeSRIx6pDpvREu9VijeXvaBpIfhPuNl4IikPB 8jDNn/yNB+6B7kYYHo2HO+rPgbwRyzVWGCSH1TQU8aI+M=; Received: (qmail 5479 invoked by alias); 13 Feb 2013 13:26:54 -0000 Received: (qmail 5461 invoked by uid 22791); 13 Feb 2013 13:26:53 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_20, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Feb 2013 13:26:47 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 13 Feb 2013 13:26:45 +0000 Received: from e106375-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 13 Feb 2013 13:26:44 +0000 From: James Greenhalgh To: gcc-patches@gcc.gnu.org Cc: marcus.shawcroft@arm.com Subject: [AArch64-4.7] Backport: Implement section anchors Date: Wed, 13 Feb 2013 13:26:39 +0000 Message-Id: <1360761999-23124-1-git-send-email-james.greenhalgh@arm.com> MIME-Version: 1.0 X-MC-Unique: 113021313264503101 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 Hi, This patch is a backport of the section anchors support introduced to aarch64-branch here: http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00384.html The patch has been tested for aarch64-none-elf with only a known regression, fixed by backporting this patch by Andrew Pinski: http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00580.html Is this OK to commit to aarch64-4.7-branch? Thanks, James Greenhalgh --- gcc/ 2013-02-13 James Greenhalgh Backport from aarch64-branch. 2012-09-06 James Greenhalgh Richard Earnshaw * common/config/aarch64/aarch64-common.c (aarch_option_optimization_table): New. (TARGET_OPTION_OPTIMIZATION_TABLE): Define. * gcc/config/aarch64/aarch64-elf.h (ASM_OUTPUT_DEF): New definition. * gcc/config/aarch64/aarch64.c (TARGET_MIN_ANCHOR_OFFSET): Define. (TARGET_MAX_ANCHOR_OFFSET): Likewise. diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c index df72406..bd249e1 100644 --- a/gcc/common/config/aarch64/aarch64-common.c +++ b/gcc/common/config/aarch64/aarch64-common.c @@ -36,6 +36,17 @@ #undef TARGET_HANDLE_OPTION #define TARGET_HANDLE_OPTION aarch64_handle_option +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table + +/* Set default optimization options. */ +static const struct default_options aarch_option_optimization_table[] = + { + /* Enable section anchors by default at -O1 or higher. */ + { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Implement TARGET_HANDLE_OPTION. This function handles the target specific options for CPU/target selection. diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index 6d8b933..1c021d0 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -25,6 +25,15 @@ #define ASM_OUTPUT_LABELREF(FILE, NAME) \ aarch64_asm_output_labelref (FILE, NAME) +#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ + do \ + { \ + assemble_name (FILE, NAME1); \ + fputs (" = ", FILE); \ + assemble_name (FILE, NAME2); \ + fputc ('\n', FILE); \ + } while (0) + #define TEXT_SECTION_ASM_OP "\t.text" #define DATA_SECTION_ASM_OP "\t.data" #define BSS_SECTION_ASM_OP "\t.bss" diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1e546cc..ed5b6bb 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -7950,6 +7950,17 @@ aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode, #define TARGET_VECTORIZE_VEC_PERM_CONST_OK \ aarch64_vectorize_vec_perm_const_ok +/* Section anchor support. */ + +#undef TARGET_MIN_ANCHOR_OFFSET +#define TARGET_MIN_ANCHOR_OFFSET -256 + +/* Limit the maximum anchor offset to 4k-1, since that's the limit for a + byte offset; we can do much more for larger data types, but have no way + to determine the size of the access. We assume accesses are aligned. */ +#undef TARGET_MAX_ANCHOR_OFFSET +#define TARGET_MAX_ANCHOR_OFFSET 4095 + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-aarch64.h"