This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: After GIMPLE...


On 1/31/07, Diego Novillo <dnovillo@redhat.com> wrote:
Paulo J. Matos wrote on 01/30/07 10:11:

> Well, I spent the morning looking at the code and since what I need is
> only the flow of gcc up until I have the GIMPLE tree, I could add a
> pass after the pass which generates the gimple tree, in that pass I do
> what I need with the gimple tree and then call exit(). Would this be a
> good idea?
>
It would probably not be a good idea.  Passes are called for each
function in the callgraph.  If you stop immediately after your pass, you
will leave all the other functions unprocessed.

What is it that you want to do?  If you need dataflow information, you
probably also need to have the GIMPLE code in SSA form.


Yes, only after some search I understood that passes are done on a function by function basis which doesn't suit as is.

Well, I want to get a tree representation of the source (why gimple?
because it's language indep, so if I do it in gimple, I don't need to
worry about the language in which the source was written) and analyse
it. This analysis is not really specified at the moment. Is part of my
PhD and will certainly evolve but it would start with something like
telling the users how many variables of which type are defined in the
given source code, how many if blocks there are, etc. and then exit.
The choice of gimple is two-fold. First you get language independence,
that's why I just don't do it in C or C++ directly, or Java or
Fortran. The reason why I don't do it in a lower language is because
some constructs would be lost with some optimization details.
Constructs which might later be useful for my analysis. So, ideally, I
would like just the gcc part until the first part of the middleend
where you have a 'no optimizations', language independent AST of the
source file.
The reason why I just don't parse the gimple output of dump is
because, as it was said, there's information regarding the source
which it's not represented in the dump and which might be useful to
me.

> If yes, then the idea would be to create a pass and add it in passes.c
> after the line
> NEXT_PASS (pass_lower_cf);
>
> since from what I heard in #gcc, this is where the gimple tree is
> created, right?
>
Well, it depends on what you need.  If your pass can work in high GIMPLE
then you can insert it before that.  pass_lower_cf lowers control flow
and lexical scopes, but not EH.

Perhaps if you describe a little bit what you are trying to do, we can
give you a better idea.


I've described it above. Any suggestions regarding the best way to taylor gcc to fit my needs?

Cheers,
--
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]