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]

Generating gimple code with gimple_build_assign


I have a simple gimple question.  I am trying to introduce an array
into a gimple stream and create a pointer to that array.

I can create the array with:

	array_type = build_array_type_nelts (char_type_node, 256);
	array_var = create_tmp_var (array_type, "spill");

I can create a pointer to an array with:

	ptr_type = build_pointer_type (array_type);
	ptr_var = create_tmp_var (ptr_type, "spill");

But if I try to create an assignment to get the pointer to point to
the array I get a verify_gimple error.

I have tried:

	stmt = gimple_build_assign (ptr_var, array_var);
and
	stmt = gimple_build_assign (ptr_var, ADDR_EXPR, array_var);

but neither of those work.  I also tried making the pointer be a
pointer to char instead of a pointer to array of char but that didn't
seem to work either.  Can someone help me with the magic formula to
generate gimple code that causes ptr_var to point to array_var?
Is ADDR_EXPR the right way to get the address of the array instead of
the value in a gimple_build_assign call?

Steve Ellcey
sellcey@imgtec.com


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