From ab596da3798c78619beca56fd65886c18b2017fc Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sat, 15 Sep 2018 12:56:08 +0200 Subject: [PATCH] Port Monicelli to LLVM 6.0 --- README.md | 2 +- cmake/FindLLVM.cmake | 2 +- src/codegen.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c976890..8907ac4 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ you will need to have installed. If this is not the case, the configuration script will warn you. Monicelli is developed with version 6.8, but any sufficiently recent release should do just fine. -You will also need to have LLVM development libraries installed, version 3.8. +You will also need to have LLVM development libraries installed, version 6.0. Other versions might or might not work. Finally, you will need CMake, version 3.0 or higher. diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake index 73e497d..118ced0 100644 --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -15,7 +15,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) -set(TARGET_LLVM_VERSION "3.8.0") +set(TARGET_LLVM_VERSION "6.0.0") if (NOT LLVM_VERSION STREQUAL ${TARGET_LLVM_VERSION}) message(WARNING "Expected LLVM ${TARGET_LLVM_VERSION}, found ${LLVM_VERSION}, build may fail.") diff --git a/src/codegen.cpp b/src/codegen.cpp index 2eba666..9809bea 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/Verifier.h" #include "llvm/Support/raw_os_ostream.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Scalar/GVN.h" #include @@ -165,7 +166,7 @@ llvm::Value* NestedScopes::lookup(const std::string& name) { void IRGenerator::declareBuiltins() { llvm::FunctionType* printf_type = llvm::TypeBuilder::get(context_); - auto no_alias = llvm::AttributeSet().addAttribute(context_, 1, llvm::Attribute::NoAlias); + auto no_alias = llvm::AttributeList().addAttribute(context_, 1, llvm::Attribute::NoAlias); module_->getOrInsertFunction("printf", printf_type, no_alias); module_->getOrInsertFunction("scanf", printf_type, no_alias);