Oml - LLVM backend for MultiOberon

Oberon Compiler with 3 different backends https://github.com/dvdagaev/Mob

Oml - LLVM backend for MultiOberon

Postby Dmitry Dagaev » Thu Jul 23, 2020 6:26 pm

Oml backend outputs LLVM bytecode files in textual .ll and binary .bc representation. The .bc file can be dynamically loaded by OmlBcLoader which uses JIT compiler.

MultiOberon build command produces object file .o, which can be dynamically loaded and executed by runtime.

MultiOberon build provides also linking abilities for creating executive.
Dmitry Dagaev
 
Posts: 65
Joined: Wed Mar 29, 2017 3:58 pm

Re: Oml - LLVM backend for MultiOberon

Postby Dmitry Dagaev » Fri Jul 24, 2020 5:59 pm

Simple example demonstates howto compile HelloWorld in command line
Code: Select all
c:\suok5\Mob>Blwe\omlsh co -odc OmtestHelloWorld
oml:compiling c:\suok5\Mob/Omtest/Mod/HelloWorld.odc  >c:\suok5\Mob/Omtest/Clwe/OmtestHelloWorld .ll=9742 .bc=3420

Compilation results in .ll and .bc bytecode files

After this, the program can be executed in LLVM JIT compiler
Code: Select all
c:\suok5\Mob>Blwe\omlsh run -ext bc OmtestHelloWorld
Hello, World


But loading in JIT is too time-consuming.
Just compile this to object file.
Code: Select all
c:\suok5\Mob>Blwe\omlsh build OmtestHelloWorld
===== obj-building HostConLog ... done
===== obj-building OmtestHelloWorld ... done


After this, the object file can be loaded with all necessary fixups
Code: Select all
c:\suok5\Mob>Blwe\omlsh run OmtestHelloWorld
Hello, World


If we need 64-bit, use the similar shell from Blwr directory. Blwr is 64-bit binary catalog. Blwr differs from Blwe, as RAX register differs from EAX. Compile
Code: Select all
c:\suok5\Mob>Blwr\omlsh co -odc OmtestHelloWorld
oml:compiling c:\suok5\Mob/Omtest/Mod/HelloWorld.odc  >c:\suok5\Mob/Omtest/Clwr/OmtestHelloWorld .ll=9742 .bc=3424


Build
Code: Select all
c:\suok5\Mob>Blwr\omlsh build OmtestHelloWorld
===== obj-building HostConLog ... done
===== obj-building OmtestHelloWorld ... done


And Run
Code: Select all
c:\suok5\Mob>Blwr\omlsh run OmtestHelloWorld
Hello, World
Dmitry Dagaev
 
Posts: 65
Joined: Wed Mar 29, 2017 3:58 pm


Return to MultiOberon

Who is online

Users browsing this forum: No registered users and 1 guest