From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46886 invoked by alias); 15 Nov 2016 20:03:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 46843 invoked by uid 89); 15 Nov 2016 20:03:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Outline, expense, H*Ad:D*pobox.com, Hx-languages-length:3721 X-HELO: sasl.smtp.pobox.com Received: from pb-smtp2.pobox.com (HELO sasl.smtp.pobox.com) (64.147.108.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Nov 2016 20:03:30 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4C0BB4E2C8; Tue, 15 Nov 2016 15:03:29 -0500 (EST) Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4272C4E2C7; Tue, 15 Nov 2016 15:03:29 -0500 (EST) Received: from localhost.localdomain (unknown [76.215.41.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id A47EA4E2C3; Tue, 15 Nov 2016 15:03:27 -0500 (EST) From: Daniel Santos To: gcc-patches Cc: Daniel Santos Subject: [PATCH 4/9] Add struct fields and option for foutline-msabi-xlouges Date: Tue, 15 Nov 2016 20:03:00 -0000 Message-Id: <20161115200700.10792-4-daniel.santos@pobox.com> In-Reply-To: <79f0ea00-ed47-1ee3-8efd-f57027426970@pobox.com> References: <79f0ea00-ed47-1ee3-8efd-f57027426970@pobox.com> X-Pobox-Relay-ID: 9357B4FE-AB6E-11E6-B785-3AB77A1B28F4-06139138!pb-smtp2.pobox.com X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg01532.txt.bz2 Adds fountline-msabi-xlogues to common.opt and various fields to structs machine_function and ix86_frame --- gcc/common.opt | 7 +++++++ gcc/config/i386/i386.c | 35 ++++++++++++++++++++++++++++++----- gcc/config/i386/i386.h | 18 ++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index 5e8d72d..e9570b0 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -3075,4 +3075,11 @@ fipa-ra Common Report Var(flag_ipa_ra) Optimization Use caller save register across calls if possible. +foutline-msabi-xlogues +Common Report Var(flag_outline_msabi_xlogues) Optimization +Outline pro/epilogues to save/restore registers clobbered by calling +sysv_abi functions from within a 64-bit ms_abi function. This reduces +.text size at the expense of a few more instructions being executed +per function. + ; This comment is to ensure we retain the blank line above. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5ed8fb6..4cc3c8f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2449,13 +2449,37 @@ struct GTY(()) stack_local_entry { saved frame pointer if frame_pointer_needed <- HARD_FRAME_POINTER - [saved regs] - <- regs_save_offset - [padding0] + [Normal case: - [saved SSE regs] + [saved regs] + <- regs_save_offset + [padding0] + + [saved SSE regs] + + ][ms x64 --> sysv with -foutline-msabi-xlogues: + [padding0] + <- Start of out-of-line, stub-saved/restored regs + (see libgcc/config/i386/msabi.S) + [XMM6-15] + [RSI] + [RDI] + [?RBX] only if RBX is clobbered + [?RBP] only if RBP and RBX are clobbered + [?R12] only if R12 and all previous regs are clobbered + [?R13] only if R13 and all previous regs are clobbered + [?R14] only if R14 and all previous regs are clobbered + [?R15] only if R15 and all previous regs are clobbered + <- end of stub-saved/restored regs + [padding1] + <- outlined_save_offset + [saved regs] Any remaning regs are saved in-line + <- regs_save_offset + [saved SSE regs] not yet verified, but I *think* that there should be no + other SSE regs to save here. + ] <- sse_regs_save_offset - [padding1] | + [padding2] | <- FRAME_POINTER [va_arg registers] | | @@ -2477,6 +2501,7 @@ struct ix86_frame HOST_WIDE_INT hard_frame_pointer_offset; HOST_WIDE_INT stack_pointer_offset; HOST_WIDE_INT hfp_save_offset; + HOST_WIDE_INT outlined_save_offset; HOST_WIDE_INT reg_save_offset; HOST_WIDE_INT sse_reg_save_offset; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index a45b66a..e6b79df 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2575,6 +2575,24 @@ struct GTY(()) machine_function { pass arguments and can be used for indirect sibcall. */ BOOL_BITFIELD arg_reg_available : 1; + /* If true, we're out-of-lining reg save/restore for regs clobbered + by ms_abi functions calling a sysv function. */ + BOOL_BITFIELD outline_ms_sysv : 1; + + /* If true, the incoming 16-byte aligned stack has an offset (of 8) and + needs padding. */ + BOOL_BITFIELD outline_ms_sysv_pad_in : 1; + + /* If true, the size of the stub save area plus inline int reg saves will + result in an 8 byte offset, so needs padding. */ + BOOL_BITFIELD outline_ms_sysv_pad_out : 1; + + /* This is the number of extra registers saved by stub (valid range is + 0-6). Each additional register is only saved/restored by the stubs + if all successive ones are. (Will always be zero when using a hard + frame pointer.) */ + unsigned int outline_ms_sysv_extra_regs:3; + /* During prologue/epilogue generation, the current frame state. Otherwise, the frame state at the end of the prologue. */ struct machine_frame_state fs; -- 2.9.0