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: gcc help


Andrew wrote:
I need to add a special code to your GCC program. This code gatheres information about all variables (their names, ranges and name spaces which they belong to) and opetators (which use those variables), and insert all this information to a database.
Could you please point me the best place it can be done.

There is no easy answer to this question. There is no easy place to get all of the info you want. The info is in different places in different front ends and in different gcc versions. You will have to spend quite a bit of time looking at gcc sources in order to be successful at modifying it.


Getting variable declarations isn't too hard. They all have to do into the symbol table anyways, so the symbol represents a single place you can look for the info. See for instance pushdecl in the C front end. Pretty much every variable declaration goes through this. See also pushlevel and poplevel. These maintain the BLOCK trees that hold the scoping info for variables.

The other of this, keeping track of operators, is much harder. I don't think there is any single place you can hook in with current gcc for this info. Maybe on the tree-ssa branch it is better.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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