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]

About changing the tree structure in pragmas


Hi,

I am trying to implement a pragma that will change the tree structure
of the program. Although I looked at some basic tutorials about
implementing front-ends for gcc and looked at the implementation of
the currently available pragmas I am not well recognized with the
gcc's interface for manipulating the program's tree structure.

I will appreciate your advices on implementing the following scenario:

code example:

1: printf("Outside pragma 1");
2: #pragma test_pragma
3: {
4: /* the pragma is supposed to put 'printf("test_pragma");' just here
before all statements that follow */
5: printf("Inside pragma 1");
6: }
7: printf("Outside pragma 2");

Expected output:
Outside pragma 1
test_pragma
Inside pragma 1
Outside pragma 2

I suppose that probably there is a way to do this like:
tree* function_call = build(FUNCTION_CALL, "printf", param_list);

Also, I would be very thankful for any resources about the API for
manipulating the program's tree structure.

Thanks,
Ferad Zyulkyarov


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