[llvm-dev] Can LLVM optimize for a stack machine backend?

Petr Penzin via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 29 15:04:25 PDT 2021


This is a bit out of date, LLVM now has a stack-based target included by 
default - WebAssembly. It has a "stackifier" implementation (look for 
files with Stackify in the name inside llvm/lib/Target/WebAssembly). 
However, stack transformations are in fact somewhat of a pain point, 
that's one of the reasons Emscripten (C/C++ to Wasm compiler) uses an 
additional tool after emitting code using Clang/LLVM, though another 
popular Wasm toolchain does not.

Best,
Petr



On 4/29/21 10:06 AM, Quentin Colombet via llvm-dev wrote:
> Hi Xiaohui,
>
> I think the situation didn’t really change with respect to what you found.
> In particular I believe the advice from Chris that you already found 
> (https://lists.llvm.org/pipermail/llvm-dev/2008-November/018626.html 
> <https://lists.llvm.org/pipermail/llvm-dev/2008-November/018626.html>) 
> is the best thing you can do right now.
>
> Cheers,
> -Quentin
>
>> On Apr 28, 2021, at 11:17 PM, Xiaohui Liu via llvm-dev 
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> Hi all,
>>
>> I am developing a high-level language that compiles to bytecode for a 
>> stack-based virtual machine. There are only two stacks similar to 
>> Forth <https://en.wikipedia.org/wiki/Forth_(programming_language)>.
>>
>> LLVM IR seems register-machine oriented and most backends target 
>> register machines. I have seen several attempts to use it for a stack 
>> machine backend, such as this 
>> <https://lists.llvm.org/pipermail/llvm-dev/2009-February/020335.html>, 
>> this 
>> <https://lists.llvm.org/pipermail/llvm-dev/2008-November/018626.html>, 
>> and this 
>> <https://lists.llvm.org/pipermail/llvm-dev/2006-August/006460.html>. 
>> What is the state of the art of using LLVM to optimize for a stack 
>> machine? Or LLVM is not a good choice for this job?
>>
>> Regards,
>> Xiaohui
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210429/5c597767/attachment.html>


More information about the llvm-dev mailing list