I'm trying to generate calls to "free" on the fly at ipa time.
I've tried several things (given below) but they both fail
in expand_call_inline in tree-inline.c on this gcc_checking_assert:
cg_edge = id->dst_node->get_edge (stmt);
gcc_checking_assert (cg_edge);
Now, I've tried using the built in free via:
tree fndecl_free = builtin_decl_explicit( BUILT_IN_FREE);
// Note to_free is set between here and the call by an assign
tree to_free =
make_temp_ssa_name( reorg_pointer_type, NULL, "malloc_to_free");
.
.
gcall *free_call = gimple_build_call( fndecl_free, 1, to_free);
or building the fndecl from scrath:
tree fntype = build_function_type ( free_return_type, param_type_list);
tree fnname = get_identifier ( "free");
tree fndecl_free =
build_decl ( input_location, FUNCTION_DECL, fnname, fntype);
gcall *free_call = gimple_build_call( fndecl_free, 1, to_free);
Note, I was able to get something similar to work for "malloc" by
using the fndecl I extracted from an existing malloc call.
Your advice on how to build a fndecl that doesn't have this
problem is appreciated.
Thanks,
Gary Oblock
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for
the sole use of the intended recipient(s) and contains information that is
confidential and proprietary to Ampere Computing or its subsidiaries. It is to
be used solely for the purpose of furthering the parties' business
relationship. Any review, copying, or distribution of this email (or any
attachments thereto) is strictly prohibited. If you are not the intended
recipient, please contact the sender immediately and permanently delete the
original and any copies of this email and any attachments thereto.