Reputation: 540
Does anyone know any example of an open source LLVM backend for a stack based machine? I need this for education purposes.
Upvotes: 14
Views: 2643
Reputation: 6249
The JVM is a stack-based virtual machine. VMKit was an open-source project of LLVM which implemented a JVM with a LLVM backend. The idea of VMKit was to create a toolkit for building virtual machines (or managed runtime environments) such as JVM, CLI/CLR, R's runtime etc. To find out more, see Nicolas Geoffray's PhD thesis. While the project is retired, the source code is still available.
Also, Microsoft have released llilc which is a LLVM JIT compiler for IL/MSIL/CIL (which could be argued is a stack machine). The JIT code can be found here.
Upvotes: 2