Commit 80db6d64 authored by Dmitry Rogozhkin's avatar Dmitry Rogozhkin Committed by gbsbuild

llvm: allow builds against versions greater than 8

The standard practice is to allow builds against dependent packages
with versions >=X. Even if build will fail, we will be able to get
an early notification from those who tried and, hopefully, patches
to fix.

This is partial fix for #59.

Change-Id: I4bd9f8199923dc8e841c8568abdef64465cb616c
parent c6da4cb0
......@@ -6,9 +6,17 @@ set(IGC_BUILD__PROJ_LABEL__AdaptorOCL "AdaptorOCL")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
#include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ocl_igc_shared/executable_format")
set(ver ${LLVM_VERSION_MAJOR})
if(LLVM_VERSION_MAJOR VERSION_GREATER 7)
# We can reuse llvm8 specific files building against llvm>=8 till
# incompatibility will be identified and we will create another llvmX to
# customization handle that.
set(ver 8)
endif()
set(IGC_BUILD__SRC__AdaptorOCL
"${CMAKE_CURRENT_SOURCE_DIR}/Upgrader/llvm${LLVM_VERSION_MAJOR}/Upgrader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Upgrader/llvm${LLVM_VERSION_MAJOR}/BitcodeReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Upgrader/llvm${ver}/Upgrader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Upgrader/llvm${ver}/BitcodeReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/UnifyIROCL.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MoveStaticAllocas.cpp"
)
......
......@@ -8,7 +8,7 @@ elseif(LLVM_VERSION_MAJOR EQUAL 7)
add_subdirectory(7.0)
set(IGC_BUILD__SRC__Optimizer_IGCInstCombiner ${IGC_BUILD__SRC__IGCInstCombiner_7_0} PARENT_SCOPE)
set(IGC_BUILD__HDR__Optimizer_IGCInstCombiner ${IGC_BUILD__HDR__IGCInstCombiner_7_0} PARENT_SCOPE)
elseif(LLVM_VERSION_MAJOR EQUAL 8)
elseif(LLVM_VERSION_MAJOR VERSION_GREATER 7)
set(IGC_BUILD__SRC__Optimizer_IGCInstCombiner "" PARENT_SCOPE)
set(IGC_BUILD__HDR__Optimizer_IGCInstCombiner "" PARENT_SCOPE)
message("Use InstCombiner from LLVM")
......
......@@ -35,7 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace llvm {
class FunctionPass;
}
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
#include "llvm/Transforms/InstCombine/InstCombine.h"
#endif
......@@ -60,7 +60,7 @@ namespace IGC
llvm::FunctionPass* createIGCInstructionCombiningPass();
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
inline llvm::FunctionPass* createIGCInstructionCombiningPass()
{
return llvm::createInstructionCombiningPass(false);
......
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
set(ver ${LLVM_VERSION_MAJOR})
if(LLVM_VERSION_MAJOR VERSION_GREATER 7)
# We can reuse llvm8 specific files building against llvm>=8 till
# incompatibility will be identified and we will create another llvmX to
# customization handle that.
set(ver 8)
endif()
set(IGC_BUILD__SRC__DriverInterface
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/AddImplicitArgs.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/customApi.cpp"
......@@ -18,8 +26,8 @@ set(IGC_BUILD__SRC__DriverInterface
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/sp/gtpin_igc_ocl.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/util/BinaryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${LLVM_VERSION_MAJOR}/Upgrader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${LLVM_VERSION_MAJOR}/BitcodeReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${ver}/Upgrader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${ver}/BitcodeReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/UnifyIROCL.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/MoveStaticAllocas.cpp"
)
......@@ -83,7 +91,7 @@ set(IGC_BUILD__HDR__DriverInterface
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/sp/spp_g8.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/sp/gtpin_igc_ocl.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/util/BinaryStream.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${LLVM_VERSION_MAJOR}/Upgrader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/Upgrader/llvm${ver}/Upgrader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/MoveStaticAllocas.h"
"${IGC_BUILD__COMMON_COMPILER_DIR}/API/ErrorCode.h"
......
......@@ -33,7 +33,7 @@ namespace IGCLLVM
{
#if LLVM_VERSION_MAJOR <= 7
using llvm::InlineCost;
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
class InlineCost : public llvm::InlineCost
{
public:
......
......@@ -43,7 +43,7 @@ namespace IGCLLVM
return llvm::MemoryLocation::getForArgument(
#if LLVM_VERSION_MAJOR <= 7
llvm::ImmutableCallSite(I), ArgIdx, *TLI
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
llvm::cast<llvm::CallInst>(I), ArgIdx, TLI
#endif
);
......
......@@ -80,7 +80,7 @@ namespace IGCLLVM
#if LLVM_VERSION_MAJOR == 7
Scope, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
ScopeLine, Flags, isOptimized, TParams, Decl, ThrownTypes);
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
Scope, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, Flags,
llvm::DISubprogram::SPFlagDefinition, TParams, Decl, ThrownTypes);
#endif
......@@ -99,7 +99,7 @@ namespace IGCLLVM
#if LLVM_VERSION_MAJOR == 7
Scope, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
Virtuality, VTableIndex, ThisAdjustment, VTableHolder, Flags, isOptimized, TParams, ThrownTypes);
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
Scope, Name, LinkageName, File, LineNo, Ty, Virtuality, ThisAdjustment,
VTableHolder, Flags, llvm::DISubprogram::SPFlagDefinition, TParams, ThrownTypes);
#endif
......@@ -118,7 +118,7 @@ namespace IGCLLVM
#if LLVM_VERSION_MAJOR == 7
Scope, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
ScopeLine, Flags, isOptimized, TParams, Decl, ThrownTypes);
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
Scope, Name, LinkageName, File, LineNo, Ty, ScopeLine,
Flags, llvm::DISubprogram::SPFlagDefinition, TParams, Decl, ThrownTypes);
#endif
......
......@@ -28,7 +28,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define IGCLLVM_IR_INSTRTYPES_H
#include <llvm/IR/InstrTypes.h>
#if LLVM_VERSION_MAJOR == 8
#if LLVM_VERSION_MAJOR >= 8
#include <llvm/IR/PatternMatch.h>
#endif
......@@ -37,7 +37,7 @@ namespace IGCLLVM
#if LLVM_VERSION_MAJOR <= 7
using llvm::TerminatorInst;
using llvm::BinaryOperator;
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
using TerminatorInst = llvm::Instruction;
class BinaryOperator : public llvm::BinaryOperator
......
......@@ -41,7 +41,7 @@ namespace IGCLLVM
}
#elif LLVM_VERSION_MAJOR == 7
using llvm::createLoopUnrollPass;
#elif LLVM_VERSION_MAJOR == 8
#elif LLVM_VERSION_MAJOR >= 8
inline static llvm::Pass* createLoopUnrollPass(
int OptLevel = 2, int Threshold = -1, int Count = -1,
int AllowPartial = -1, int Runtime = -1,
......
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