Discussion:
[OpenRISC] OpenRISC LLVM backend improvements
Alessandro Di Federico
2014-05-23 14:58:58 UTC
Permalink
Hi all guys, we are a group of research from the compiler group of
Politecnico di Milano, Italy. We are currently working on a compiler
for the OpenRISC architecture in the context of a project in
collaboration with the University of Bologna and the ETH of Zurich.

Basically we've been working to update existing LLVM backend for
OpenRISC to the current official trunk and we have introduced several
fixes and improvement, among which:

* Refactoring of various parts of the backend (both TableGen and C++).
* We implemented support for the missing instructions (l.m{f,t}spr,
l.addc, l.ext* and so on).
* Major improvements in the integrated disassembler.
* Some codegen improvements, in particular in instruction selection
and scheduling.
* Fixed some bugs.

Currently we're working on the selection of the MAC instruction in the
IR, on the floating point and refactoring on the Clang driver and
TargetInfo description.

We also have a proposal for a change to ABI in order to fix the
inconsistency of the calling convention between ordinary and variadic
functions. In particular, our proposal keeps unchanged the calling
convention for ordinary functions. The parameter passing mechanisim is
identical for both ordinary and variadic function, thus making the
caller agnostic w.r.t. the callee kind (ordinary or variadic).
Therefore we modified the va_list structure in order properly track
parameters passed by register (that must be copied on the stack at the
function entry) and parameters passed on the stack.
Currently we implemented this ABI variant in our LLVM backend, and we'd
be happy to have some feedback from you about it.

We'd be excited to give a talk at ORCONF 2014 about this, if you find
this of interest.

--
Alessandro Di Federico
Christian Svensson
2014-05-24 21:52:03 UTC
Permalink
Hi,

Nice work! Giving LLVM some love and attention is long overdue, thanks for
doing that.

Also, I'm definitely interested in knowing more of the ABI changes you are
proposing.

Regards,
Christian



On Fri, May 23, 2014 at 3:58 PM, Alessandro Di Federico <
Post by Alessandro Di Federico
Hi all guys, we are a group of research from the compiler group of
Politecnico di Milano, Italy. We are currently working on a compiler
for the OpenRISC architecture in the context of a project in
collaboration with the University of Bologna and the ETH of Zurich.
Basically we've been working to update existing LLVM backend for
OpenRISC to the current official trunk and we have introduced several
* Refactoring of various parts of the backend (both TableGen and C++).
* We implemented support for the missing instructions (l.m{f,t}spr,
l.addc, l.ext* and so on).
* Major improvements in the integrated disassembler.
* Some codegen improvements, in particular in instruction selection
and scheduling.
* Fixed some bugs.
Currently we're working on the selection of the MAC instruction in the
IR, on the floating point and refactoring on the Clang driver and
TargetInfo description.
We also have a proposal for a change to ABI in order to fix the
inconsistency of the calling convention between ordinary and variadic
functions. In particular, our proposal keeps unchanged the calling
convention for ordinary functions. The parameter passing mechanisim is
identical for both ordinary and variadic function, thus making the
caller agnostic w.r.t. the callee kind (ordinary or variadic).
Therefore we modified the va_list structure in order properly track
parameters passed by register (that must be copied on the stack at the
function entry) and parameters passed on the stack.
Currently we implemented this ABI variant in our LLVM backend, and we'd
be happy to have some feedback from you about it.
We'd be excited to give a talk at ORCONF 2014 about this, if you find
this of interest.
--
Alessandro Di Federico
_______________________________________________
OpenRISC mailing list
http://lists.openrisc.net/listinfo/openrisc
Alessandro Di Federico
2014-06-06 13:36:08 UTC
Permalink
On Sat, 24 May 2014 22:52:03 +0100
Post by Christian Svensson
Also, I'm definitely interested in knowing more of the ABI changes
you are proposing.
OK, we put up a proposal. Feedback is welcome!

--
Ale

# OR1K NewABI description #

NewABI is a variant of the standard OR1K ABI. The differences between
the two ABIs are located in the calling convention of variadic
function. The objective of NewABI is to change the convention in order
to have the same convention for parameter passing on ordinary and
variadic functions.

Consider the following example:

void callee(int a, ...);

