users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Porting to arm/aarch64


From: jasper
Subject: Re: Porting to arm/aarch64
Date: Tue, 04 Aug 2020 23:19:24 -0000

This just got a bit more urgent as Apple announced that new Macs will use ARM rather than Intel processors!

On 15 Jun 2020 10:51 am, Jasper Taylor <jasper@simulistics.com> wrote:

Hi Daniel,

I've read the PORTING file but it's pretty incomplete in describing the task. I'm currently stalled trying to figure out how to implement the Code_Start function in the translation file. For most of the functions I can see where the translation comes from in the output of compiling asm_inst.c to assembler, but not for Code_Start -- that seems to depend on saving and restoring some registers that Prolog is using, so an equivalent cannot be made by the c compiler.

I am using the powerpc_any.c file as a starting point, as I have powerpc hardware I can build stuff on and it looks more like a RISC architecture so more similar to the ARM than x86.

Also I haven't been able to figure out what registers to use on the ARM, as some are call-clobbered and this seems to cause problems for using them in assembly language.

Cheers

    Jasper

On 12/06/2020 13:35, Daniel Diaz wrote:
Hi Jasper,

Sorry for the late reply,

You can have a look at the PORTING file which gives some information about adding a new architecture. 
The main task is to write a mapper from MiniAssembly to Asm. See example files in src/Ma2Asm which contains mapper MA->ASM for various architectures. 
The mappers are written in C (it is a good idea to use another mapper as basis) .Maybe look at the file mips_irix.c file.
I generally look at the asm generated by gcc (using various optimization flags in order to understand the asm generated, -O0 to -O3).
For this you can look at src/Ma2Asm/FromC. Do a make (modify Makefile to test with various CFLAGS). It compiles asm_inst.c to asm ; the study of asm_inst.s gives you hints about the translation of MA instructions.
Maybe you need to adapt the asm_inst.c file.
Basically it contains C functions whose translation to asm helps you to write the mapper (the name of C functions are useful to know what Ma instruction it corresponds).

Don’t hesitate to write me directly if you need more help (by mail to Daniel.Diaz@univ-paris1.fr).

Daniel

Le 30 mai 2020 à 16:39, Jasper Taylor <jasper@simulistics.com> a écrit :

Hi all,

I am thinking about trying to port GNU prolog to the ARM architecture (linux os). Before I get started, has anyone already had a go at this, if so, how far did you get and what problems did you encounter?

Thanks for reading

    --Jasper






reply via email to

[Prev in Thread] Current Thread [Next in Thread]