public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Uros Bizjak <ubizjak@gmail.com>,	Jeff Law <law@redhat.com>,
	Richard Biener <rguenther@suse.de>,
	Richard Earnshaw <richard.earnshaw@arm.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Richard Sandiford <richard.sandiford@arm.com>,
	Torsten Duwe <duwe@suse.de>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Eric Botcazou <ebotcazou@libertysurf.fr>
Subject: [PATCH 0/3] Update -fpatchable-function-entry implementation
Date: Wed, 05 Feb 2020 14:33:00 -0000	[thread overview]
Message-ID: <20200205143300.144541-1-hjl.tools@gmail.com> (raw)

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

             reply	other threads:[~2020-02-05 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 14:33 H.J. Lu [this message]
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
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200205143300.144541-1-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=duwe@suse.de \
    --cc=ebotcazou@libertysurf.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    --cc=rguenther@suse.de \
    --cc=richard.earnshaw@arm.com \
    --cc=richard.sandiford@arm.com \
    --cc=szabolcs.nagy@arm.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).