void caller() {
callee(0, 1, 2, 3, 4, 5, 6, 7);
}

using NewABI, the assembly code for the caller will contain something
like:

caller:
// ...
l.ori r3, r0, 6
l.ori r4, r0, 6
l.sw 4(r1), r4
l.sw 0(r1), r3
l.ori r3, r0, 0
l.ori r4, r0, 1
l.ori r5, r0, 2
l.ori r6, r0, 3
l.ori r7, r0, 4
l.ori r8, r0, 5
l.jal caller
l.nop
// ...

Basically parameters are passed by register as long as possible, and
then are pushed on the stack, just as would happen with a call to a
non-variadic function.
Stefan Kristiansson
2014-06-06 14:16:25 UTC
Permalink
On Fri, Jun 6, 2014 at 4:36 PM, Alessandro Di Federico
Post by Alessandro Di Federico
On Sat, 24 May 2014 22:52:03 +0100
Post by Christian Svensson
Also, I'm definitely interested in knowing more of the ABI changes
you are proposing.
OK, we put up a proposal. Feedback is welcome!
To keep things bundled, here's is a couple of links to discussions
last time this was proposed:
http://lists.openrisc.net/pipermail/openrisc/2013-September/001856.html


Stefan
Stefan Kristiansson
2014-05-24 22:03:23 UTC
Permalink
On Fri, May 23, 2014 at 5:58 PM, Alessandro Di Federico
Post by Alessandro Di Federico
Hi all guys, we are a group of research from the compiler group of
Politecnico di Milano, Italy. We are currently working on a compiler
for the OpenRISC architecture in the context of a project in
collaboration with the University of Bologna and the ETH of Zurich.
Basically we've been working to update existing LLVM backend for
OpenRISC to the current official trunk and we have introduced several
* Refactoring of various parts of the backend (both TableGen and C++).
* We implemented support for the missing instructions (l.m{f,t}spr,
l.addc, l.ext* and so on).
* Major improvements in the integrated disassembler.
* Some codegen improvements, in particular in instruction selection
and scheduling.
* Fixed some bugs.
Currently we're working on the selection of the MAC instruction in the
IR, on the floating point and refactoring on the Clang driver and
TargetInfo description.
That sounds great!
Post by Alessandro Di Federico
We also have a proposal for a change to ABI in order to fix the
inconsistency of the calling convention between ordinary and variadic
functions. In particular, our proposal keeps unchanged the calling
convention for ordinary functions. The parameter passing mechanisim is
identical for both ordinary and variadic function, thus making the
caller agnostic w.r.t. the callee kind (ordinary or variadic).
Therefore we modified the va_list structure in order properly track
parameters passed by register (that must be copied on the stack at the
function entry) and parameters passed on the stack.
Currently we implemented this ABI variant in our LLVM backend, and we'd
be happy to have some feedback from you about it.
We've had a discussion about this last orconf, but it was decided to
keep the current ABI.
Post by Alessandro Di Federico
We'd be excited to give a talk at ORCONF 2014 about this, if you find
this of interest.
I'm sure there is, at least I'm interested in hearing more.

Stefan
Simon Cook
2014-05-30 07:48:55 UTC
Permalink
Hi Allesandro,

This sounds great, I had been merging in trunk every few months but haven't
had much time to maintain it beyond this recently, so good to see it being
improved.

Is the code for your changes available somewhere, it would be nice to have
a look/give the enhancements a try?

