public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Extending GCC with new optimization
@ 2012-08-17  8:38 Tomasz Jankowski
  2012-08-18 17:09 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Jankowski @ 2012-08-17  8:38 UTC (permalink / raw)
  To: gcc-help

Hello,

For one of my projects at university I have to create specific
optimization for GCC (in general I have to find arithmetic operations
in basic blocks and modify them a bit). I have some idea about
compilation process etc. but i't more theoretical then practical
knowledge.

Now I'm slowly learning about GCC internals and as I see I can
"easily" solve my problem by writing plugin in C. On the other hand I
found MELT project. At the moment I'm in point in which I'm not sure
which path I should choose: write MELT extension or write plugin in C.
I can also mention that my target is GCC 4.5.

Actually I don't know how can I treat plugins support in GCC. It's
low-level infrastructure for projects like MELT or straight way to
write static optimization?

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

* Re: Extending GCC with new optimization
  2012-08-17  8:38 Extending GCC with new optimization Tomasz Jankowski
@ 2012-08-18 17:09 ` Ian Lance Taylor
  2012-08-21 22:57   ` Tomasz Jankowski
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2012-08-18 17:09 UTC (permalink / raw)
  To: Tomasz Jankowski; +Cc: gcc-help

On Fri, Aug 17, 2012 at 12:22 AM, Tomasz Jankowski <tomcioj@gmail.com> wrote:
>
> For one of my projects at university I have to create specific
> optimization for GCC (in general I have to find arithmetic operations
> in basic blocks and modify them a bit). I have some idea about
> compilation process etc. but i't more theoretical then practical
> knowledge.
>
> Now I'm slowly learning about GCC internals and as I see I can
> "easily" solve my problem by writing plugin in C. On the other hand I
> found MELT project. At the moment I'm in point in which I'm not sure
> which path I should choose: write MELT extension or write plugin in C.
> I can also mention that my target is GCC 4.5.
>
> Actually I don't know how can I treat plugins support in GCC. It's
> low-level infrastructure for projects like MELT or straight way to
> write static optimization?

Both approaches will work.  Which you adopt depends on your preferences.

GCC plugins are not only to support projects like MELT, they are also
for direct use.

Ian

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

* Re: Extending GCC with new optimization
  2012-08-18 17:09 ` Ian Lance Taylor
@ 2012-08-21 22:57   ` Tomasz Jankowski
  2012-08-22  7:51     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Jankowski @ 2012-08-21 22:57 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Hello,

I'm investigating where to start and I'm overwhelmed with compilation
process, so I'd like to ask you on which passes I should focus and
where I actually should start.

I have to find arithmetical operations in input source code and
implement them using specific processor instructions on my CPU.

First of all I don't see any pass related to RTL representation in GCC
plugin events (file plugin.def), so is it possible to create GC plugin
modifying RTL representation at all?

Anyway, I should:

1. Add somehow (so far I don't know how) custom CPU instructions to GCC code.
2. Operate on RTL representation of basic blocks (I can modify RTL
representations by adding and removing instructions?).

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

* Re: Extending GCC with new optimization
  2012-08-21 22:57   ` Tomasz Jankowski
@ 2012-08-22  7:51     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2012-08-22  7:51 UTC (permalink / raw)
  To: Tomasz Jankowski; +Cc: gcc-help

On Tue, Aug 21, 2012 at 2:10 PM, Tomasz Jankowski <tomcioj@gmail.com> wrote:
>
> I'm investigating where to start and I'm overwhelmed with compilation
> process, so I'd like to ask you on which passes I should focus and
> where I actually should start.
>
> I have to find arithmetical operations in input source code and
> implement them using specific processor instructions on my CPU.

That sounds like a machine-specific issue that could be implemented in
your CPU.md file.  It depends on what you mean by "arithmetical
operations," I suppose.

> First of all I don't see any pass related to RTL representation in GCC
> plugin events (file plugin.def), so is it possible to create GC plugin
> modifying RTL representation at all?

Call register_pass.

> 1. Add somehow (so far I don't know how) custom CPU instructions to GCC code.

Adding new CPU instructions is entirely a function of the CPU.md file.
 That is something that you can not do using a plugin.

> 2. Operate on RTL representation of basic blocks (I can modify RTL
> representations by adding and removing instructions?).

Yes.

Ian

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

end of thread, other threads:[~2012-08-21 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-17  8:38 Extending GCC with new optimization Tomasz Jankowski
2012-08-18 17:09 ` Ian Lance Taylor
2012-08-21 22:57   ` Tomasz Jankowski
2012-08-22  7:51     ` Ian Lance Taylor

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).