Kaleidoscope: Code generation to LLVM IR - D language

Ferhat Kurtulmuş aferust at gmail.com
Mon May 22 10:03:12 UTC 2023


On Monday, 22 May 2023 at 07:35:21 UTC, Jelena wrote:
> Hello everyone,
>
> I am tasked to translate this code: 
> https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.html into D language.
>
> However, I have a problem with part 3.2. where the following 
> appears:
> static std::unique_ptr\<LLVMContext> TheContext;
> static std::unique_ptr\<IRBuilder\<>> Builder(TheContext);
> static std::unique_ptr\<Module> TheModule;
> static std::map\<std::string, Value *> NamedValues;
>
> I am interested in how it is even possible to import things 
> like: LLVMContex, IRBuilder and similar.


Disclaimer: I am not involved in any compiler development stuff.

If I understand, you are trying to do what 
[LDC](https://github.com/ldc-developers/ldc) does, but not in C++ 
(as LLVM backend of d, LDC, is written in C++), in d instead. 
Then, you need an LLVM binding to d. Here there is one. If this 
is not the case, please ignore my message.

https://code.dlang.org/packages/llvm-d
https://github.com/search?q=repo%3AMoritzMaxeiner%2Fllvm-d%20LLVMContex&type=code


More information about the digitalmars-d-ldc mailing list