public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PPC: remove indirection from struct pd_reg
@ 2023-08-11 13:16 Jan Beulich
  2023-08-11 22:30 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2023-08-11 13:16 UTC (permalink / raw)
  To: Binutils; +Cc: Alan Modra, Peter Bergner, Geoff Keating

The longest register name is 5 characters (plus a nul one), so using a
4- or 8-byte pointer to get at it is neither space nor time efficient.
Embed the names right into the array. For PIE this also reduces the
number of base relocations in the final image.
---
Of course this way the structure isn't a power of 2 in size anymore.
While adding padding would still keep overall size below the original
for 64-bit code, in 32-bit code the space savings would likely be lost.

--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -279,7 +279,7 @@ const pseudo_typeS md_pseudo_table[] =
 /* Structure to hold information about predefined registers.  */
 struct pd_reg
   {
-    const char *name;
+    char name[6];
     unsigned short value;
     unsigned short flags;
   };

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

* Re: [PATCH] PPC: remove indirection from struct pd_reg
  2023-08-11 13:16 [PATCH] PPC: remove indirection from struct pd_reg Jan Beulich
@ 2023-08-11 22:30 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-08-11 22:30 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Binutils, Peter Bergner, Geoff Keating

On Fri, Aug 11, 2023 at 03:16:21PM +0200, Jan Beulich wrote:
> --- a/gas/config/tc-ppc.c
> +++ b/gas/config/tc-ppc.c
> @@ -279,7 +279,7 @@ const pseudo_typeS md_pseudo_table[] =
>  /* Structure to hold information about predefined registers.  */
>  struct pd_reg
>    {
> -    const char *name;
> +    char name[6];
>      unsigned short value;
>      unsigned short flags;
>    };

Thanks!

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2023-08-11 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 13:16 [PATCH] PPC: remove indirection from struct pd_reg Jan Beulich
2023-08-11 22:30 ` Alan Modra

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