public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Using the GCC IR
@ 2004-02-09 19:29 lrtaylor
  2004-02-09 19:33 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: lrtaylor @ 2004-02-09 19:29 UTC (permalink / raw)
  To: ian, rgulati; +Cc: gcc-help

"GPL side-stepping"?  What do you mean?

Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Ian Lance Taylor
Sent: Friday, February 06, 2004 10:19 PM
To: Rohit Gulati
Cc: gcc-help@gcc.gnu.org
Subject: Re: Using the GCC IR

"Rohit Gulati" <rgulati@cadence.com> writes:

> Can I get access to the IR generated by GCC. I know how to dump the
> IR to file. Is there a way to access the IR in memory (walk the IR).

Well, sure.  gcc code does it all the time.  Look at the source, and
read the internals manual.

There is no way to have gcc write out the internal representation,
modify it yourself, and then invoke the backend on the result.  gcc
does not read in the internal representation.  This is intentional,
due to concerns about GPL side-stepping.

Ian

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

* Re: Using the GCC IR
  2004-02-09 19:29 Using the GCC IR lrtaylor
@ 2004-02-09 19:33 ` Ian Lance Taylor
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2004-02-09 19:33 UTC (permalink / raw)
  To: lrtaylor; +Cc: rgulati, gcc-help

lrtaylor@micron.com writes:

> "GPL side-stepping"?  What do you mean?

If it were easy to have gcc write out and read in the internal
representation, either trees or RTL, then it would be easy for
somebody to write proprietary code which did new compiler
optimizations.  They would modify gcc to write out the RTL, they would
process the RTL in some proprietary manner, and then they would tell
gcc to read in the RTL and finish the processing.  The result would
essentially be an enhanced gcc some of which was proprietary, which is
exactly what the GPL is supposed to prevent.

Ian

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
> Behalf Of Ian Lance Taylor
> Sent: Friday, February 06, 2004 10:19 PM
> To: Rohit Gulati
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Using the GCC IR
> 
> "Rohit Gulati" <rgulati@cadence.com> writes:
> 
> > Can I get access to the IR generated by GCC. I know how to dump the
> > IR to file. Is there a way to access the IR in memory (walk the IR).
> 
> Well, sure.  gcc code does it all the time.  Look at the source, and
> read the internals manual.
> 
> There is no way to have gcc write out the internal representation,
> modify it yourself, and then invoke the backend on the result.  gcc
> does not read in the internal representation.  This is intentional,
> due to concerns about GPL side-stepping.

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

* RE: Using the GCC IR
@ 2004-02-09 19:42 lrtaylor
  0 siblings, 0 replies; 5+ messages in thread
From: lrtaylor @ 2004-02-09 19:42 UTC (permalink / raw)
  To: ian; +Cc: gcc-help

Makes sense.  Although, it seems odd to me to explicitly try to design a
piece of open source software to enforce a particular license via
internal design decisions.  Seems time would be better spent just making
good design decisions to make a great product.  It's always easy to
violate the GPL...

No matter.  I'm not trying to start a discussion on the topic.  Just
wondered what you meant.

Thanks,
Lyle

-----Original Message-----
From: Ian Lance Taylor [mailto:ian@wasabisystems.com] 
Sent: Monday, February 09, 2004 12:33 PM
To: lrtaylor
Cc: rgulati@cadence.com; gcc-help@gcc.gnu.org
Subject: Re: Using the GCC IR

lrtaylor@micron.com writes:

> "GPL side-stepping"?  What do you mean?

If it were easy to have gcc write out and read in the internal
representation, either trees or RTL, then it would be easy for
somebody to write proprietary code which did new compiler
optimizations.  They would modify gcc to write out the RTL, they would
process the RTL in some proprietary manner, and then they would tell
gcc to read in the RTL and finish the processing.  The result would
essentially be an enhanced gcc some of which was proprietary, which is
exactly what the GPL is supposed to prevent.

Ian

> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]
On
> Behalf Of Ian Lance Taylor
> Sent: Friday, February 06, 2004 10:19 PM
> To: Rohit Gulati
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Using the GCC IR
> 
> "Rohit Gulati" <rgulati@cadence.com> writes:
> 
> > Can I get access to the IR generated by GCC. I know how to dump the
> > IR to file. Is there a way to access the IR in memory (walk the IR).
> 
> Well, sure.  gcc code does it all the time.  Look at the source, and
> read the internals manual.
> 
> There is no way to have gcc write out the internal representation,
> modify it yourself, and then invoke the backend on the result.  gcc
> does not read in the internal representation.  This is intentional,
> due to concerns about GPL side-stepping.

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

* Re: Using the GCC IR
  2004-02-07  3:28 Rohit Gulati
@ 2004-02-07  5:19 ` Ian Lance Taylor
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2004-02-07  5:19 UTC (permalink / raw)
  To: Rohit Gulati; +Cc: gcc-help

"Rohit Gulati" <rgulati@cadence.com> writes:

> Can I get access to the IR generated by GCC. I know how to dump the
> IR to file. Is there a way to access the IR in memory (walk the IR).

Well, sure.  gcc code does it all the time.  Look at the source, and
read the internals manual.

There is no way to have gcc write out the internal representation,
modify it yourself, and then invoke the backend on the result.  gcc
does not read in the internal representation.  This is intentional,
due to concerns about GPL side-stepping.

Ian

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

* Using the GCC IR
@ 2004-02-07  3:28 Rohit Gulati
  2004-02-07  5:19 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Rohit Gulati @ 2004-02-07  3:28 UTC (permalink / raw)
  To: gcc-help

Hi,
 
I want to run g++ on a C++ source file and then WALK the IR generated by GCC to do further processing and finally call the backend to do its job. Basically add a linter to do specific checks in my C++ code.
 
Can I get access to the IR generated by GCC. I know how to dump the IR to file. Is there a way to access the IR in memory (walk the IR).
 
I am interested in :
1. Access all classes/structs in file scope
2. Detailed Type information (base_classes, member routines, member fields, etc)
3. Detail Routine info (statements and expressions)
4. Map objects to their source code decls (file, line, col number)
5. etc,
 
Is it possible. Is there a way to walk the GCC IR? I could not find any info on the web or gnu.org. so I am sending an email to you. This is extremely important for my next project.
 
One alternative I have is to use the EDG (Edison Compile Group) IR. They provide a nice way to walk the IR. Their primary business is frontend. 
 
But I was really hoping I could use GCC IR for it. I am sure something must be out there. Just want to know what.
 
thanks
Rohit

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

end of thread, other threads:[~2004-02-09 19:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-09 19:29 Using the GCC IR lrtaylor
2004-02-09 19:33 ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2004-02-09 19:42 lrtaylor
2004-02-07  3:28 Rohit Gulati
2004-02-07  5:19 ` 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).