Re: wishlist: support for shorter pointers

2023-07-06 Thread David Brown via Gcc
On 06/07/2023 09:00, Rafał Pietrak via Gcc wrote: Hi, W dniu 5.07.2023 o 19:39, David Brown pisze: [--] I'm not sure what this means? At compile time, you only have literals, so what's missing? The compiler knows a lot more than just literal values at compile time - lots of

Re: wishlist: support for shorter pointers

2023-07-06 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 19:39, David Brown pisze: [--] I'm not sure what this means? At compile time, you only have literals, so what's missing? The compiler knows a lot more than just literal values at compile time - lots of things are "compile-time constants" without being

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 18:13, Rafał Pietrak via Gcc wrote: Hi, W dniu 5.07.2023 o 16:45, David Brown pisze: On 05/07/2023 15:29, Rafał Pietrak wrote: [---] OK. I don't see a problem here, but I admit that mixing semantics often lead to problems. I think it also allows better

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 16:45, David Brown pisze: On 05/07/2023 15:29, Rafał Pietrak wrote: [---] OK. I don't see a problem here, but I admit that mixing semantics often lead to problems. I think it also allows better generalisation and flexibility if they are separate.  You

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 15:29, Rafał Pietrak wrote: Hi, W dniu 5.07.2023 o 14:57, David Brown pisze: [] My objection to named address spaces stem from two points: 1. They are compiler implementations, not user code (or library code), which means development is inevitably much slower and

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 14:57, David Brown pisze: [] My objection to named address spaces stem from two points: 1. They are compiler implementations, not user code (or library code), which means development is inevitably much slower and less flexible. 2. They mix two concepts

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 14:25, Rafał Pietrak wrote: Hi, W dniu 5.07.2023 o 13:55, David Brown pisze: On 05/07/2023 11:42, Rafał Pietrak via Gcc wrote: [--] So your current objections to named spaces ... are in fact in favor of them. Isn't it so? Not really, no - I would rather see

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 13:55, David Brown pisze: On 05/07/2023 11:42, Rafał Pietrak via Gcc wrote: [--] Wouldn't it be easier and more natural to make the "named spaces" a synonym to specific linker sections (like section names, or section name prefix when instead of

Re: wishlist: support for shorter pointers

2023-07-05 Thread Martin Uecker
Thanks David! I do not think I agree with all of it (e.g. sdcc is actively developed with regular releases and supports  tiny devices which are used for extreme low-power  applications) and I do not personally think that only  C++ counts nowadays, especially in the embedded world,  but we do

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 11:42, Rafał Pietrak via Gcc wrote: Hi, W dniu 5.07.2023 o 11:11, David Brown pisze: On 05/07/2023 10:05, Rafał Pietrak via Gcc wrote: [---] I am not sure if you are clear about this, but the address space definition macros here are for use in the source code for the

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 11:25, Martin Uecker wrote: Am Mittwoch, dem 05.07.2023 um 11:11 +0200 schrieb David Brown: On 05/07/2023 10:05, Rafał Pietrak via Gcc wrote: ... In my personal opinion (which you are all free to disregard), named address spaces were an interesting idea that failed.  I was

Re: wishlist: support for shorter pointers

2023-07-05 Thread Martin Uecker
Am Mittwoch, dem 05.07.2023 um 12:17 +0200 schrieb Rafał Pietrak: > Hi > > W dniu 5.07.2023 o 11:29, Martin Uecker pisze: > > Am Mittwoch, dem 05.07.2023 um 10:05 +0200 schrieb Rafał Pietrak: > ... > > > > > Then again, should you happen to fall onto an > > > actual documentation of syntax to

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi W dniu 5.07.2023 o 11:29, Martin Uecker pisze: Am Mittwoch, dem 05.07.2023 um 10:05 +0200 schrieb Rafał Pietrak: [--] Then again ... apparently you are guessing the answer. Incidentally, that would be my guess, too. And while such "syntax" is not really desirable (since such

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 11:11, David Brown pisze: On 05/07/2023 10:05, Rafał Pietrak via Gcc wrote: [---] type) would then be smaller.  At least, this is my understanding of how it could work. Note that this only applies to pointers declared to be of the address space specific type. 

Re: wishlist: support for shorter pointers

2023-07-05 Thread Martin Uecker
Am Mittwoch, dem 05.07.2023 um 10:05 +0200 schrieb Rafał Pietrak: > Hi, > > W dniu 5.07.2023 o 09:29, Martin Uecker pisze: > > Am Mittwoch, dem 05.07.2023 um 07:26 +0200 schrieb Rafał Pietrak: > [---] > > > And if it's so ... there is no mention of how does it show up for > > > "simple user"

Re: wishlist: support for shorter pointers

