Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for LLVM 10 and 11 #434

Merged
merged 38 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c82d3a6
Initial support for LLVM 10.
elliottslaughter Apr 14, 2020
d9f79ee
Update LLVM download URLs.
elliottslaughter Jan 19, 2021
fa84421
Use full name for build.
elliottslaughter Jan 19, 2021
20a0f99
Attempt to fix Makefile.
elliottslaughter Jan 19, 2021
e445316
Attempt to fix a broken test.
elliottslaughter Jan 19, 2021
1253813
Change rest of prefetch tests.
elliottslaughter Jan 19, 2021
7c59b07
Fix prefetch tests to work on older LLVM.
elliottslaughter Jan 20, 2021
ac841ac
Fix typos.
elliottslaughter Jan 20, 2021
8d4ec45
Try out LLVM 11.
elliottslaughter Jan 20, 2021
7a3a4c0
Extra fixes for 11.
elliottslaughter Jan 20, 2021
2ed96e8
Fixes for 11.1.
elliottslaughter Jan 20, 2021
aa9d66b
StringRef now requires explicit conversion to std::string in LLVM 11.
elliottslaughter Jan 20, 2021
5918692
More fixes for LLVM 11.
elliottslaughter Jan 20, 2021
50b2988
Last set of changes for LLVM 11. Builds and fails same set of tests a…
elliottslaughter Jan 20, 2021
8f93a10
Update CI flow to test LLVM 11.
elliottslaughter Jan 20, 2021
c7eb7c9
Format.
elliottslaughter Jan 20, 2021
4e2c3a2
Fix macOS LLVM 11 links.
elliottslaughter Jan 20, 2021
de69e32
Try to set an appropriate lower bound on new code.
elliottslaughter Jan 20, 2021
42e1760
Fix syntax.
elliottslaughter Jan 20, 2021
2445385
Make number of build threads configurable.
elliottslaughter Jan 20, 2021
03cb8f5
Work around strerror issue.
elliottslaughter Jan 21, 2021
80cd270
Cleanup.
elliottslaughter Jan 21, 2021
5576a87
Disable expvec.t for now.
elliottslaughter Jan 21, 2021
4bb3bfc
Fix a macOS failure.
elliottslaughter Jan 21, 2021
bc7f18e
Fix another macOS error.
elliottslaughter Jan 21, 2021
5d0f7d7
Prune test set.
elliottslaughter Jan 21, 2021
bbb8ef7
Dynamic linking seems to be broken with LLVM 11.
elliottslaughter Jan 21, 2021
1881198
Bump to 10, should work.
elliottslaughter Jan 21, 2021
595b250
Revert "Bump to 10, should work."
elliottslaughter Jan 21, 2021
e618cb0
Disable macOS LLVM 10 test.
elliottslaughter Jan 21, 2021
313bc9d
Also disable LLVM 11 on macOS for now.
elliottslaughter Jan 21, 2021
98bd705
Fix a potential memory corruption.
elliottslaughter Jan 21, 2021
ea44410
Try turning LLVM 11 build back on for macOS.
elliottslaughter Jan 22, 2021
c25ec90
Switch to Github Actions based build of LLVM 11.
elliottslaughter Jan 22, 2021
927cfd3
Try to load the current macOS SDK version to hopefully avoid incompat…
elliottslaughter Jan 22, 2021
7829844
Revert "Try to load the current macOS SDK version to hopefully avoid …
elliottslaughter Jan 22, 2021
1acda11
Disable macOS LLVM 11 tests again.
elliottslaughter Jan 22, 2021
c0e17ec
Fix issue number.
elliottslaughter Jan 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
env:
CHECK_CLANG_FORMAT: 1
build:
name: Build
name: Build (os=${{ matrix.os }}, llvm=${{ matrix.llvm }}, cmake=${{ matrix.cmake }}, cuda=${{ matrix.cuda }}, static=${{ matrix.static }}, slib=${{ matrix.slib }}, lua=${{ matrix.lua }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-16.04', 'macos-10.15']
llvm: ['3.5', '3.8', '5.0', '6.0', '7', '8', '9']
llvm: ['3.5', '3.8', '5.0', '6.0', '7', '8', '9', '10', '11']
cmake: ['0', '1']
cuda: ['0', '1']
static: ['0', '1']
slib: ['0', '1']
lua: ['luajit', 'moonjit']
exclude:
# macOS: exclude LLVM 5.0, 8 make, 9 make, cuda/no-static/no-slib
# macOS: exclude LLVM 5.0, 8-11 make, cuda/no-static/no-slib
- os: 'macos-10.15'
llvm: '5.0'
- os: 'macos-10.15'
Expand All @@ -32,12 +32,23 @@ jobs:
- os: 'macos-10.15'
llvm: '9'
cmake: '0'
- os: 'macos-10.15'
llvm: '10'
cmake: '0'
- os: 'macos-10.15'
llvm: '11'
cmake: '0'
- os: 'macos-10.15'
cuda: '1'
- os: 'macos-10.15'
static: '0'
- os: 'macos-10.15'
slib: '0'
# FIXME: https://github.com/terralang/terra/issues/479
- os: 'macos-10.15'
llvm: '10'
- os: 'macos-10.15'
llvm: '11'

# CMake
- llvm: '3.5'
Expand All @@ -63,7 +74,7 @@ jobs:
- cmake: '0'
lua: 'moonjit'

# CUDA: only most recent LLVM
# CUDA: only LLVM 9
- llvm: '3.5'
cuda: '1'
- llvm: '3.8'
Expand All @@ -76,8 +87,12 @@ jobs:
cuda: '1'
- llvm: '8'
cuda: '1'
- llvm: '10'
cuda: '1'
- llvm: '11'
cuda: '1'

# no-static: only most recent LLVM
# no-static: only LLVM 9
- llvm: '3.5'
static: '0'
- llvm: '3.8'
Expand All @@ -90,8 +105,12 @@ jobs:
static: '0'
- llvm: '8'
static: '0'
- llvm: '10'
static: '0'
- llvm: '11'
static: '0'

# no-slib: only most recent LLVM
# no-slib: only LLVM 9
- llvm: '3.5'
slib: '0'
- llvm: '3.8'
Expand All @@ -104,8 +123,12 @@ jobs:
slib: '0'
- llvm: '8'
slib: '0'
- llvm: '10'
slib: '0'
- llvm: '11'
slib: '0'

# Moonjit: only most recent LLVM
# Moonjit: only LLVM 9
- llvm: '3.5'
lua: 'moonjit'
- llvm: '3.8'
Expand All @@ -118,6 +141,10 @@ jobs:
lua: 'moonjit'
- llvm: '8'
lua: 'moonjit'
- llvm: '10'
lua: 'moonjit'
- llvm: '11'
lua: 'moonjit'
steps:
- uses: actions/checkout@v1
- run: ./travis.sh
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ include(BuildDirs)
include(GetLuaJIT)
include(ExtractLLVM)

set(CMAKE_CXX_STANDARD 11)
if(LLVM_VERSION_MAJOR GREATER 9)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

enable_testing()
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ LLVM_VERSION=$(shell echo $(LLVM_VERSION_NUM) | $(SED_E) 's/^([0-9]+)\.([0-9]+).
LLVMVERGT4 := $(shell expr $(LLVM_VERSION) \>= 40)

FLAGS += -DLLVM_VERSION=$(LLVM_VERSION)
CPPFLAGS += -std=c++11

LLVM_NEEDS_CXX14="100 110 111"
ifneq (,$(findstring $(LLVM_VERSION),$(LLVM_NEEDS_CXX14)))
CPPFLAGS += -std=c++1y # GCC 5 does not support -std=c++14 flag
else
CPPFLAGS += -std=c++11
endif

ifneq ($(findstring $(UNAME), Linux FreeBSD),)
DYNFLAGS = -shared -fPIC
Expand All @@ -103,7 +108,7 @@ LLVM_LIBRARY_FLAGS += -lclangFrontend -lclangDriver \
-lclangAnalysis \
-lclangEdit -lclangAST -lclangLex -lclangBasic

CLANG_AST_MATCHERS = "80 90"
CLANG_AST_MATCHERS = "80 90 100 110 111"
ifneq (,$(findstring $(LLVM_VERSION),$(CLANG_AST_MATCHERS)))
LLVM_LIBRARY_FLAGS += -lclangASTMatchers
endif
Expand Down
8 changes: 6 additions & 2 deletions src/llvmheaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@
#include "llvmheaders_80.h"
#elif LLVM_VERSION == 90
#include "llvmheaders_90.h"
#elif LLVM_VERSION == 100
#include "llvmheaders_100.h"
#elif LLVM_VERSION >= 110 && LLVM_VERSION < 120
#include "llvmheaders_110.h"
#else
#error "unsupported LLVM version"
// for OSX code completion
#define LLVM_VERSION 90
#include "llvmheaders_90.h"
#define LLVM_VERSION 100
#include "llvmheaders_100.h"
#endif

#if LLVM_VERSION >= 34
Expand Down
37 changes: 37 additions & 0 deletions src/llvmheaders_100.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Mangler.h"
//#include "llvm/ExecutionEngine/ObjectImage.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Linker/Linker.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"

#include "llvm/Support/VirtualFileSystem.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Rewrite/Frontend/Rewriters.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Object/SymbolSize.h"

#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Support/Error.h"

#define LLVM_PATH_TYPE std::string
#define RAW_FD_OSTREAM_NONE sys::fs::F_None
#define RAW_FD_OSTREAM_BINARY sys::fs::F_None
#define HASFNATTR(attr) \
getAttributes().hasAttribute(AttributeSet::FunctionIndex, Attribute ::attr)
#define ADDFNATTR(attr) addFnAttr(Attribute ::attr)
#define ATTRIBUTE Attributes
37 changes: 37 additions & 0 deletions src/llvmheaders_110.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Mangler.h"
//#include "llvm/ExecutionEngine/ObjectImage.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Linker/Linker.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"

#include "llvm/Support/VirtualFileSystem.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Rewrite/Frontend/Rewriters.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Object/SymbolSize.h"

#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Support/Error.h"

#define LLVM_PATH_TYPE std::string
#define RAW_FD_OSTREAM_NONE sys::fs::F_None
#define RAW_FD_OSTREAM_BINARY sys::fs::F_None
#define HASFNATTR(attr) \
getAttributes().hasAttribute(AttributeSet::FunctionIndex, Attribute ::attr)
#define ADDFNATTR(attr) addFnAttr(Attribute ::attr)
#define ATTRIBUTE Attributes
Loading