Recent

Author Topic: Can we get LLVM IR file?  (Read 693 times)

eastek_johnny

  • Newbie
  • Posts: 2
Can we get LLVM IR file?
« on: February 20, 2020, 07:07:55 am »
Hello everyone,
I recently have a Lazarus project for using WebAssembly.
First, I found this https://wiki.freepascal.org/WebAssembly/Compiler.
But, it doesn't seem to corporate with RTL.
So, I have found the support for LLVM backend for freepascal (https://wiki.freepascal.org/LLVM).
There is one open task in this link.
  - directly generate bitcode (.bc) instead of bitcode assembly (.ll) files
Can we interpret this sentence as we can get the .ll files now?
If we can, how to get the .ll files (what compile parameters we should set)?

Any discussion or advise for using WebAssembly is welcome.

PascalDragon

  • Hero Member
  • *****
  • Posts: 1713
  • Compiler Developer
Re: Can we get LLVM IR file?
« Reply #1 on: February 20, 2020, 09:15:18 am »
I recently have a Lazarus project for using WebAssembly.
First, I found this https://wiki.freepascal.org/WebAssembly/Compiler.
But, it doesn't seem to corporate with RTL.

First of it's Free Pascal, not Lazarus. Second it's still at an early stage and work in progress. You could however try to implement the RTL for the WebAssembly target for example for Emscripten or a custom JS side of the RTL written in Pas2JS...

So, I have found the support for LLVM backend for freepascal (https://wiki.freepascal.org/LLVM).
There is one open task in this link.
  - directly generate bitcode (.bc) instead of bitcode assembly (.ll) files
Can we interpret this sentence as we can get the .ll files now?
If we can, how to get the .ll files (what compile parameters we should set)?

In case you intend to use the generated bitcode assembly files for WebAssembly, forget it. The LLVM IR might by itself be platform independant, but the code that is generated with it, is not. It just as much depends on the underlying operating system as if it was generated with the non-LLVM backend.

eastek_johnny

  • Newbie
  • Posts: 2
Re: Can we get LLVM IR file?
« Reply #2 on: February 24, 2020, 01:41:38 am »
OK! I understand. Thanks for your reply. :)

 

TinyPortal © 2005-2018