public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3396] ctfc: add function to lookup CTF ID of a TREE type
@ 2021-09-07 21:06 David Faust
0 siblings, 0 replies; only message in thread
From: David Faust @ 2021-09-07 21:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:5b723401b37332df0e2a665c4124d52c9ca7a515
commit r12-3396-g5b723401b37332df0e2a665c4124d52c9ca7a515
Author: David Faust <david.faust@oracle.com>
Date: Tue Aug 3 10:01:31 2021 -0700
ctfc: add function to lookup CTF ID of a TREE type
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.
Diff:
---
gcc/ctfc.c | 16 ++++++++++++++++
gcc/ctfc.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/gcc/ctfc.c b/gcc/ctfc.c
index db6ba030301..73c118e3d49 100644
--- a/gcc/ctfc.c
+++ b/gcc/ctfc.c
@@ -791,6 +791,22 @@ ctf_add_sou (ctf_container_ref ctfc, uint32_t flag, const char * name,
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. */
diff --git a/gcc/ctfc.h b/gcc/ctfc.h
index 825570d807e..14180c1e5de 100644
--- a/gcc/ctfc.h
+++ b/gcc/ctfc.h
@@ -430,6 +430,8 @@ extern int ctf_add_function_arg (ctf_container_ref, dw_die_ref,
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. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-07 21:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 21:06 [gcc r12-3396] ctfc: add function to lookup CTF ID of a TREE type David Faust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).