Re: D on lm32-CPU: string argument on stack instead of register

2020-08-05 Thread FeepingCreature via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 17:36:53 UTC, Michael Reese wrote: Thanks for suggesting! I tried, and the union works as well, i.e. the function args are registered. But I noticed another thing about all workarounds so far: Even if calls are inlined and arguments end up on the stack, the linker

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-04 Thread Michael Reese via Digitalmars-d-learn
On Saturday, 1 August 2020 at 23:08:38 UTC, Chad Joan wrote: Though if the compiler is allowed to split a single uint64_t into two registers, I would expect it to split struct/string into two registers as well. At least, the manual doesn't seem to explicitly mention higher-level constructs

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-01 Thread Chad Joan via Digitalmars-d-learn
On Saturday, 1 August 2020 at 08:58:03 UTC, Michael Reese wrote: [...] So the compiler knows how to use r1 and r2 for arguments. I checked again in the lm32 manual (https://www.latticesemi.com/view_document?document_id=52077), and it says: "As illustrated in Table 3 on page 8, the first

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-01 Thread Michael Reese via Digitalmars-d-learn
On Friday, 31 July 2020 at 15:13:29 UTC, Chad Joan wrote: THAT SAID, I think there are things to try and I hope we can get you what you want. If you're willing to entertain more experimentation, here are my thoughts: Thanks a lot for the suggestions and explanations. I tried them all but

Re: D on lm32-CPU: string argument on stack instead of register

2020-07-31 Thread Johan via Digitalmars-d-learn
On Friday, 31 July 2020 at 10:22:20 UTC, Michael Reese wrote: My question: Is there a way I can tell the D compiler to use registers instead of stack for string arguments, or any other trick to reduce code size while maintaining an ideomatic D codestyle? A D string is a "slice", which is a

Re: D on lm32-CPU: string argument on stack instead of register

2020-07-31 Thread Chad Joan via Digitalmars-d-learn
On Friday, 31 July 2020 at 10:22:20 UTC, Michael Reese wrote: Hi all, at work we put embedded lm32 soft-core CPUs in FPGAs and write the firmware in C. At home I enjoy writing small projects in D from time to time, but I don't consider myself a D expert. Now, I'm trying to run some toy

D on lm32-CPU: string argument on stack instead of register

2020-07-31 Thread Michael Reese via Digitalmars-d-learn
Hi all, at work we put embedded lm32 soft-core CPUs in FPGAs and write the firmware in C. At home I enjoy writing small projects in D from time to time, but I don't consider myself a D expert. Now, I'm trying to run some toy examples in D on the lm32 cpu. I'm using a recent gcc-elf-lm32. I