diff mbox series

Defined libcall_arg_t

Message ID 1592044057-2607-1-git-send-email-kamleshbhalui@gmail.com
State New
Headers show
Series Defined libcall_arg_t | expand

Commit Message

kamlesh kumar June 13, 2020, 10:27 a.m. UTC
This is first patch where I have just defined a struct libcall_arg_t which contains
three member rtx, machine_mode and a boolean unsigned_p and will be used in passing args in
emit_library_[call/value] functions.

Once this patch is approved then i will create second patch in which arg type libcall_arg_t will be
propogated on all instances needed.
Then final patch which will fix the actual problem reported in PR88877.

ChangeLog Entry:

2020-06-13  Kamlesh Kumar  <kamleshbhalui@gmail.com>

       * rtl.h (libcall_arg_t): Defined.


---

Comments

Richard Sandiford June 16, 2020, 9:04 a.m. UTC | #1
Thanks for doing this.

Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 0872cc4..c023ff0 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -2238,6 +2238,18 @@ struct address_info {
>    enum rtx_code base_outer_code;
>  };
>  
> +/* This is used for passing args in emit_library_* functions */
> +typedef struct libcall_arg {

There's not really any need for a typedef here.  We should just
use “libcall_arg” directly.

> +  rtx value;
> +  machine_mode mode;
> +  bool unsigned_p;
> +  libcall_arg (rtx v, machine_mode m, bool u) {
> +    value = v;
> +    mode = m;
> +    unsigned_p = u;
> +  }

Please use member initialisation for the fields instead.

Now that we're C++11, the constructor might as well be constexpr.

Thanks,
Richard

> +} libcall_arg_t;
> +
>  /* This is used to bundle an rtx and a mode together so that the pair
>     can be used with the wi:: routines.  If we ever put modes into rtx
>     integer constants, this should go away and then just pass an rtx in.  */
kamlesh kumar June 16, 2020, 11:07 a.m. UTC | #2
thanks Richard,

addressed your concern.

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..7206c8a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,16 @@ struct address_info {
    enum rtx_code base_outer_code;
  };

+/* This is used for passing args in emit_library_* functions */
+struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  constexpr
+  libcall_arg (rtx v, machine_mode m, bool u) : value(v), mode(m),
+                                                unsigned_p(u) {}
+};
+
  /* This is used to bundle an rtx and a mode together so that the pair
     can be used with the wi:: routines.  If we ever put modes into rtx
     integer constants, this should go away and then just pass an rtx 
in.  */

On 16/06/20 2:34 pm, Richard Sandiford wrote:
> Thanks for doing this.
>
> Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>> diff --git a/gcc/rtl.h b/gcc/rtl.h
>> index 0872cc4..c023ff0 100644
>> --- a/gcc/rtl.h
>> +++ b/gcc/rtl.h
>> @@ -2238,6 +2238,18 @@ struct address_info {
>>     enum rtx_code base_outer_code;
>>   };
>>   
>> +/* This is used for passing args in emit_library_* functions */
>> +typedef struct libcall_arg {
> There's not really any need for a typedef here.  We should just
> use “libcall_arg” directly.
>
>> +  rtx value;
>> +  machine_mode mode;
>> +  bool unsigned_p;
>> +  libcall_arg (rtx v, machine_mode m, bool u) {
>> +    value = v;
>> +    mode = m;
>> +    unsigned_p = u;
>> +  }
> Please use member initialisation for the fields instead.
>
> Now that we're C++11, the constructor might as well be constexpr.
>
> Thanks,
> Richard
>
>> +} libcall_arg_t;
>> +
>>   /* This is used to bundle an rtx and a mode together so that the pair
>>      can be used with the wi:: routines.  If we ever put modes into rtx
>>      integer constants, this should go away and then just pass an rtx in.  */
Richard Sandiford June 16, 2020, 12:09 p.m. UTC | #3
Kamlesh Kumar <kamleshbhalui@gmail.com> writes:
> thanks Richard,
>
> addressed your concern.
>
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 0872cc4..7206c8a 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -2238,6 +2238,16 @@ struct address_info {
>     enum rtx_code base_outer_code;
>   };
>
> +/* This is used for passing args in emit_library_* functions */
> +struct libcall_arg {
> +  rtx value;
> +  machine_mode mode;
> +  bool unsigned_p;
> +  constexpr
> +  libcall_arg (rtx v, machine_mode m, bool u) : value(v), mode(m),
> +                                                unsigned_p(u) {}

Think this should be formatted with the ":" on the next line.
There should also be spaces before each "(":

  constexpr libcall_arg (rtx v, machine_mode m, bool u)
    : value (v), mode (m), unsigned_p (u) {}

Looks good otherwise, thanks, but please only apply at the same
time as the patch that needs it.

Richard
diff mbox series

Patch

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..c023ff0 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2238,6 +2238,18 @@  struct address_info {
   enum rtx_code base_outer_code;
 };
 
+/* This is used for passing args in emit_library_* functions */
+typedef struct libcall_arg {
+  rtx value;
+  machine_mode mode;
+  bool unsigned_p;
+  libcall_arg (rtx v, machine_mode m, bool u) {
+    value = v;
+    mode = m;
+    unsigned_p = u;
+  }
+} libcall_arg_t;
+
 /* This is used to bundle an rtx and a mode together so that the pair
    can be used with the wi:: routines.  If we ever put modes into rtx
    integer constants, this should go away and then just pass an rtx in.  */