On 12/4/20 4:33 PM, Martin Sebor wrote:
I'm looking for a way to get the FUNCTION_DECL for the library
(i.e., non-built-in) form of a function given the corresponding
built-in DECL.  Is there an API I can all with either the built
-in DECL or its code to get it in the middle end?

In C, what I'm looking for appears to be DECL_CHAIN(decl), at
least for the example I looked at.  I.e., the library libdecl
for a corresponding __bultin_xxx DECL is DECL_CHAIN (DECL).

But in C++, it looks like it's the other way around and it's
the built-in decl that's the DECL_CHAIN(DECL) for the built-in
DECL, and AFAIK there's no good way to get from the latter to
the former.

To expand on this: I expected to get the library DECL for
a declared function by calling
symtab_node::get_from_asmname(libname) like for instance:

  tree id = get_identifier ("free");
  symtab_node *node = symtab_node::get_from_asmname (id);

but what I get back is a DECL for __builtin_free instead.
The DECL for "free" is the result of DECL_CHAIN() in C but
not in C++.


Thanks
Martin





Reply via email to