Introduction

This document describes working of a bitcode parser in Sulong project. Sulong takes LLVM Intermediate Representation (IR) as input and executes it on Java Virtual Machine (JVM).

\noindent LLVM project provides an infrastructure for developing a compiler for a programming language. Such a compiler can emit LLVM Intermediate Representation (IR) as per the standardized specification for it. LLVM IR is Static Single Assignment (SSA) based representation that can be generated in a binary format or a human readable texual format. Current version of Sulong (commit ce80335) uses LLVM IR in binary format referred as bitcode in this document.

A typical execution cycle for a program in Sulong is shown in Figure above. LLVM IR is generated using clang for C/C++ or DragonEgg plugin of GCC for Fortran programs. Bitcode parser converts this LLVM IR into module object which is then used to generate an Abstract Syntax Tree (AST) using the Truffle framework. Truffle AST can be executed on JVM by interpreting it and can be just-in-time (JIT) compiled into a machine code using the Graal compiler.

Sulong bitcode parser is explained in rest of the document. Section \ref{organization} describes the structure of the bitcode file. Parsing of bitcode file is explained in \ref{parsing}. This document is based on the understanding and experimentation done by the author while working on the Sulong bitcode parser. It is based on the commit ce80335 of Sulong project, Truffle commit 3895ff0 and Graal commit 87b6ac0.

results matching ""

    No results matching ""