diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3319633 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.mk +build diff --git a/src/CMakeConfig.mk.example b/src/CMakeConfig.mk.example new file mode 100644 index 0000000..f63c68e --- /dev/null +++ b/src/CMakeConfig.mk.example @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) + +set(LLVM_DIR "/home/user/code/llvm_38/llvm-bin/share/llvm/cmake/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..68c2452 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.0) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +include(CMakeConfig.mk) +find_package(LLVM REQUIRED CONFIG) + +list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") +include(AddLLVM) + +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + +add_definitions(${LLVM_DEFINITIONS}) +include_directories(${LLVM_INCLUDE_DIRS}) + +message(STATUS "Include dirs: ${LLVM_INCLUDE_DIRS}") + +add_subdirectory(RangeAnalysis) +add_subdirectory(vSSA) \ No newline at end of file diff --git a/src/RangeAnalysis/CMakeLists.txt b/src/RangeAnalysis/CMakeLists.txt index f3c2cc7..a2860e3 100644 --- a/src/RangeAnalysis/CMakeLists.txt +++ b/src/RangeAnalysis/CMakeLists.txt @@ -5,8 +5,4 @@ if(WIN32 OR CYGWIN) endif() add_llvm_loadable_module( RangeAnalysis - RangeAnalysis.cpp - - DEPENDS - intrinsics_gen - ) + RangeAnalysis.cpp) diff --git a/src/RangeAnalysis/RangeAnalysis.cpp b/src/RangeAnalysis/RangeAnalysis.cpp index 7ea6478..b84ffce 100644 --- a/src/RangeAnalysis/RangeAnalysis.cpp +++ b/src/RangeAnalysis/RangeAnalysis.cpp @@ -325,7 +325,7 @@ void InterProceduralRA::MatchParametersAndReturnValues( for (i = 0, argptr = F.arg_begin(), e = F.arg_end(); argptr != e; ++i, ++argptr) - Parameters[i].first = argptr; + Parameters[i].first = &*argptr; // Check if the function returns a supported value type. If not, no return // value matching is done diff --git a/src/vSSA/CMakeLists.txt b/src/vSSA/CMakeLists.txt new file mode 100644 index 0000000..2646f14 --- /dev/null +++ b/src/vSSA/CMakeLists.txt @@ -0,0 +1,8 @@ +# If we don't need RTTI or EH, there's no reason to export anything +# from the hello plugin. +if(WIN32 OR CYGWIN) + set(LLVM_LINK_COMPONENTS Core Support) +endif() + +add_llvm_loadable_module( vSSA + vSSA.cpp) \ No newline at end of file diff --git a/src/vSSA/vSSA.cpp b/src/vSSA/vSSA.cpp index 256689f..349e2c3 100755 --- a/src/vSSA/vSSA.cpp +++ b/src/vSSA/vSSA.cpp @@ -40,7 +40,7 @@ bool vSSA::runOnFunction(Function &F) { // Iterate over all Basic Blocks of the Function, calling the function that creates sigma functions, if needed for (Function::iterator Fit = F.begin(), Fend = F.end(); Fit != Fend; ++Fit) { - createSigmasIfNeeded(Fit); + createSigmasIfNeeded(&*Fit); } return true; }