LLVM RISCV compiler

310 views
Skip to first unread message

Gnanasekar R

unread,
May 9, 2018, 11:31:40 PM5/9/18
to sw-...@groups.riscv.org
Hi,

Any body using llvm to compile code for RISC. If so can you please tell me which repo are you guys using to compile the toolchain. I am seeing two repos,

but this is clang-5 

Another option is to use,

Regards,
Gnanasekar

Alex Bradbury

unread,
May 9, 2018, 11:41:52 PM5/9/18
to Gnanasekar R, RISC-V SW Dev
Hi Gnanasekar. I'm the maintainer of that second repository and
upstream code owner for LLVM. As the README in the repo states, you
probably want to build upstream LLVM:

"
As of May 2018, the vast majority of these patches are now upstream
and most users wishing to experiment with support for RISC-V in LLVM
projects will likely be best served by building directly from the
upstream repositories. You may prefer to follow this repository if you
want to study how the backend is put together.
"

The only notable patch that's not yet upstreamed is the one that
enables RV64I codegen. This is a fairly trivial patch as the backend
was designed to be parameterisable by the register length (rather than
relying on copy and paste of instruction definitions). The only reason
it hasn't been pushed upstream yet is that I need to set down and
flesh out the unit tests. I expect to do this within the next month.

I hope that helps,

Alex

Gnanasekar R

unread,
May 10, 2018, 1:09:02 AM5/10/18
to Alex Bradbury, RISC-V SW Dev
Hi Alex,

Thanks for the info. Do you have pre-built binaries uploaded somewhere? I am looking for a x86 binary cross compiled for a RISCV target. I ran into space issues on my VM while trying to build and will take a while to fix and restart the build. Meanwhile if you have the binaries I could try that.

Regards,
Gnanasekar

Alex Bradbury

unread,
May 10, 2018, 1:21:53 AM5/10/18
to Gnanasekar R, RISC-V SW Dev
On 10 May 2018 at 07:09, Gnanasekar R <gnanase...@gmail.com> wrote:
> Hi Alex,
>
> Thanks for the info. Do you have pre-built binaries uploaded somewhere? I am
> looking for a x86 binary cross compiled for a RISCV target. I ran into space
> issues on my VM while trying to build and will take a while to fix and
> restart the build. Meanwhile if you have the binaries I could try that.

We're just crossing over the the point where LLVM+Clang is actually a
productive choice at least for RV32 embedded workloads (expect more
news related to this soon), which means it makes a lot of sense to
host nightly builds at least until RISCV is compiled by default in an
official numbered release. I intend to do so, but it's going to be a
little while.

You could reduce disk space requirements by producing a Release rather
than a Debug build. I'd recommend at least Release+Asserts so there's
at least some feedback if things are going wrong.

Best,

Alex

Gnanasekar R

unread,
May 10, 2018, 2:48:44 AM5/10/18
to Alex Bradbury, RISC-V SW Dev
Ok, i have restarted my build.

In case of riscv32-xxxx-gcc I compile with "-march=rv32imc -mabi=ilp32" option to specify my target arch and abi type. Will I have similar option in llvm too? specifically curious about abi.
Reply all
Reply to author
Forward
0 new messages