2023-07-05 Thread Martin Uecker
Am Mittwoch, dem 05.07.2023 um 11:11 +0200 schrieb David Brown: > On 05/07/2023 10:05, Rafał Pietrak via Gcc wrote: ... > > In my personal opinion (which you are all free to disregard), named > address spaces were an interesting idea that failed.  I was > enthusiastic > about a number of the

Re: wishlist: support for shorter pointers

2023-07-05 Thread David Brown via Gcc
On 05/07/2023 10:05, Rafał Pietrak via Gcc wrote: Hi, W dniu 5.07.2023 o 09:29, Martin Uecker pisze: Am Mittwoch, dem 05.07.2023 um 07:26 +0200 schrieb Rafał Pietrak: [---] And if it's so ... there is no mention of how does it show up for "simple user" of the GCC (instead of the use of

Re: wishlist: support for shorter pointers

2023-07-05 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 09:29, Martin Uecker pisze: Am Mittwoch, dem 05.07.2023 um 07:26 +0200 schrieb Rafał Pietrak: [---] And if it's so ... there is no mention of how does it show up for "simple user" of the GCC (instead of the use of that "machinery" by creators of particular GCC

Re: wishlist: support for shorter pointers

2023-07-05 Thread Martin Uecker
Am Mittwoch, dem 05.07.2023 um 07:26 +0200 schrieb Rafał Pietrak: > Hi, > > W dniu 5.07.2023 o 00:57, Martin Uecker pisze: > > Am Dienstag, dem 04.07.2023 um 16:46 +0200 schrieb Rafał Pietrak:... > [] > > > > > > Yes. named address spaces would be great. And for code, too. > > > > > >

Re: wishlist: support for shorter pointers

2023-07-04 Thread Rafał Pietrak via Gcc
Hi, W dniu 5.07.2023 o 00:57, Martin Uecker pisze: Am Dienstag, dem 04.07.2023 um 16:46 +0200 schrieb Rafał Pietrak:... [] Yes. named address spaces would be great. And for code, too. While certainly some work, implementation effort for new kinds of named address spaces does not

Re: wishlist: support for shorter pointers

2023-07-04 Thread Martin Uecker
Am Dienstag, dem 04.07.2023 um 16:46 +0200 schrieb Rafał Pietrak:... > > > > I think a C++ class (or rather, class template) with inline functions is > > the way to go here.  gcc's optimiser will give good code, and the C++ > > class will let you get nice syntax to hide the messy details. > >

Re: wishlist: support for shorter pointers

