public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] [c-family] PR92867 - Add returns_arg attribute
@ 2020-01-20 12:21 Prathamesh Kulkarni
  2020-01-20 23:23 ` Joseph Myers
  0 siblings, 1 reply; 17+ messages in thread
From: Prathamesh Kulkarni @ 2020-01-20 12:21 UTC (permalink / raw)
  To: gcc Patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

Hi,
This patch attempts to add returns_arg attribute for c-family
languages. For C++ methods, first arg is assumed to be this pointer,
similar to alloc_size.
I have a couple of doubts:

(a) I am not sure why DECL_ARGUMENTS (decl) in
handle_returns_arg_attribute returns NULL ? My intent was to check
that the return-type and argument-types are compatible.

(b) AFAIU the bottom two bits of call return flags are used for storing
args from 0 - 3 and the arg number can be obtained by
masking with ERF_RETURN_ARG_MASK.
So, does that mean we can only allow first 4 arguments to be annotated
with returns_arg attribute ?
In the patch, I use fn_spec ('argnum'), which gimple_call_return_flags
uses to mark the corresponding arg with ERF_RETURN_ARG:

(c) How to write dejaGNU test to check if fn_spec ('argnum') has been correctly
applied to the corresponding parameter ? In the patch, I am just
testing for validation.

Thanks,
Prathamesh

[-- Attachment #2: returns-arg-1.diff --]
[-- Type: application/x-patch, Size: 4240 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-02-12  8:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 12:21 [RFC] [c-family] PR92867 - Add returns_arg attribute Prathamesh Kulkarni
2020-01-20 23:23 ` Joseph Myers
2020-01-24 12:22   ` Prathamesh Kulkarni
2020-01-25  2:40     ` Joseph Myers
2020-01-27 12:46       ` Richard Biener
2020-01-28 11:47         ` Prathamesh Kulkarni
2020-01-28 11:53           ` Jakub Jelinek
2020-01-28 12:02             ` Prathamesh Kulkarni
2020-01-28 12:25               ` Jakub Jelinek
2020-01-29 10:06                 ` Richard Biener
2020-01-30 12:16                   ` Prathamesh Kulkarni
2020-01-30 14:10                     ` Richard Biener
2020-02-03  9:12                       ` Prathamesh Kulkarni
2020-02-03  9:27                         ` Prathamesh Kulkarni
2020-02-04  9:24                           ` Prathamesh Kulkarni
2020-02-12  6:52                             ` Prathamesh Kulkarni
2020-02-12  8:35                               ` Richard Biener

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).