Work on ARM backend for DMD started

Brad Roberts via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Jul 4 01:21:51 PDT 2017


On 7/3/2017 11:50 PM, Iain Buclaw via Digitalmars-d-announce wrote:
> On Monday, 3 July 2017 at 23:16:07 UTC, solidstate1991 wrote:
>> While I currently don't have an ARM based hardware that would be easy 
>> to develop on, I'm planning to use QEMU to emulate some form of ARMv6 
>> CPU, as it'll be the main target, as it's still being used in devices 
>> like the Raspberry Pi. ARMv5 is being considered if it doesn't need a 
>> lot of work, although I don't see a lot of reason behind doing it 
>> besides of the possibility of enabling the development of homebrew 
>> GBA, NDS, GP32, etc stuff.
>>
>> As I became unemployed recently, I have a lot more time for 
>> development, so time now isn't an issue. Or at least until I find a 
>> job, which is hard due to my state as a college student, which I'm on 
>> the verge of losing it.
>>
>> I would accept your input on various things, like if I should do some 
>> adjustments to the in-line assembly stuff, whether I should care 
>> about thumb (reduced size instruction set, not available on some 
>> newer targets) or not, etc. Got my hands on some official reference 
>> manual, it wouldn't hurt if I could research other ones too.
>
> I'm aware that this is a topic that's occasionally brought up, but as 
> someone is proposing to go from idea to implementation.  It seems like 
> a good time to point out.
>
> Someone did this 5 years ago as part of splitting the backend into 
> interfaces - or at least as a working concept that the new interfaces 
> actually allowed you to implement a new target.
>
> Maybe you should use their work as a starting or reference point. 
>  You'd probably save yourself most the trouble of working out how 
> things connect.
>
> Iain.

Unless someone else toyed with it also, it was me.  There's a branch 
called 'arm' in my fork of dmd that has a lot of groundwork.  I'm sure 
it's somewhat bitrotten in the few years since I last looked at it.  I 
got as far as being able to emit some _extremely_ basic functions (like 
calls to libc -- printf worked) and link.  I wrote the asm code -- as an 
exercise to force being able to encode much of the arm instruction set 
(if I remember right, pretty much everything except the neon vector 
instructions, and maybe even part of that set) in code structs.  But I 
didn't get to writing the arm version of almost any cd* functions to 
translate the ir into actual code objects.

Honestly, it's a pretty bad proposition.  I did what I did as much to 
learn about the arm instruction set as to get an arm dmd backend.  It 
did teach me a lot and I don't consider it entirely wasted time, but if 
the aim is to do anything beyond learning, I'd urge looking for a 
different project.  Just getting code of really bad quality emitted will 
be a lot of work (on top of all the parts I did).  Getting mediocre code 
will be another large amount of work. Getting code close to ldc or gdc 
is unlikely to ever happen.

So, look closely at your motivations and available time.


More information about the Digitalmars-d-announce mailing list