Commit 298b7f24 authored by Lukasz Wesierski's avatar Lukasz Wesierski Committed by gbsbuild

Fix visitTerminatorInst and IGC::WIAnalysis for LLVM8.

Change-Id: Ib0973ea6f4f2ed263b0da86ad6872a3680aff467
parent f6d46946
......@@ -197,7 +197,8 @@ void WIAnalysis::print(raw_ostream & OS, const Module*) const
{
OS << " unknown " << *I;
}
if (IGCLLVM::TerminatorInst *TI = dyn_cast<IGCLLVM::TerminatorInst>(I)) {
if (I->isTerminator()) {
IGCLLVM::TerminatorInst *TI = dyn_cast<IGCLLVM::TerminatorInst>(I);
OS << " [";
for (unsigned i = 0, e = TI->getNumSuccessors(); i < e; ++i) {
BasicBlock *succ = TI->getSuccessor(i);
......@@ -591,7 +592,7 @@ void WIAnalysis::calculate_dep(const Value* val)
else if (const PHINode *Phi = dyn_cast<PHINode>(inst)) dep = calculate_dep(Phi);
else if (isa<ShuffleVectorInst>(inst)) dep = calculate_dep_simple(inst);
else if (isa<StoreInst>(inst)) dep = calculate_dep_simple(inst);
else if (const IGCLLVM::TerminatorInst *TI = dyn_cast<IGCLLVM::TerminatorInst>(inst)) dep = calculate_dep(TI);
else if (inst->isTerminator()) dep = calculate_dep_terminator(dyn_cast<IGCLLVM::TerminatorInst>(inst));
else if (const SelectInst *SI = dyn_cast<SelectInst>(inst)) dep = calculate_dep(SI);
else if (const AllocaInst *AI = dyn_cast<AllocaInst>(inst)) dep = calculate_dep(AI);
else if (const CastInst *CI = dyn_cast<CastInst>(inst)) dep = calculate_dep(CI);
......@@ -1133,7 +1134,7 @@ WIAnalysis::WIDependancy WIAnalysis::calculate_dep(const PHINode* inst)
return totalDep;
}
WIAnalysis::WIDependancy WIAnalysis::calculate_dep(const IGCLLVM::TerminatorInst* inst)
WIAnalysis::WIDependancy WIAnalysis::calculate_dep_terminator(const IGCLLVM::TerminatorInst* inst)
{
// Instruction has no return value
// Just need to know if this inst is uniform or not
......
......@@ -199,12 +199,13 @@ private:
WIDependancy calculate_dep(const llvm::CallInst* inst);
WIDependancy calculate_dep(const llvm::GetElementPtrInst* inst);
WIDependancy calculate_dep(const llvm::PHINode* inst);
WIDependancy calculate_dep(const IGCLLVM::TerminatorInst* inst);
WIDependancy calculate_dep(const llvm::SelectInst* inst);
WIDependancy calculate_dep(const llvm::AllocaInst* inst);
WIDependancy calculate_dep(const llvm::CastInst* inst);
WIDependancy calculate_dep(const llvm::VAArgInst* inst);
WIDependancy calculate_dep(const llvm::LoadInst* inst);
WIDependancy calculate_dep_terminator(const IGCLLVM::TerminatorInst* inst);
/*! \} */
/// @brief do the trivial checking WI-dep
......
......@@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "TypeLegalizer.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvm/IR/InstVisitor.h"
#include "llvmWrapper/IR/InstVisitor.h"
#include "common/LLVMWarningsPop.hpp"
namespace IGC {
......
......@@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "TypeLegalizer.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvm/IR/InstVisitor.h"
#include "llvmWrapper/IR/InstVisitor.h"
#include "common/LLVMWarningsPop.hpp"
namespace IGC {
......
......@@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "TypeLegalizer.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvm/IR/InstVisitor.h"
#include "llvmWrapper/IR/InstVisitor.h"
#include "common/LLVMWarningsPop.hpp"
namespace IGC {
......
......@@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "TypeLegalizer.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvm/IR/InstVisitor.h"
#include "llvmWrapper/IR/InstVisitor.h"
#include "common/LLVMWarningsPop.hpp"
namespace IGC {
......
......@@ -27,7 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "common/LLVMWarningsPush.hpp"
#include <llvm/Pass.h>
#include <llvm/IR/InstVisitor.h>
#include "llvmWrapper/IR/InstVisitor.h"
#include <llvm/IR/Instruction.h>
#include <llvmWrapper/IR/InstrTypes.h>
#include "common/LLVMWarningsPop.hpp"
......
......@@ -41,6 +41,7 @@ set(IGC_WrapperLLVM_HDR
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/IR/GlobalValue.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/IR/ValueHandle.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/IR/InstrTypes.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/IR/InstVisitor.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Support/ToolOutputFile.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Bitcode/BitcodeWriter.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/IPO.h"
......
/*===================== begin_copyright_notice ==================================
Copyright (c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
#ifndef IGCLLVM_IR_INSTVISITOR_H
#define IGCLLVM_IR_INSTVISITOR_H
#include <llvm/IR/InstVisitor.h>
#if LLVM_VERSION_MAJOR == 8
// Convert visitTerminatorInst delegate name (from llvm version < 7) to new signature visitTerminator
#define visitTerminatorInst(ARG) visitTerminator(##ARG##)
#endif
#endif
\ No newline at end of file
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