This is the mail archive of the gcc-help@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]

Help forging a function in GCC


Hello there,

My name is Rodolfo Wottrich and I am currently beginning to work with
GCC, so I can implement a new idea for my master's. Somewhere I saw
that this e-mail address might be a suitable place to ask for help in
regard to understanding GCC internals, so please disregard this
message in case it doesn't fit here.

During compilation of a C file, I need to be able to create a global
function definition, with whatever a body I may have forged. I mean,
the function is not going to be present in the source file and I got
to create the respective tree structure so it can be lated gimplified
and further compiled like any other function present in the source. I
would only need to create that function in case some OpenMP directive
is encountered, so my latest and unsuccessful try to do so was to
create the tree structures for a FUNCTION_DECL and, say, a variable
declared inside the scope of that function, after the parsing of a
#pragma omp parallel in c_parser_omp_parallel() in file c-parser.c. I
followed and tried to re-create the steps I found in the function
create_omp_child_function(), in file omp-low.c, and
http://gcc.gnu.org/onlinedocs/gccint/Function-Basics.html#Function-Basics.

Summarizing: I tried to forge a function in parsing time, but
couldn't. What am I doing wrong, and how can one do such a thing?
Maybe the problem is that I create no calls to that new function, what
do you think? Anyway, I'm compiling with no active optimizations, so I
guess no optimization pass would remove my function just because it is
not being used (and I use the macro TREE_USED to set that the function
is not unused).

I hope I was clear enough and everything I said made sense. =)

Kind regards and thanks in advance,

---
Rodolfo Guilherme Wottrich
MSc. student in Computer Science
Universidade Estadual de Campinas - Unicamp


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