I am working on a gcc-plugin where I need to create a structure at compile time.
I have gleaned over one of the front ends to learn more about creating
structures at compile time.  What I have thus far is a type node for my struct.

I now need to create an instance of this struct.  For exemplary purposes we will
call this type 'struct T' and we will call the instance of T, 'my_T'  By using
the build_constructor() routine in GCC I create an instance, my_T, which I need
to pass the address of to a function.  So, I take this decl, my_T, and pass it 
to 
build_fold_addr_expr().  The result of the latter is what I pass to the
function 'fn()'.

Yes, the function I am passing the reference to is expecting the proper type,
that of address-to-T.  Running this presents me with an error in
expand_expr_real_1() where "Variables inherited from containing functions should
have been lowered by this point."

So, I figure, if I create a temp variable, 'V', of type pointer-to-T, and run
make_ssa_name() on that temp.  And then insert an assignment before the call to
fn, so I get: 'V = &my_T;'  After looking at the GIMPLE dump, I see, 'V = &my_T;
fn(V);'  Which is correct, however, in the type list of the caller, I only see:
'struct * V;'  Now, this concerns me, I would expect to see "struct T *V;"  As
above, this case also fails.

I am baffled, do I need to even be creating the ssa_name instance to pass to
'fn()', which is 'V' in the case above?  Or, will the build_constructor()
produce a tree node that I can treat as a variable, that I can pass to 'fn()' ? 
 

-Matt

Reply via email to