diff --git a/IGC/WrapperLLVM/CMakeLists.txt b/IGC/WrapperLLVM/CMakeLists.txt index 8b8b7109b616..8cc1d334ef38 100644 --- a/IGC/WrapperLLVM/CMakeLists.txt +++ b/IGC/WrapperLLVM/CMakeLists.txt @@ -63,6 +63,7 @@ set(IGC_WrapperLLVM_HDR "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/InstSimplifyPass.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/BinaryFormat/Dwarf.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/MC/MCAsmBackend.h" + "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Analysis/CallGraph.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Analysis/InlineCost.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Analysis/MemoryLocation.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Analysis/TargetLibraryInfo.h" diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Analysis/CallGraph.h b/IGC/WrapperLLVM/include/llvmWrapper/Analysis/CallGraph.h new file mode 100644 index 000000000000..3c54d5aab13b --- /dev/null +++ b/IGC/WrapperLLVM/include/llvmWrapper/Analysis/CallGraph.h @@ -0,0 +1,51 @@ +/*===================== 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_CALL_GRAPH_H +#define IGCLLVM_CALL_GRAPH_H + +#include +#include + +namespace IGCLLVM +{ +#if LLVM_VERSION_MAJOR < 9 +using CallGraphNode = llvm::CallGraphNode; +#else + class CallGraphNode : public llvm::CallGraphNode + { + public: + inline void replaceCallEdge(llvm::CallSite CS, llvm::CallSite NewCS, llvm::CallGraphNode *NewNode) + { + llvm::CallGraphNode::replaceCallEdge(*llvm::cast(CS.getInstruction()), + *llvm::cast(NewCS.getInstruction()), + NewNode); + } + }; +#endif +} + +#endif