[llvm-dev] Transpiler Question

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 27 13:11:08 PDT 2018


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



More information about the llvm-dev mailing list