Skip to content

Commit

Permalink
Merge pull request #379 from benquike/master
Browse files Browse the repository at this point in the history
Code improvement
  • Loading branch information
yuleisui authored Feb 28, 2021
2 parents 46ee4c6 + 30ce673 commit 5f5bf80
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 295 deletions.
33 changes: 24 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,38 @@ if(NOT COMMAND add_llvm_library)
endif()
if (DEFINED ENV{LLVM_DIR})
# We need to match the build environment for LLVM:
# In particular, we need C++11 and the -fno-rtti flag
# In particular, we need C++14 and the -fno-rtti flag
set(CMAKE_CXX_STANDARD 14)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++14 -g -O0 -fno-rtti -Wno-deprecated -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8")
else()
set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++14 -O3 -fno-rtti -Wno-deprecated -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8")
endif()
set(CMAKE_C_FLAGS "-fPIC")

find_package(LLVM REQUIRED CONFIG)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# add -std=gnu++14
set(CMAKE_CXX_EXTENSIONS ON)

set(COMMON_FLAGS "-fPIC -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} -fno-rtti")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")

if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif()

find_package(LLVM REQUIRED CONFIG)

list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)

add_definitions(${LLVM_DEFINITIONS})
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})

if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs bitwriter core ipo irreader instcombine instrumentation target linker analysis scalaropts support transformutils)
endif()

else()
message(FATAL_ERROR "\
WARNING: The LLVM_DIR var was not set (required for an out-of-source build)!\n\
Expand Down
6 changes: 5 additions & 1 deletion lib/CUDD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ set(SOURCES

add_llvm_library(Cudd ${SOURCES} LINK_LIBS m)

set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8")
add_compile_definitions(HAVE_IEEE_754)
add_compile_definitions(SIZEOF_VOID_P=8)
add_compile_definitions(SIZEOF_LONG=8)

set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast")

if(DEFINED IN_SOURCE_BUILD)
add_dependencies(Cudd intrinsics_gen)
Expand Down
22 changes: 0 additions & 22 deletions lib/CUDD/Makefile

This file was deleted.

24 changes: 0 additions & 24 deletions lib/MSSA/Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions lib/MTA/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Makefile

This file was deleted.

21 changes: 0 additions & 21 deletions lib/MemoryModel/Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions lib/SABER/Makefile

This file was deleted.

21 changes: 0 additions & 21 deletions lib/Util/Makefile

This file was deleted.

24 changes: 0 additions & 24 deletions lib/WPA/Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions tools/DDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD)
set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd)
add_llvm_tool( dvf dda.cpp )
else()
if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils)
endif()
add_executable( dvf dda.cpp )

target_link_libraries( dvf Svf Cudd ${llvm_libs} )
Expand Down
5 changes: 0 additions & 5 deletions tools/Example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD)
set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd)
add_llvm_tool( svf-ex svf-ex.cpp )
else()
if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils)
endif()
add_executable( svf-ex svf-ex.cpp )

target_link_libraries( svf-ex Svf Cudd ${llvm_libs} )
Expand Down
27 changes: 0 additions & 27 deletions tools/Example/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions tools/Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions tools/SABER/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD)
set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd)
add_llvm_tool( saber saber.cpp )
else()
if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils)
endif()
add_executable( saber saber.cpp )

target_link_libraries( saber Svf Cudd ${llvm_libs})
Expand Down
27 changes: 0 additions & 27 deletions tools/SABER/Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions tools/WPA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD)
set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd)
add_llvm_tool( wpa wpa.cpp )
else()
if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs bitwriter core ipo irreader instcombine instrumentation target linker analysis scalaropts support transformutils)
endif()
add_executable( wpa wpa.cpp )

target_link_libraries( wpa Svf Cudd ${llvm_libs} )
Expand Down
27 changes: 0 additions & 27 deletions tools/WPA/Makefile

This file was deleted.

0 comments on commit 5f5bf80

Please sign in to comment.