This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: generating functions and eh region
On Wed, 01 Apr 2009 08:56:49 -0700, Ian Lance Taylor <iant@google.com>
wrote:
> "Vincent R." <forumer@smartmobili.com> writes:
>
>> Yes I think I don't explain things very clearly, so what is important to
>> know is that the __except keyword
>> can be passed instructions(case 1) or directly a function(case 2).
>
> I see that but I don't see why it matters.
To me it seems important but I am not a gcc hacker
>
>
>> in the case 1) ie if you declare something like :
>>
>> ...
>> __except( printf("hello gcc"), 1)
>>
>> and I look at asm generated I can notice that the instructions inside
the
>> patenthesis will be put inside a function
>> because I can notice a prologue and epilogue.
>
> What asm are you looking at?
>
The one in my previous email.
> gcc will do the right thing if you put statements in an exception
> region.
Hum how gcc can do that kind of things, is it some kind of voodoo ?
__except is not implemented yet and is more than a language construct
because it's an
OS thing.
So maybe I need to say it once again, instructions inside __except needs to
be
put inside a function by the compiler .
Let's imagine seh were designed differently, I mean for instance let's say
instead
of putting instructions in a function it would put ins directly without any
prologue and epilogue
would you still tell me that eh region will do what I need.
On what parameters does eh region choose to add or not epilogue/prologue ?
Or maybe we can pass some information to eh_region stuff to tell him it's a
function and in this case
I could understand that it's not magic.
Ok so now forget my previous questions, seh and so on.
I am going to express my problem differently, let's say I want to developp
a tool based on GCC
and used to tranform code.
I mean it would parse source code and if it detects __transform keyword
make some tranformation,
generate IL and then output the tranformed source code.
Original code is :
int main()
{
__transform( printf("hello"); printf("world"), 10 );
}
and I would like to obtain
int main()
{
}
int func1()
{
printf("hello");
printf("world");
return 10
}
So my question is when parsing source code and when detetcing __transform
keyword you agree that
I need to generate a function and put instructions in it.
So in this case should we use start_function ?
Don't tell me to use eh region or I am getting depressed.