1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2019-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 #ifndef IGCLLVM_IR_INSTRTYPES_H
10 #define IGCLLVM_IR_INSTRTYPES_H
11 
12 #include "llvm/Config/llvm-config.h"
13 #include "llvm/IR/InstrTypes.h"
14 #if LLVM_VERSION_MAJOR >= 8
15 #include "llvm/IR/PatternMatch.h"
16 #endif
17 
18 namespace IGCLLVM
19 {
20 #if LLVM_VERSION_MAJOR <= 7
21     using llvm::TerminatorInst;
22 #else
23     using TerminatorInst = llvm::Instruction;
24 #endif
25 
26     namespace BinaryOperator
27     {
isNot(const llvm::Value * V)28         inline bool isNot(const llvm::Value *V)
29         {
30 #if LLVM_VERSION_MAJOR <= 7
31             return llvm::BinaryOperator::isNot(V);
32 #else
33             return llvm::PatternMatch::match(V, llvm::PatternMatch::m_Not(llvm::PatternMatch::m_Value()));
34 #endif
35         }
36     }
37 }
38 
39 #endif
40