From 9850ce4d7bb89d4f9216dd5eebc88156bf31b70b Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Wed, 3 Jun 2020 13:23:42 +0100 Subject: libctf: add ctf_forwardable_kind The internals of the deduplicator want to know if something is a type that can have a forward to it fairly often, often enough that inlining it brings a noticeable performance gain. Convert the one place in libctf that can already benefit, even though it doesn't bring any sort of performance gain there. libctf/ * ctf-inlines.h (ctf_forwardable_kind): New. * ctf-create.c (ctf_add_forward): Use it. --- libctf/ctf-inlines.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libctf/ctf-inlines.h') diff --git a/libctf/ctf-inlines.h b/libctf/ctf-inlines.h index 4bec97b11b3..3b912bd9a25 100644 --- a/libctf/ctf-inlines.h +++ b/libctf/ctf-inlines.h @@ -40,6 +40,12 @@ ctf_get_ctt_size (const ctf_file_t *fp, return (fp->ctf_fileops->ctfo_get_ctt_size (fp, tp, sizep, incrementp)); } +static inline int +ctf_forwardable_kind (int kind) +{ + return (kind == CTF_K_STRUCT || kind == CTF_K_UNION || kind == CTF_K_ENUM); +} + static inline int ctf_dynhash_cinsert (ctf_dynhash_t *h, const void *k, const void *v) -- cgit v1.2.1