diff mbox series

i386: Pass INVALID_REGNUM as invalid register number

Message ID CAMe9rOomJA_x97Z__o4VpJ12G3qwKoJY23J5otr8ZBdzbMFksA@mail.gmail.com
State New
Headers show
Series i386: Pass INVALID_REGNUM as invalid register number | expand

Commit Message

H.J. Lu Feb. 2, 2018, 4:36 p.m. UTC
On Tue, Jan 16, 2018 at 11:48 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Sun, Jan 14, 2018 at 5:43 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> On Sun, Jan 14, 2018 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Sun, Jan 14, 2018 at 8:19 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>> On Fri, Jan 12, 2018 at 9:01 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>>> On Thu, Jan 11, 2018 at 2:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>
>>>>>> Hi Uros,
>>>>>>
>>>>>> Can you take a look at my x86 backend changes so that they are ready
>>>>>> to check in once we have consensus.
>>>>>
>>>>> Please finish the talks about the correct approach first. Once the
>>>>> consensus is reached, please post the final version of the patches for
>>>>> review.
>>>>>
>>>>> BTW: I have no detailed insight in these issues, so I'll look mostly
>>>>> at the implementation details, probably early next week.
>>>>
>>>> One general remark is on the usage of -1 as an invalid register
>>>
>>> This has been rewritten.  The checked in patch no longer does that.
>>
>> I'm looking directly into current indirect_thunk_name,
>> output_indirect_thunk and output_indirect_thunk_function functions in
>> i386.c which have plenty of the mentioned checks.
>
> Improved with attached patch.
>
> 2018-01-16  Uros Bizjak  <ubizjak@gmail.com>
>
>     * config/i386/i386.c (indirect_thunk_name): Declare regno
>     as unsigned int.  Compare regno with INVALID_REGNUM.
>     (output_indirect_thunk): Ditto.
>     (output_indirect_thunk_function): Ditto.
>     (ix86_code_end): Declare regno as unsigned int.  Use INVALID_REGNUM
>     in the call to output_indirect_thunk_function.
>
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>

Here is a patch to do the same in ix86_output_function_return.  OK
for trunk and GCC 7 branch?

Thanks.

Comments

Uros Bizjak Feb. 2, 2018, 4:38 p.m. UTC | #1
On Fri, Feb 2, 2018 at 5:36 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Jan 16, 2018 at 11:48 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> On Sun, Jan 14, 2018 at 5:43 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> On Sun, Jan 14, 2018 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Sun, Jan 14, 2018 at 8:19 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>>> On Fri, Jan 12, 2018 at 9:01 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>>>> On Thu, Jan 11, 2018 at 2:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>
>>>>>>> Hi Uros,
>>>>>>>
>>>>>>> Can you take a look at my x86 backend changes so that they are ready
>>>>>>> to check in once we have consensus.
>>>>>>
>>>>>> Please finish the talks about the correct approach first. Once the
>>>>>> consensus is reached, please post the final version of the patches for
>>>>>> review.
>>>>>>
>>>>>> BTW: I have no detailed insight in these issues, so I'll look mostly
>>>>>> at the implementation details, probably early next week.
>>>>>
>>>>> One general remark is on the usage of -1 as an invalid register
>>>>
>>>> This has been rewritten.  The checked in patch no longer does that.
>>>
>>> I'm looking directly into current indirect_thunk_name,
>>> output_indirect_thunk and output_indirect_thunk_function functions in
>>> i386.c which have plenty of the mentioned checks.
>>
>> Improved with attached patch.
>>
>> 2018-01-16  Uros Bizjak  <ubizjak@gmail.com>
>>
>>     * config/i386/i386.c (indirect_thunk_name): Declare regno
>>     as unsigned int.  Compare regno with INVALID_REGNUM.
>>     (output_indirect_thunk): Ditto.
>>     (output_indirect_thunk_function): Ditto.
>>     (ix86_code_end): Declare regno as unsigned int.  Use INVALID_REGNUM
>>     in the call to output_indirect_thunk_function.
>>
>> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>>
>
> Here is a patch to do the same in ix86_output_function_return.  OK
> for trunk and GCC 7 branch?

This patch can be committed under obvious rules.

Thanks,
Uros.
diff mbox series

Patch

From c6ca8064f7322b34997ff9702a385aeed76ea35f Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 2 Feb 2018 08:31:40 -0800
Subject: [PATCH] i386: Pass INVALID_REGNUM as invalid register number

	* config/i386/i386.c (ix86_output_function_return): Pass
	INVALID_REGNUM, instead of -1, as invalid register number to
	indirect_thunk_name and output_indirect_thunk.
---
 gcc/config/i386/i386.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5fa5d9eb171..b07f581cd65 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -28940,7 +28940,8 @@  ix86_output_function_return (bool long_p)
 	{
 	  bool need_thunk = (cfun->machine->function_return_type
 			     == indirect_branch_thunk);
-	  indirect_thunk_name (thunk_name, -1, need_bnd_p, true);
+	  indirect_thunk_name (thunk_name, INVALID_REGNUM, need_bnd_p,
+			       true);
 	  if (need_bnd_p)
 	    {
 	      indirect_thunk_bnd_needed |= need_thunk;
@@ -28953,7 +28954,7 @@  ix86_output_function_return (bool long_p)
 	    }
 	}
       else
-	output_indirect_thunk (need_bnd_p, -1);
+	output_indirect_thunk (need_bnd_p, INVALID_REGNUM);
 
       return "";
     }
-- 
2.14.3