This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Generating gimple code with gimple_build_assign
- From: "Steve Ellcey " <sellcey at imgtec dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 6 Apr 2015 10:29:02 -0700
- Subject: Generating gimple code with gimple_build_assign
- Authentication-results: sourceware.org; auth=none
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