diff --git a/LLVM/cplusplus/KaleidoscopeJIT.h b/LLVM/cplusplus/KaleidoscopeJIT.h index a253a973a4cc9221a34ea5581ed41d87910831f1..86fdc1ed4fe98d92f86954d889c89e4df8f119ae 100644 --- a/LLVM/cplusplus/KaleidoscopeJIT.h +++ b/LLVM/cplusplus/KaleidoscopeJIT.h @@ -45,7 +45,9 @@ public: KaleidoscopeJIT() : Resolver(createLegacyLookupResolver( ES, - [this](const std::string &Name) { return findMangledSymbol(Name); }, + [this](StringRef Name) { + return findMangledSymbol(std::string(Name)); + }, [](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })), TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()), ObjectLayer(AcknowledgeORCv1Deprecation, ES, diff --git a/LLVM/cplusplus/ModuleMaker.cpp b/LLVM/cplusplus/ModuleMaker.cpp index beff40a8d5060cfd140fb7bf0769eb12077d3d87..e409dd60e9b04710ab4b304f9e0f409441702c04 100644 --- a/LLVM/cplusplus/ModuleMaker.cpp +++ b/LLVM/cplusplus/ModuleMaker.cpp @@ -1,9 +1,8 @@ //===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/LLVM/cplusplus/README.md b/LLVM/cplusplus/README.md index 5982954c4dd003aab269a61711171ba90e4dee9c..be506379f3efc3e743127f8358846d237aaef94f 100644 --- a/LLVM/cplusplus/README.md +++ b/LLVM/cplusplus/README.md @@ -11,36 +11,22 @@ This collection was prepared by Prof. R. C. Moore, fbi.h-da.de in May 2017 for the Compiler Construction course. No warranty implied or expressed. See LICENSE.TXT for the original license. -This version has been prepared for LLVM 4.0 (using Arch Linux in a vagrant box) -in May 2017. +This code assumes you have clang and the LLVM library installed -- see below. -This version can be fairly easily adpated to work with LLVM 3.9. -It does NOT work with earlier versions of LLVM. - -The current version was updated in Summer 2020 and worked with the current LLVM at that time. - -> -> **WARNING** In 2021, with LLVM 11, some of this directory works, but some doesn't. -> -> The broken parts will be fixed _soon_. -> +It is generally up-to-date with the latest LLVM release: + * The current version was updated in Summer 2020 and worked with the LLVM 10 at that time. + * Small changes have been made in 2021 to get it to work with LLVM 11. + * LLVM 12 was released in April 2021 (!) and this code has **not** been updated for it (yet), + since as of this writing, not even Arch Linux makes this available. + * However, **be warned**, this code will eventually be updated to LLVM 12! All of the example files (fibonacci.cpp, ModuleMaker.cpp and toy*.cpp): - - - are available in the LLVM source tree, for example by running the - following: - svn co https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_400/final/ - or by downloading the whole source tarball, where you will find a directory - named "examples", from: - http://llvm.org/releases/ - or directly from - http://releases.llvm.org/10.0.0/llvm-10.0.0.src.tar.xz - - - the directory structure has been simplified, some files have been renamed, - and a new Makefile is provided which is much simpler than the original cmake - system (but not guarenteed to work outside Linux). Test files have also - been added. See below. + - are available in the LLVM source tree, for example at <https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.1.0>. + - the directory structure has been simplified, some files have been renamed, + and a new Makefile is provided which is much simpler than the original cmake + system (but not guarenteed to work outside Linux). + - Test files have also been added. See below. Still, it should be emphasized that there is nothing really new here -- apart from the packaging, everything here is from the LLVM project! @@ -100,22 +86,22 @@ https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html Building ========= -(1) Install clang and the llvm tool kit. You can either compile from source - (see http://www.llvm.org/docs/GettingStarted.html - or perhaps better, - http://clang.llvm.org/get_started.html) or install binaries that you find - elsewhere (you SHOULD get LLVM 10.0.0 - No guarantees are made for older - OR NEWER versions!). +1. Install clang and the llvm tool kit. You can either compile from source + (see above) or install binaries that you find elsewhere. + In any case, be careful about the verison of LLVM you install (again, see above)! -(2) Run `make` (or perhaps `make clean` and then `make`). +2. Run `make` (or perhaps `make clean` and then `make`). -(3) If you wish, run `make tests` to run (almost) all the programs delivered - in this colleciton. The output from `make tests` is very long. +3. If you wish, run `make tests` to run (almost) all the programs delivered + in this colleciton. + The output from `make tests` is very long. Each program can also be tested individually, for example with `make testFibonacci` or `make testModuleMaker` or `make test5` (read the Makefile to see all alternatives). - **Note**: `make test9` is broken. We know. + + **Note**: `make test9` is broken. This is a known problem. That's why it's not included in `make tests`. - Please feel free to fix it. + Please feel free to help me fix it. Further Reading =============== diff --git a/LLVM/cplusplus/tests/test9.kal b/LLVM/cplusplus/tests/test9.kal index bff294a3378fdac0a7de3292ce04c19d2d782490..6d8714d5eb4d4edc839299b48b26672b7d6ae4de 100644 --- a/LLVM/cplusplus/tests/test9.kal +++ b/LLVM/cplusplus/tests/test9.kal @@ -2,6 +2,6 @@ def fib(x) if x < 3 then 1 else - fib(x-1)+fib(x-2) + fib(x-1)+fib(x-2); fib(10)