This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GCC RFC]A new and simple pass merging paired load store instructions
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: "bin.cheng" <bin dot cheng at arm dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 May 2014 22:54:09 +0200
- Subject: Re: [GCC RFC]A new and simple pass merging paired load store instructions
- Authentication-results: sourceware.org; auth=none
- References: <004d01cf700e$ef1e30e0$cd5a92a0$ at arm dot com> <9446DE1C-BBEC-407F-8F14-3E7D9B781905 at t-online dot de> <CAHFci2_oP587otaOCUa5oQGDV+U5fLpv6Jn-mT03sHE70Gdm8g at mail dot gmail dot com>
On Fri, 2014-05-16 at 18:10 +0800, Bin.Cheng wrote:
> On Thu, May 15, 2014 at 6:31 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> >
> > How about the following.
> > Instead of adding new hooks and inserting the pass to the general pass list, make the new
> > pass class take the necessary callback functions directly. Then targets can just instantiate
> > the pass, passing their impl of the callbacks, and insert the pass object into the pass list at
> > a place that fits best for the target.
> Oh, I don't know we can do this in GCC. But yes, a target may want to
> run it at some place that fits best for the target.
>
I think it's better than trying to come up with a scheme that so-so fits
all. My idea would look like:
// merge_paired_loadstore.h
class merge_paired_loadstore : public rtl_opt_pass
{
public:
struct delegate
{
virtual bool merge_paired_loadstore (rtx x, rtx y, ...) = 0;
...
};
merge_paired_loadstore (gcc::context* ctx, const char* name,
delegate* d);
...
};
// <target>.cc
#include "merge_paired_loadstore.h"
static struct target_merge_loadstore_delegate :
merge_paired_loadstore::delegate
{
virtual bool merge_paired_loadstore (...)
{
// code as if this was a freestanding target hook function
};
} g_merge_loadstore_delegate;
static void <target>_register_passes (void)
{
register_pass (
new merge_paired_loadstore (g, "merge_ls",
&g_merge_loadstore_delegate),
PASS_POS_INSERT_AFTER, "other pass", 1);
}
Then, later, maybe sometime in the future, if there's something like a
class target, it'd look like:
class my_target : public target,
merge_paired_loadstore::delegate
{
...
virtual bool merge_paired_loadstore (...);
};
Maybe it's a bit far fetched at the moment, but it would be a start.
Cheers,
Oleg