Thanks,
Simon
On 23 May 2014 16:00, "Alessandro Di Federico" <
Post by Alessandro Di Federico
Hi all guys, we are a group of research from the compiler group of
Politecnico di Milano, Italy. We are currently working on a compiler
for the OpenRISC architecture in the context of a project in
collaboration with the University of Bologna and the ETH of Zurich.
Basically we've been working to update existing LLVM backend for
OpenRISC to the current official trunk and we have introduced several
* Refactoring of various parts of the backend (both TableGen and C++).
* We implemented support for the missing instructions (l.m{f,t}spr,
l.addc, l.ext* and so on).
* Major improvements in the integrated disassembler.
* Some codegen improvements, in particular in instruction selection
and scheduling.
* Fixed some bugs.
Currently we're working on the selection of the MAC instruction in the
IR, on the floating point and refactoring on the Clang driver and
TargetInfo description.
We also have a proposal for a change to ABI in order to fix the
inconsistency of the calling convention between ordinary and variadic
functions. In particular, our proposal keeps unchanged the calling
convention for ordinary functions. The parameter passing mechanisim is
identical for both ordinary and variadic function, thus making the
caller agnostic w.r.t. the callee kind (ordinary or variadic).
Therefore we modified the va_list structure in order properly track
parameters passed by register (that must be copied on the stack at the
function entry) and parameters passed on the stack.
Currently we implemented this ABI variant in our LLVM backend, and we'd
be happy to have some feedback from you about it.
We'd be excited to give a talk at ORCONF 2014 about this, if you find
this of interest.
--
Alessandro Di Federico
_______________________________________________
OpenRISC mailing list
http://lists.openrisc.net/listinfo/openrisc
Alessandro Di Federico
2014-06-16 10:40:13 UTC
Permalink
On Fri, 30 May 2014 08:48:55 +0100
Post by Simon Cook
This sounds great, I had been merging in trunk every few months but
haven't had much time to maintain it beyond this recently, so good to
see it being improved.
Is the code for your changes available somewhere, it would be nice to
have a look/give the enhancements a try?
Hi Simon, sorry for the delay we had some issue with our infrastructure.

http://compilergroup-srv.elet.polimi.it/pulp/git/

Currently we've made publicly available only the LLVM and Clang
repository, but we've also been working on compiler-rt and put up a
small project for other pieces of the runtime such as crtbegin and
crtend (which are required if you use `-target or1k-elf`).

We'd be glad to hear some feedback from you!

We are also working on support for little endian in Clang/LLVM, GCC,
binutils, gdb and or1ksim.

--
Ale
Stefan Kristiansson
2014-06-16 11:38:49 UTC
Permalink
On Mon, Jun 16, 2014 at 1:40 PM, Alessandro Di Federico
Post by Alessandro Di Federico
On Fri, 30 May 2014 08:48:55 +0100
Post by Simon Cook
This sounds great, I had been merging in trunk every few months but
haven't had much time to maintain it beyond this recently, so good to
see it being improved.
Is the code for your changes available somewhere, it would be nice to
have a look/give the enhancements a try?
Hi Simon, sorry for the delay we had some issue with our infrastructure.
http://compilergroup-srv.elet.polimi.it/pulp/git/
Hey, I took a quick peek through the commits, and from what I saw, it
looked all good.
Nice work!

Stefan
Simon Cook
2014-06-16 13:19:00 UTC
Permalink
On Mon, Jun 16, 2014 at 11:40 AM, Alessandro Di Federico
Post by Alessandro Di Federico
Hi Simon, sorry for the delay we had some issue with our infrastructure.
http://compilergroup-srv.elet.polimi.it/pulp/git/
Currently we've made publicly available only the LLVM and Clang
repository, but we've also been working on compiler-rt and put up a
small project for other pieces of the runtime such as crtbegin and
crtend (which are required if you use `-target or1k-elf`).
We'd be glad to hear some feedback from you!
We are also working on support for little endian in Clang/LLVM, GCC,
binutils, gdb and or1ksim.
Hi,

Thanks, I'll take a look at it fully when I get the chance, but what I
have look at so far looks good (I'm evening considering should the
funny nop replacer be on by default)

Thanks,
Simon
Stefan Kristiansson
2014-07-22 02:58:32 UTC
Permalink
On Mon, Jun 16, 2014 at 1:40 PM, Alessandro Di Federico
Post by Alessandro Di Federico
On Fri, 30 May 2014 08:48:55 +0100
Post by Simon Cook
This sounds great, I had been merging in trunk every few months but
haven't had much time to maintain it beyond this recently, so good to
see it being improved.
Is the code for your changes available somewhere, it would be nice to
have a look/give the enhancements a try?
Hi Simon, sorry for the delay we had some issue with our infrastructure.
http://compilergroup-srv.elet.polimi.it/pulp/git/
I tried taking a closer look at this and maybe merging/pushing out this into
github.com/openrisc/, but it's not possible to clone (only browse them)
the repositories from that link.
Could you take a look what's wrong?

Stefan

Loading...