Re: [fpc-devel] Progress on pure functions

2022-12-14 Thread J. Gareth Moreton via fpc-devel
So progress report on converting "Str(constant, output)"... it's not easy!  Firstly, after the first pass, a call node's parameters can get reordered so they can be placed into ideal registers or on the stack.  I found a workaround for that by adding a new field that records their original

Re: [fpc-devel] Progress on pure functions

2022-12-14 Thread J. Gareth Moreton via fpc-devel
So it turns out that an "inlinen" node is created initially, but it is transmuted into a "calln" node by the typecheck pass almost as soon as it is created.  I think the reason it is transmuted so soon is because differently-named internal procedures have to be called depending on the input

Re: [fpc-devel] Progress on pure functions

2022-12-14 Thread J. Gareth Moreton via fpc-devel
On 14/12/2022 10:18, Sven Barth via fpc-devel wrote: Wouldn't it make more sense to ensure that the Str() and Val() intrinsic work correctly inside "pure" functions? After all the compiler can then simply evaluate the inlinen nodes and does not have to "interpret" a ton of

Re: [fpc-devel] Progress on pure functions

2022-12-14 Thread J. Gareth Moreton via fpc-devel
Heh, I had a feeling I was overcomplicating it - thanks Sven. I'll start experimenting on that one. On a similar note, my branch has a number of other merge requests embedded in it, namely the "typeconv-strip" and "nothing-strip" branches (!232 and !342 respectively) and these are requred to

Re: [fpc-devel] Progress on pure functions

2022-12-14 Thread Sven Barth via fpc-devel
J. Gareth Moreton via fpc-devel schrieb am Di., 13. Dez. 2022, 22:09: > The next big milestone that I want to achieve is to make this a pure > function: > > procedure int_str_unsigned(l:longword;out s:shortstring); pure; > var >m1 : longword; >pcstart, >pc2start, >pc,pc2 : pchar;