From 439ef31f94d5300fede1eb25a4730c8c819b246a Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Mon, 9 Dec 2019 18:46:43 +0100 Subject: [PATCH] Support LLVM 7, 8 and 9. Bump default required version to 7. Fixes #48. --- src/CMakeLists.txt | 2 +- src/asmgen.cpp | 2 +- src/codegen.cpp | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12b2104..24d0455 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright 2017 the Monicelli project authors. All rights reserved. # Use of this source code is governed by a GPLv3 license, see LICENSE.txt. -find_package(LLVM 6.0 REQUIRED CONFIG) +find_package(LLVM 7 REQUIRED CONFIG) find_package(Ragel REQUIRED) set(MONICELLI_LINKER ON CACHE BOOL "Enable the Monicelli linker. Requires POSIX.") diff --git a/src/asmgen.cpp b/src/asmgen.cpp index 7b69d2b..638381b 100644 --- a/src/asmgen.cpp +++ b/src/asmgen.cpp @@ -58,7 +58,7 @@ void writeAssembly(const std::string& to_filename, llvm::Module* module, llvm::legacy::PassManager asm_generator; auto file_type = llvm::TargetMachine::CGFT_ObjectFile; - if (target_machine->addPassesToEmitFile(asm_generator, output, file_type)) { + if (target_machine->addPassesToEmitFile(asm_generator, output, nullptr, file_type)) { std::cerr << "Cannot emit an object file of this type\n"; exit(1); } diff --git a/src/codegen.cpp b/src/codegen.cpp index dad75e6..61f4e20 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -17,8 +17,10 @@ #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/raw_os_ostream.h" +#include "llvm/Transforms/InstCombine/InstCombine.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar/GVN.h" +#include "llvm/Transforms/Utils.h" #include