On Tue, 2005-08-30 at 10:52 +0000, Ferenc Kovacs wrote:
> Hello!
> 
> I'm implementing a new IPA phase in GCC-4.1. I need to pass the address
> of a variable found in the stmt list to a newly created function (eg.
> "f") like this:
> 
> {
>   int x; /* ordinary non-pointertype local vars */
>   int y;
> 
>   [...]
> 
>   x = 5;
>   y = x + 9;
>   f (&x); /* new call stmt inserted to the stmt list */
> 
>   [...]
> }
> 
> I used the build_addr function to build the address of that variable
> used in the parameter list of the new function "f" and bsi_insert_... to
> insert the call. Anyway, I don't really know doing things like these are
> possible when we're still in the IPA stage...

Sure, they are.

>  ^^ So, I got these error
> messages:
> 
> [...]
> /home/feri/tmp/hello.c:118: error: invalid operand to binary operator
> x
> 
> /home/feri/tmp/hello.c:118: internal compiler error: verify_stmts failed
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> [...]
> 
> is_gimple_val returns false to the variable "x", becouse
> needs_to_live_in_memory (the build_addr sets the TREE_ADDRESSABLE flag)
> gives true to is_gimple_reg and this way is_gimple_reg returns false. I
> tried to manually set the TREE_ADDRESSABLE flag of "x" and not to insert
> any stmt containing the address of "x", but without "&x" I didn't get
> this error. It seems, that "x" is not a valid gimple rvalue. How can I
> make "x" a real gimple rvalue again?

You have to copy it.

IE
x = 5
y = x + 9
x.0 = x
f (&x)
x = x.0

We don't allow mixing of things that need to live in memory, and things
that don't, in binary operators.
It would be complete mess.


Reply via email to