Add a new function, ctf_lookup_tree_type, to return the CTF type ID
associated with a type via its is TREE node. The function is exposed via
a prototype in ctfc.h.
gcc/ChangeLog:
* ctfc.c (ctf_lookup_tree_type): New function.
* ctfc.h: Likewise.
return type;
}
+/* Given a TREE_TYPE node, return the CTF type ID for that type. */
+
+ctf_id_t
+ctf_lookup_tree_type (ctf_container_ref ctfc, const tree type)
+{
+ dw_die_ref die = lookup_type_die (type);
+ if (die == NULL)
+ return CTF_NULL_TYPEID;
+
+ ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, die);
+ if (dtd == NULL)
+ return CTF_NULL_TYPEID;
+
+ return dtd->dtd_type;
+}
+
/* Check if CTF for TYPE has already been generated. Mainstay for
de-duplication. If CTF type already exists, returns TRUE and updates
the TYPE_ID for the caller. */
extern int ctf_add_variable (ctf_container_ref, const char *, ctf_id_t,
dw_die_ref, unsigned int);
+extern ctf_id_t ctf_lookup_tree_type (ctf_container_ref, const tree);
+
/* CTF section does not emit location information; at this time, location
information is needed for BTF CO-RE use-cases. */