[llvm-dev] Transpiler Question

Jason Ott via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 27 13:55:12 PDT 2018


Hello, Eli,

Thanks for the response.  I did end up finding the CBackendTarget from LLVM
3.1.

Most of my uncertainity about the documentation is that I've read:
https://llvm.org/docs/CommandGuide/llc.html
https://llvm.org/docs/CodeGenerator.htm
https://llvm.org/docs/WritingAnLLVMBackend.html

>From those, I'm still not sure if llc is as modular as opt -- can I just
develop off branch and run llc to load my .so and run my backend that way
or do I have to develop on branch? (Effectively, I'm asking if I can
develop my targets like one would develop passes.)
It only references physical targets, hence my uncertainty if LLVM was able
to support the virtual targets (my intuition said yes, but there isn only
one line int he "Writing an LLVM Backend" documentation that references a
support for a "software target" so I wanted to make sure.) Thanks for
clearing that up.

Thanks, for pointing to WebAssmebly.  I briefly looked through that, but it
looked as though it had all of the definitions of the Sparc or X86 targets,
so I assumed it was overkill and discovered the CBackend.

On Mon, Aug 27, 2018 at 1:11 PM Friedman, Eli <efriedma at codeaurora.org>
wrote:

> On 8/27/2018 11:35 AM, Jason Ott via llvm-dev wrote:
> > I want to use LLVM as the main component in my compilation process.
> > In doing so, I know I need to convert a high-level language to another
> > language (python or a custom syntax.)
> >
> > The architecture I'm targeting is non-traditional hardware:
> > microfluidic devices.  Microfluidic devices are a specific class of
> > reconfigurable computing; which don't necessarily adhere to a
> > traditional Von-Neuamann architecture.  What I'm aiming to do is to
> > take my high level language and convert it a language that is accepted
> > by one of the synthesizers we have (in python or a custom syntax)
> > which will then simulate/execute the given program.
> >
> > The workflow I have is as such:
> > High level language -> parsed and converted to C++ -> LLVM -> machine
> > code (python or custom syntax.)
> >
> > I'm not 100% sure if I should write a full backend for python and our
> > custom syntax.  The documentation here:
> > https://llvm.org/docs/WritingAnLLVMBackend.html discusses various
> > hardware targets but nothing on software targets.
> >
> > My questions are as such:
> > - Is my case the correct use of LLVM?
>
> "Virtual" targets, which don't target any physical hardware, are pretty
> common.  In-tree, we have WebAssembly, NVPTX, and BPF.  It's hard to say
> more without knowing more about your target.
>
> > - Should I be writing an LLVM backend to transpile? (if not would a
> > pass suffice?)
>
> Using the LLVM backend infrastructure gives you a bunch of useful code
> like handling for types and operations which aren't natively supported
> by your target, calling convention handling, a register allocator
> (including PHI elimination), and stack frame layout.  So writing a
> backend is probably the easiest approach unless your target IR is very
> similar to LLVM IR.
>
> > - Is there any documentation that I have missed trying to target a
> > software architecture?
>
> In practice, the "virtual" targets look pretty similar to normal
> hardware targets.  What specifically are you looking for documentation on?
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180827/cd6dc44c/attachment.html>


More information about the llvm-dev mailing list