digitalmars.D.ldc - Kaleidoscope: Code generation to LLVM IR - D language
- Jelena (11/11) May 22 2023 Hello everyone,
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (9/20) May 22 2023 Disclaimer: I am not involved in any compiler development stuff.
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.
May 22 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
May 22 2023