Hi again,

>>I am interested in contributing code to enable ARM port. I plan to spend
some times on learning gofrontend firstly, then the bridge.

That sounds great.  I can certainly offer advice and help along the way.

>>1, Is there any arch-specific code/IR in gofrontend?

The frontend code (e.g. the "go" subdir in the gofrontend repo) doesn't
have anything architecture-specific as far as I know (Ian can correct me if
I am wrong here). The gofrontend repo also has a "libgo" subdirectory
containing the Go runtime and standard packages, and there are obviously
arch-specific portions there (both in Go code and C code).

2, What's the missing to support ARM ABI in gollvm bridge, anything else
besides of passing parameters?

In the gollvm 'bridge' subdirectory there is a C++ class CABIOracle; this
is the class that you'll need to focus on. The model we're using is that
when other parts of the bridge need to ask ABI-related questions about a
function call, they create a CABIOracle object (passing the oracle type
information about the call), then invoke various methods to get info on how
parameters are passed, etc.

At the moment there is only a single CABIOracle (since we support a single
target); it probably makes sense to create subclasses for each target of
interest. You'll need to read up on the aarch64 calling convention
(especially section 5 of the ARM doc
<http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf>)
and write new sets of rules to use.There is also a set of stand-alone unit
tests for the CABIOracle class, which is probably a good place to start
looking at it.  I'll write down a more specific list of tips and pointers
to the code later today; stay tuned.

>>3, What can we do on runtime for arm?

The libgo runtime already has ARM linux support that is in use for gccgo,
so in theory you should be able to use what's already there.

Cheers, Than


On Mon, Dec 10, 2018 at 9:52 PM <morefun.f...@gmail.com> wrote:

>
> @Than, Thank you for your detailed answer.
>
> I am interested in contributing code to enable ARM port. I plan to spend
> some times on learning gofrontend firstly, then the bridge. What I want to
> learn about are
>
> 1, Is there any arch-specific code/IR in gofrontend?
> 2, What's the missing to support ARM ABI in gollvm bridge, anything else
> besides of passing parameters?
> 3, What can we do on runtime for arm?
> 4, How to test what we do on arm without building support?
>
> I would be appreciated if you can give me suggestion and guidance.
>
> Thanks
>
>
> 在 2018年12月11日星期二 UTC+8上午2:46:47,Than McIntosh写道:
>>
>> Hello,
>>
>> As things stand, gollvm isn't usable for Arm (32 or 64); the cmake error
>> you are hitting is intentional.
>>
>> The main obstacle for enabling Arm is enhancing the Gollvm bridge to
>> support the Arm ABI, e.g. the rules for passing parameters (in memory vs
>> register) depending on the signature of the called routine.  Adding ARM
>> support is something that's on the Gollvm "to do" list, but hasn't reached
>> the top. Once the ABI support is there it should not be a lot of additional
>> work.
>>
>> If you are interested in contributing code to help fix the problem, we
>> can point you in the right direction and provide guidance, but it will take
>> a bit of doing.
>>
>> Thanks, Than
>>
>>
>> On Mon, Dec 10, 2018 at 12:54 PM <morefu...@gmail.com> wrote:
>>
>>>  I try to compile gollvm on arm platform according to
>>> https://go.googlesource.com/gollvm/, but error is reported as following
>>>
>>> CMake Error at tools/gollvm/cmake/modules/GoVars.cmake:12 (message):
>>>   Arch aarch64 not yet supported
>>>
>>> https://go.googlesource.com/gollvm/ tells that Gollvm is currently
>>> supported only for x86_64 Linux.
>>>
>>> Is there any way to compile gollvm on arm platform?
>>>
>>> Thanks
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to