2023-07-04 Thread Rafał Pietrak via Gcc
W dniu 4.07.2023 o 17:55, David Brown pisze: On 04/07/2023 16:46, Rafał Pietrak wrote: [--] Yes. named address spaces would be great. And for code, too. It is good to have a wishlist (and you can file a wishlist "bug" in the gcc bugzilla, so that it won't be forgotten).  But it

Re: wishlist: support for shorter pointers

2023-07-04 Thread Rafał Pietrak via Gcc
W dniu 4.07.2023 o 17:13, David Brown pisze: [] If you have a circular buffer, it is vastly more efficient to have an array with no pointers or indices, and use head and tail indices to track the current position.  But I'm not sure if that is what you are looking for.  And you

Re: wishlist: support for shorter pointers

2023-07-04 Thread David Brown via Gcc
On 04/07/2023 16:46, Rafał Pietrak wrote: Hi, W dniu 4.07.2023 o 14:38, David Brown pisze: [-] A key difference is that using 32-bit pointers on an x86 is enough address space for a large majority of use-cases, while even on the smallest small ARM microcontroller, 16-bit is not

Re: wishlist: support for shorter pointers

2023-07-04 Thread David Brown via Gcc
On 04/07/2023 16:20, Rafał Pietrak wrote: W dniu 3.07.2023 o 18:29, Rafał Pietrak pisze: Hi David, [--] 4. It is worth taking a step back, and thinking about how you would like to use these pointers.  It is likely that you would be better thinking in terms of an array, rather

Re: wishlist: support for shorter pointers

2023-07-04 Thread Rafał Pietrak via Gcc
Hi, W dniu 4.07.2023 o 14:38, David Brown pisze: [-] A key difference is that using 32-bit pointers on an x86 is enough address space for a large majority of use-cases, while even on the smallest small ARM microcontroller, 16-bit is not enough.  (It's not even enough to access all

Re: wishlist: support for shorter pointers

2023-07-04 Thread Rafał Pietrak via Gcc
W dniu 3.07.2023 o 18:29, Rafał Pietrak pisze: Hi David, [--] 4. It is worth taking a step back, and thinking about how you would like to use these pointers.  It is likely that you would be better thinking in terms of an array, rather than pointers - after all, you don't want

Re: wishlist: support for shorter pointers

2023-07-04 Thread Oleg Endo
> I think a C++ class (or rather, class template) with inline functions is > the way to go here. gcc's optimiser will give good code, and the C++ > class will let you get nice syntax to hide the messy details. > > There is no good way to do this in C. Named address spaces would be a >

Re: wishlist: support for shorter pointers

2023-07-04 Thread David Brown via Gcc
On 03/07/2023 18:42, Rafał Pietrak via Gcc wrote: Hi Ian, W dniu 3.07.2023 o 17:07, Ian Lance Taylor pisze: On Wed, Jun 28, 2023 at 11:21 PM Rafał Pietrak via Gcc wrote: [] I was thinking about that, and it doesn't look as requiring that deep rewrites. ABI spec, that  could

Re: wishlist: support for shorter pointers

2023-07-03 Thread Rafał Pietrak via Gcc
W dniu 3.07.2023 o 18:57, Richard Earnshaw (lists) pisze: On 03/07/2023 17:42, Rafał Pietrak via Gcc wrote: Hi Ian, [-] And WiKi reporting up to 40% performance improvements in some corner cases is impressive and encouraging. I believe, that the reported average of 5-8%

Re: wishlist: support for shorter pointers

2023-07-03 Thread Richard Earnshaw (lists) via Gcc
On 03/07/2023 17:42, Rafał Pietrak via Gcc wrote: Hi Ian, W dniu 3.07.2023 o 17:07, Ian Lance Taylor pisze: On Wed, Jun 28, 2023 at 11:21 PM Rafał Pietrak via Gcc wrote: [] I was thinking about that, and it doesn't look as requiring that deep rewrites. ABI spec, that  could

Re: wishlist: support for shorter pointers

2023-07-03 Thread Rafał Pietrak via Gcc
Hi Ian, W dniu 3.07.2023 o 17:07, Ian Lance Taylor pisze: On Wed, Jun 28, 2023 at 11:21 PM Rafał Pietrak via Gcc wrote: [] I was thinking about that, and it doesn't look as requiring that deep rewrites. ABI spec, that could accomodate the functionality could be as little as one

Re: wishlist: support for shorter pointers

2023-07-03 Thread Rafał Pietrak via Gcc
Hi David, W dniu 3.07.2023 o 16:52, David Brown pisze: [] But, before I dive into learning C++ (forgive the naive question) isn't it so, that C++ comes with a heavy runtime? One that will bloat my tiny project? Or the bloat comes only when one uses particular elaborated

Re: wishlist: support for shorter pointers

2023-07-03 Thread Ian Lance Taylor via Gcc
On Wed, Jun 28, 2023 at 11:21 PM Rafał Pietrak via Gcc wrote: > > W dniu 28.06.2023 o 17:44, Richard Earnshaw (lists) pisze: > [---] > > I think I understand what you're asking for but: > > 1) You'd need a new ABI specification to handle this, probably involving > > register assignments

Re: wishlist: support for shorter pointers

2023-07-03 Thread David Brown via Gcc
On 28/06/2023 10:35, Rafał Pietrak via Gcc wrote: Hi Jonathan, W dniu 28.06.2023 o 09:31, Jonathan Wakely pisze: If you use a C++ library type for your pointers the syntax above doesn't need to change, and the fancy pointer type can be implemented portable, with customisation for targets

Re: wishlist: support for shorter pointers

2023-06-29 Thread Rafał Pietrak via Gcc
Hi Richard, W dniu 28.06.2023 o 17:44, Richard Earnshaw (lists) pisze: [---] I think I understand what you're asking for but: 1) You'd need a new ABI specification to handle this, probably involving register assignments (for the 'segment' addresses), the initialization of those at

Re: wishlist: support for shorter pointers

2023-06-28 Thread Martin Uecker
Am Mittwoch, dem 28.06.2023 um 17:49 +0100 schrieb Richard Earnshaw (lists): > On 28/06/2023 17:07, Martin Uecker wrote: > > Am Mittwoch, dem 28.06.2023 um 16:44 +0100 schrieb Richard Earnshaw (lists): > > > On 28/06/2023 15:51, Rafał Pietrak via Gcc wrote: > > > > Hi Martin, > > > > > > > > W

Re: wishlist: support for shorter pointers

2023-06-28 Thread Richard Earnshaw (lists) via Gcc
On 28/06/2023 17:07, Martin Uecker wrote: Am Mittwoch, dem 28.06.2023 um 16:44 +0100 schrieb Richard Earnshaw (lists): On 28/06/2023 15:51, Rafał Pietrak via Gcc wrote: Hi Martin, W dniu 28.06.2023 o 15:00, Martin Uecker pisze: Sounds like named address spaces to me:

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Richard, W dniu 28.06.2023 o 17:44, Richard Earnshaw (lists) pisze: [--] I think I understand what you're asking for but: From what I can see below. You do. The case is exactly this. 1) You'd need a new ABI specification to handle this, probably involving register

Re: wishlist: support for shorter pointers

2023-06-28 Thread Martin Uecker
Am Mittwoch, dem 28.06.2023 um 16:44 +0100 schrieb Richard Earnshaw (lists): > On 28/06/2023 15:51, Rafał Pietrak via Gcc wrote: > > Hi Martin, > > > > W dniu 28.06.2023 o 15:00, Martin Uecker pisze: > > > > > > Sounds like named address spaces to me: > > >

Re: wishlist: support for shorter pointers

2023-06-28 Thread Richard Earnshaw (lists) via Gcc
On 28/06/2023 15:51, Rafał Pietrak via Gcc wrote: Hi Martin, W dniu 28.06.2023 o 15:00, Martin Uecker pisze: Sounds like named address spaces to me: https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html Only to same extend, and only in x86 case. The goal of the wish-item I've

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Martin, W dniu 28.06.2023 o 15:00, Martin Uecker pisze: Sounds like named address spaces to me: https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html Only to same extend, and only in x86 case. The goal of the wish-item I've describe is to shorten pointers. I may be wrong and have

Re: wishlist: support for shorter pointers

2023-06-28 Thread Martin Uecker
Sounds like named address spaces to me: https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html Best, Martin Am Dienstag, dem 27.06.2023 um 14:26 +0200 schrieb Rafał Pietrak via Gcc: > Hello everybody, > > I'm not quite sure if this is correct mailbox for this suggestion (may > be

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Alex, W dniu 28.06.2023 o 14:12, waffl3x pisze: [--] them having some sort of fancy pointers in there somewhere. Realistically though, it will take some time to get used to all the C++isms before you would be able to be proficient with anything Boost would provide. I don't mean to

Re: wishlist: support for shorter pointers

2023-06-28 Thread waffl3x via Gcc
> Hmm... that's disappointing :( nothing was generated. Function templates are not functions, they are templates of functions, they will not generate any code unless they are instantiated. > then again. I've noticed that you've changed pointers to indices. No, I changed pointers to a template

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Alex, W dniu 28.06.2023 o 11:56, waffl3x pisze: Here's a quick and dirty example of how this function could be rewritten with modern C++. I omitted some necessary details, particularly the implementation of the linked list iterator. I also wrote it out quickly so I can't be certain it's

Re: wishlist: support for shorter pointers

2023-06-28 Thread waffl3x via Gcc
Here's a quick and dirty example of how this function could be rewritten with modern C++. I omitted some necessary details, particularly the implementation of the linked list iterator. I also wrote it out quickly so I can't be certain it's 100% correct, but it should give you an idea of whats

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Alex, W dniu 28.06.2023 o 09:34, waffl3x pisze: [--] --- y->next = NULL; if (our) { out->next = a; for (y = t->HD; y && y->next; y = y->next) if (y) y->next = a;

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Jonathan, W dniu 28.06.2023 o 09:31, Jonathan Wakely pisze: On Wed, 28 Jun 2023, 08:14 Rafał Pietrak via Gcc, [-] how it looks like. I have a lot of code like this scattered around: ---                                 y->next = NULL;              

Re: wishlist: support for shorter pointers

2023-06-28 Thread waffl3x via Gcc
>This is from just one source file, which otherwise is "plain C". If I >was to put it into a library that use "asm tweaked fancy pointers", a >portable fragment of code becomes "target dedicated" - this is undesired. I sympathize with your desire to not lock your codebase to a particular target,

Re: wishlist: support for shorter pointers

2023-06-28 Thread Jonathan Wakely via Gcc
On Wed, 28 Jun 2023, 08:14 Rafał Pietrak via Gcc, wrote: > Hi Alex! > > W dniu 28.06.2023 o 03:54, waffl3x pisze: > > I want to preface this stating that I have little to no experience in > compiler > > development, I am only merely just getting into it. With that said, I > have messed around >

Re: wishlist: support for shorter pointers

2023-06-28 Thread Rafał Pietrak via Gcc
Hi Alex! W dniu 28.06.2023 o 03:54, waffl3x pisze: I want to preface this stating that I have little to no experience in compiler development, I am only merely just getting into it. With that said, I have messed around with library design a fair amount, and this seems like something that could

Re: wishlist: support for shorter pointers

2023-06-27 Thread waffl3x via Gcc
I want to preface this stating that I have little to no experience in compiler development, I am only merely just getting into it. With that said, I have messed around with library design a fair amount, and this seems like something that could be implemented in a library. It might be slightly

wishlist: support for shorter pointers

2023-06-27 Thread Rafał Pietrak via Gcc
Hello everybody, I'm not quite sure if this is correct mailbox for this suggestion (may be "embedded" would be better), but let me present it first (and while the examples is from ARM stm32 environment, the issue would equally apply to i386 or even amd64). So: 1. Small MPU (like stm32f103)