Oml - LLVM backend for MultiOberon

Oberon Compiler with 3 different backends https://github.com/dvdagaev/Mob
Post Reply
Dmitry Dagaev
Posts: 68
Joined: Wed Mar 29, 2017 3:58 pm

Oml - LLVM backend for MultiOberon

Post by Dmitry Dagaev »

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: 68
Joined: Wed Mar 29, 2017 3:58 pm

Re: Oml - LLVM backend for MultiOberon

Post by Dmitry Dagaev »

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
Post Reply