public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Update -fpatchable-function-entry implementation
@ 2020-02-05 14:33 H.J. Lu
  2020-02-05 14:33 ` [PATCH 1/3] x86: Add UNSPECV_PATCHABLE_AREA H.J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: H.J. Lu @ 2020-02-05 14:33 UTC (permalink / raw)
  To: gcc-patches
  Cc: Uros Bizjak, Jeff Law, Richard Biener, Richard Earnshaw,
	Jakub Jelinek, Richard Sandiford, Torsten Duwe, Szabolcs Nagy,
	Eric Botcazou

The current -fpatchable-function-entry implementation is done almost
behind the backend back.  Backend doesn't know if and where patchable
area will be generated during RTL passes.

TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY is only used to print out
assembly codes for patchable area.   This leads to wrong codes with
-fpatchable-function-entry:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92424
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93492

Also .cfi_startproc and DWARF info are at the wrong places when
-fpatchable-function-entry is used.

This patch set has 3 parts:

1. Add a pseudo UNSPECV_PATCHABLE_AREA instruction and define
TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY to work around the
-fpatchable-function-entry implementation deficiency.
2. Add patch_area_size and patch_area_entry to cfun to make the 
patchable area info is available in RTL passes so that backend
can handle patchable area properly.  It also limits patch_area_size
and patch_area_entry to 65535, which is a reasonable maximum size
for patchable area.  Other backends can also use it properly generate
patchable area.
3. Remove workaround in UNSPECV_PATCHABLE_AREA generation. 

If the patch set is acceptable, I can combine patch 1 and patch 3
into a single patch.

H.J. Lu (3):
  x86: Add UNSPECV_PATCHABLE_AREA
  Add patch_area_size and patch_area_entry to cfun
  x86: Simplify UNSPECV_PATCHABLE_AREA generation

 gcc/config/i386/i386-features.c               | 130 ++++++++++++------
 gcc/config/i386/i386-passes.def               |   2 +-
 gcc/config/i386/i386-protos.h                 |   5 +-
 gcc/config/i386/i386.c                        |  51 ++++++-
 gcc/config/i386/i386.h                        |  14 +-
 gcc/config/i386/i386.md                       |  17 +++
 gcc/doc/invoke.texi                           |   1 +
 gcc/function.c                                |  35 +++++
 gcc/function.h                                |   6 +
 gcc/opts.c                                    |   4 +-
 .../patchable_function_entry-error-1.c        |   9 ++
 .../patchable_function_entry-error-2.c        |   9 ++
 .../patchable_function_entry-error-3.c        |  20 +++
 gcc/testsuite/gcc.target/i386/pr93492-1.c     |  73 ++++++++++
 gcc/testsuite/gcc.target/i386/pr93492-2.c     |  12 ++
 gcc/testsuite/gcc.target/i386/pr93492-3.c     |  13 ++
 gcc/testsuite/gcc.target/i386/pr93492-4.c     |  11 ++
 gcc/testsuite/gcc.target/i386/pr93492-5.c     |  12 ++
 gcc/varasm.c                                  |  30 +---
 19 files changed, 375 insertions(+), 79 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/patchable_function_entry-error-1.c
 create mode 100644 gcc/testsuite/c-c++-common/patchable_function_entry-error-2.c
 create mode 100644 gcc/testsuite/c-c++-common/patchable_function_entry-error-3.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93492-1.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93492-2.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93492-3.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93492-4.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr93492-5.c

-- 
2.24.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-02  1:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 14:33 [PATCH 0/3] Update -fpatchable-function-entry implementation H.J. Lu
2020-02-05 14:33 ` [PATCH 1/3] x86: Add UNSPECV_PATCHABLE_AREA H.J. Lu
2020-02-05 14:33 ` [PATCH 3/3] x86: Simplify UNSPECV_PATCHABLE_AREA generation H.J. Lu
2020-02-05 14:33 ` [PATCH 2/3] Add patch_area_size and patch_area_entry to cfun H.J. Lu
2020-02-05 17:00   ` Richard Sandiford
2020-02-05 20:21     ` [PATCH] Add patch_area_size and patch_area_entry to crtl H.J. Lu
2020-02-05 22:25       ` H.J. Lu
2020-02-05 22:37         ` Marek Polacek
2020-02-05 22:52           ` H.J. Lu
2020-02-05 22:55             ` H.J. Lu
2020-02-06  8:01               ` Richard Sandiford
2020-05-02  1:23                 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).