Commit 0de92930 authored by Ronald Charles Moore's avatar Ronald Charles Moore
Browse files

Brought LLVM code samples up to LLVM version 11.1.0


Signed-off-by: Ronald Charles Moore's avatarProf. Ronald Moore <ronald.moore@h-da.de>
parent 55794c3e
......@@ -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,
......
//===- 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
//
//===----------------------------------------------------------------------===//
//
......
......@@ -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
===============
......
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment