From e67d3d383449dc4680615e44098577f45944e4dc Mon Sep 17 00:00:00 2001 From: uros Date: Sun, 14 May 2017 10:22:08 +0000 Subject: gcc/ChangeLog: * config/i386/i386.opt: Add option -mcall-ms2sysv-xlogues. * config/i386/i386.h (x86_64_ms_sysv_extra_clobbered_registers): Change type to unsigned. (NUM_X86_64_MS_CLOBBERED_REGS): New macro. (struct machine_function): Add new members call_ms2sysv, call_ms2sysv_pad_in, call_ms2sysv_pad_out and call_ms2sysv_extra_regs. (struct machine_frame_state): New fields sp_realigned and sp_realigned_offset. * config/i386/i386.c (enum xlogue_stub): New enum. (enum xlogue_stub_sets): New enum. (class xlogue_layout): New class. (struct ix86_frame): New fields stack_realign_allocate_offset, stack_realign_offset and outlined_save_offset. Modify comments to detail stack layout when using out-of-line stubs. (ix86_target_string): Add -mcall-ms2sysv-xlogues option. (ix86_option_override_internal): Add sorry() for TARGET_SEH and -mcall-ms2sysv-xlogues. (stub_managed_regs): New static variable. (ix86_save_reg): Add new parameter ignore_outlined to optionally omit registers managed by out-of-line stub. (disable_call_ms2sysv_xlogues): New function. (ix86_compute_frame_layout): Modify re-alignment calculations, disable m->call_ms2sysv when appropriate and compute frame layout for out-of-line stubs. (sp_valid_at, fp_valid_at): New inline functions. (choose_basereg): New function. (choose_baseaddr): Add align parameter, use choose_basereg and modify all callers. (ix86_emit_save_reg_using_mov, ix86_emit_restore_sse_regs_using_mov): Use align parameter of choose_baseaddr to generated aligned SSE movs when possible. (pro_epilogue_adjust_stack): Modify to track machine_frame_state::sp_realigned. (ix86_nsaved_regs): Modify to accommodate changes to ix86_save_reg. (ix86_nsaved_sseregs): Likewise. (ix86_emit_save_regs): Likewise. (ix86_emit_save_regs_using_mov): Likewise. (ix86_emit_save_sse_regs_using_mov): Likewise. (get_scratch_register_on_entry): Likewise. (gen_frame_set): New function. (gen_frame_load): Likewise. (gen_frame_store): Likewise. (emit_outlined_ms2sysv_save): Likewise. (emit_outlined_ms2sysv_restore): Likewise. (ix86_expand_prologue): Modify stack re-alignment code and call emit_outlined_ms2sysv_save when appropriate. (ix86_emit_leave): Clear machine_frame_state::sp_realigned. Add parameter rtx_insn *insn, which allows the function to be used to only generate the notes. (ix86_expand_epilogue): Modify validity checks of frame and stack pointers, and call emit_outlined_ms2sysv_restore when appropriate. (ix86_expand_call): Modify to enable m->call_ms2sysv when appropriate. * config/i386/predicates.md (save_multiple): New predicate. (restore_multiple): Likewise. * config/i386/sse.md (save_multiple): New pattern. (save_multiple_realign): Likewise. (restore_multiple): Likewise. (restore_multiple_and_return): Likewise. (restore_multiple_leave_return): Likewise. * Makefile.in: Export HOSTCXX and HOSTCXXFLAGS to site.exp gcc/testsuite/ChangeLog: * gcc.target/x86_64/abi/ms-sysv/do-test.S: New file. * gcc.target/x86_64/abi/ms-sysv/gen.cc: Likewise. * gcc.target/x86_64/abi/ms-sysv/ms-sysv.c: Likewise. * gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp: Likewise. libgcc/ChangeLog: * config.host: Add i386/t-msabi to i386/t-linux file list. * config/i386/i386-asm.h: New file. * config/i386/resms64.S: New file. * config/i386/resms64f.S: New file. * config/i386/resms64fx.S: New file. * config/i386/resms64x.S: New file. * config/i386/savms64.S: New file. * config/i386/savms64f.S: New file. * config/i386/t-msabi: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248029 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/i386/i386.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'gcc/config/i386/i386.h') diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 9e5f4d857d9..5366f1fc88f 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2163,7 +2163,9 @@ extern int const dbx_register_map[FIRST_PSEUDO_REGISTER]; extern int const dbx64_register_map[FIRST_PSEUDO_REGISTER]; extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; -extern int const x86_64_ms_sysv_extra_clobbered_registers[12]; +extern unsigned const x86_64_ms_sysv_extra_clobbered_registers[12]; +#define NUM_X86_64_MS_CLOBBERED_REGS \ + (ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers)) /* Before the prologue, RA is at 0(%esp). */ #define INCOMING_RETURN_ADDR_RTX \ @@ -2482,6 +2484,17 @@ struct GTY(()) machine_frame_state set, the SP/FP offsets above are relative to the aligned frame and not the CFA. */ BOOL_BITFIELD realigned : 1; + + /* Indicates whether the stack pointer has been re-aligned. When set, + SP/FP continue to be relative to the CFA, but the stack pointer + should only be used for offsets >= sp_realigned_offset, while + the frame pointer should be used for offsets < sp_realigned_offset. + The flags realigned and sp_realigned are mutually exclusive. */ + BOOL_BITFIELD sp_realigned : 1; + + /* If sp_realigned is set, this is the offset from the CFA that the + stack pointer was realigned to. */ + HOST_WIDE_INT sp_realigned_offset; }; /* Private to winnt.c. */ @@ -2565,6 +2578,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 call_ms2sysv : 1; + + /* If true, the incoming 16-byte aligned stack has an offset (of 8) and + needs padding. */ + BOOL_BITFIELD call_ms2sysv_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 call_ms2sysv_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 call_ms2sysv_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; -- cgit v1.2.1