Re: Modifying the datatype of a formal parameter

2011-12-19 Thread Martin Jambor
Hi,

On Sun, Dec 18, 2011 at 01:57:17PM +1100, Matt Davis wrote:
> I am using 'ipa_modify_formal_parameters()' to change the type of a function's
> formal parameter.  After my pass completes, I get a 'gimple_expand_cfg()'
> error. I must be missing some key piece here, as the failure points to a NULL
> "SA.partition_to_pseudo" value.  I also set_default_ssa_name() on the returned
> value from ipa_modify_formal_parameter (the adjustment's 'reduction' field).  
> Do
> I need to re-gimplify the function or run some kind of 'cleanup' or 'update'
> once I modify this formal parameter?

It's difficult to say without knowing what and at what stage of the
compilation you are doing.  The sad truth is that
ipa_modify_formal_parameters is very much crafted for its sole user
which is IPA-SRA and is probably quite less general than what the
original intention was.  Any pass using the function then must modify
the body itself to reflect the changes, just like IPA-SRA does.

SRA does not re-gimplify the modify functions, it just returns
TODO_update_ssa or (TODO_update_ssa | TODO_cleanup_cfg) if any EH
cleanup changed the CFG.

So I would suggest to have a look at IPA-SRA (grep for the only call
to ipa_modify_formal_parameters in tree-sra.c), especially at what you
do differently.  If you then have any further questions, feel free to
ask.

Martin


Re: Modifying the datatype of a formal parameter

2011-12-19 Thread Matt Davis
Hi Martin and thank you very much for your reply.  I do have some more
resolution to my issue.

On Mon, Dec 19, 2011 at 8:42 PM, Martin Jambor  wrote:
> Hi,
>
> On Sun, Dec 18, 2011 at 01:57:17PM +1100, Matt Davis wrote:
>> I am using 'ipa_modify_formal_parameters()' to change the type of a 
>> function's
>> formal parameter.  After my pass completes, I get a 'gimple_expand_cfg()'
>> error. I must be missing some key piece here, as the failure points to a NULL
>> "SA.partition_to_pseudo" value.  I also set_default_ssa_name() on the 
>> returned
>> value from ipa_modify_formal_parameter (the adjustment's 'reduction' field). 
>>  Do
>> I need to re-gimplify the function or run some kind of 'cleanup' or 'update'
>> once I modify this formal parameter?
>
> It's difficult to say without knowing what and at what stage of the
> compilation you are doing.

My pass is getting called as the last IPA pass
(PLUGIN_ALL_IPA_PASSES_END).  I do use the same function
"ipa_modify_formal_parameters()" to add additional parameters to
certain functions.  And it works well.

> The sad truth is that
> ipa_modify_formal_parameters is very much crafted for its sole user
> which is IPA-SRA and is probably quite less general than what the
> original intention was.  Any pass using the function then must modify
> the body itself to reflect the changes, just like IPA-SRA does.
>
> SRA does not re-gimplify the modify functions, it just returns
> TODO_update_ssa or (TODO_update_ssa | TODO_cleanup_cfg) if any EH
> cleanup changed the CFG.

Yep, and I do call update_ssa and cleanup_tree_cfg() after my pass.

> So I would suggest to have a look at IPA-SRA (grep for the only call
> to ipa_modify_formal_parameters in tree-sra.c), especially at what you
> do differently.  If you then have any further questions, feel free to
> ask.

Yeah, that was one of the first things I did.   Now, as mentioned, I
do have some more clarity on my issue.  Basically, I am just changing
the type of an existing formal parameter.  When I look at
"gimple_expand_cfg()" which is called later, I notice that the
"SA.partition_to_pseudo" for that parameter is NULL, to which
"gimple_expand_cfg()" aborts() on.  Now, that value is NULL, because
in "gimple_expand_cfg()" the function "expand_used_vars()" is called.
I need "expand_one_var()" called since that should fix-up the RTX
assigned to the parameter I am modifying.  Unfortunately, the bitmap,
"SA.partition_has_default_def" is true for the parameter, even if I do
not set it explicitly.  And since it is always set, the
"expand_one_var()" routine is never called.  I need to unset the
default def associated to the param to force "expand_one_var()" to
execute.  So, for the ssa name assigned to the parameter I am
modifying, I use SSA_NAME_IS_DEFAULT_DEF to set the flag to 'false'
This sounds like a really gross hack.  If I do this, I will need to
set a new ssa definition for the modified parameter.

-Matt


NYC: Moving and other jobs from 19$ per man on van/truck/hour,discounts for 7th and latest hours of jobtime or fix rate for whole jobs

2011-12-19 Thread support
NYC:Moving and other jobs 19$/hour/man on van/truck with no hidden fees

Our team of healthy english and russian speaking guys looking for a group or 
personal job on own minivans or rented truck
We doing deliveries and any type of movies 
>From delivery of a coach to 3 bedroom house relocation
**$19/HOUR 1 MAN ON MINIVAN+$19/TRUCK No hidden fees. All other work free
Local and long distances

WE DO NOT charge for:
-stairs
-mileage
-tools
-blankets
-etc

Call Michael (646) 515-3056 any time 24/7 
my Email:  ourkons...@yahoo.co.uk






SKILLS RYTMIKO and intonation COMMUNICATIVE EXERCISES PREDTEKSTOVYE EXERCISES

Possible wrong-way example in gcc4-4-2 documentation of __builtin_expect

2011-12-19 Thread Jim Avera

Hello,

The online docs at
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Other-Builtins.html
has a confusing (to me) example of __builtin_expect.  Could someone take 
a look at this?



  Since you are limited to integral expressions for exp, you should
  use constructions such as

  if (__builtin_expect (ptr != NULL, 1))
error ();


This seems backwards.The return value of __builtin_expect
is the first argument, namely (ptr != NULL), which presumably is true in 
the NON-error case.   The following example might be more helpful:


  if (__builtin_expect (ptr == NULL, 0))
error ();

Apologies if I'm not reading this correctly.

-Jim