Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolize multiple LHS consts #807

Draft
wants to merge 165 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
63c8fc3
Generalization tool
manasij7479 Dec 1, 2020
b06aef9
Generalize constants
manasij7479 Dec 2, 2020
f589d86
Symbolize multiple LHS consts
manasij7479 Dec 2, 2020
8b3b409
temp commit
manasij7479 Jan 5, 2021
0b4d2a1
temp commit
manasij7479 Jan 7, 2021
25fe3f1
temp commit
manasij7479 Jan 8, 2021
8b3aea4
temp
manasij7479 Jan 13, 2021
ab9a314
doc: add link to arxiv paper (#811)
monperrus Apr 28, 2021
9342448
Misc fixes to make Souper work better with SPEC 2017 (#813)
manasij7479 Apr 28, 2021
30806dd
Keep up with alive2 API (#814)
manasij7479 May 2, 2021
1494a8b
update to llvm 12, update to latest Z3, fixup fragile tests (#815)
regehr May 2, 2021
02a10f2
Remove references to master (#816)
regehr May 2, 2021
7eabcbf
use llvm-mca as a cost model -- this implements that, but the work is…
regehr May 3, 2021
a1fb892
remove go stuff (#818)
regehr May 4, 2021
3a7aa1a
GCC compiled Souper failed to synthsize constants for some range synt…
zhengyang92 May 4, 2021
28c88d8
cleanup dockerfile (#820)
zhengyang92 May 5, 2021
08bd23c
Switch to using assume for encoding PCs (#822)
manasij7479 May 19, 2021
081d878
fix issue 821 (#823)
regehr May 19, 2021
e888ac1
Increase alive2 solver timeout to a minute (#826)
manasij7479 May 19, 2021
8220bdf
a few random cleanups (#825)
regehr May 19, 2021
1af2916
oops, didn't notice a problem caused by hiredis bump (#828)
regehr May 20, 2021
0bb88f2
Make constant shrinking optional, defaulting to false (#827)
manasij7479 May 20, 2021
ac139a2
new verison of patched LLVM 12 and Z3 (#829)
regehr May 25, 2021
73ca4ad
Mask out not-demanded bits for concrete interpreter (#830)
manasij7479 May 26, 2021
6cc0615
Generalization tool
manasij7479 Dec 1, 2020
a098f3c
temp
manasij7479 May 26, 2021
4b785db
foo
manasij7479 Sep 15, 2021
829ac75
foo
manasij7479 Sep 27, 2021
2beedf6
foo
manasij7479 Oct 22, 2021
ef23122
foo
manasij7479 Oct 26, 2021
1b216ff
foo
manasij7479 Oct 6, 2021
e41801e
foo
manasij7479 Nov 3, 2021
5fa37a1
foo
manasij7479 Nov 19, 2021
b5de911
foo
manasij7479 Dec 1, 2021
e3a37b4
foo
manasij7479 Dec 1, 2021
a3e247c
foo
manasij7479 Dec 2, 2021
4c0b098
foo
manasij7479 Dec 7, 2021
9545924
souper-combine pass template
manasij7479 Dec 4, 2020
a4341e2
foo
manasij7479 Dec 17, 2021
52a8550
foo
manasij7479 Dec 22, 2021
ea1ad8f
foo
manasij7479 Jan 10, 2022
3d92892
foo
manasij7479 Jan 12, 2022
b4461ec
foo
manasij7479 Jan 12, 2022
ae03d16
foo
manasij7479 Jun 8, 2022
d7e63c8
foo
manasij7479 Jan 17, 2022
b4e4ce4
foo
manasij7479 Feb 14, 2022
44889b0
foo
manasij7479 Feb 17, 2022
a77319c
foo
manasij7479 Feb 19, 2022
7f9d726
foo
manasij7479 Feb 22, 2022
aa52e36
foo
manasij7479 Feb 23, 2022
3cbb0d6
foo
manasij7479 Feb 23, 2022
3eba869
foo
manasij7479 Feb 25, 2022
0e6cfe7
foo
manasij7479 Feb 25, 2022
3d6c39d
foo
manasij7479 Mar 15, 2022
6a014f7
foo
manasij7479 Mar 24, 2022
bd586e1
foo
manasij7479 Mar 24, 2022
610e23b
foo
manasij7479 Apr 5, 2022
344d87d
foo
manasij7479 Apr 5, 2022
16f1bdb
Fix improveMustDemandedBits
manasij7479 May 10, 2020
d677ba9
foo
manasij7479 Apr 6, 2022
c3ffe7e
foo
manasij7479 Apr 6, 2022
ad0edad
foo
manasij7479 Apr 19, 2022
c418740
foo
manasij7479 Apr 22, 2022
31d1f79
Fix faulty clone
manasij7479 May 9, 2022
8867113
foo
manasij7479 Jun 8, 2022
6235802
foo
manasij7479 Jun 9, 2022
ef65740
foo
manasij7479 Jun 23, 2022
a9e4d2c
foo
manasij7479 Jun 23, 2022
87ee113
foo
manasij7479 Jun 28, 2022
469546f
foo
manasij7479 Jun 28, 2022
44ef0bb
foo
manasij7479 Jun 29, 2022
bfc06fd
foo
manasij7479 Jun 30, 2022
e05249e
foo
manasij7479 Jun 30, 2022
567d7e7
foo
manasij7479 Jul 7, 2022
5cae24b
foo
manasij7479 Jul 20, 2022
3240b52
foo
manasij7479 Jul 21, 2022
9a9d968
foo
manasij7479 Jul 28, 2022
24ff6d9
foo
manasij7479 Jul 28, 2022
45b50af
foo
manasij7479 Jul 30, 2022
1b79eaa
foo
manasij7479 Jul 30, 2022
2abddb9
foo
manasij7479 Aug 2, 2022
fd6705b
foo
manasij7479 Aug 2, 2022
f34f0cf
foo
manasij7479 Aug 4, 2022
bbcae4d
foo
manasij7479 Aug 4, 2022
18d2f50
foo
manasij7479 Sep 7, 2022
5cd7682
foo
manasij7479 Sep 8, 2022
7a3c8a6
foo
manasij7479 Sep 13, 2022
4ca8672
foo
manasij7479 Sep 21, 2022
31a6cf9
foo
manasij7479 Sep 21, 2022
e3643dc
foo
manasij7479 Oct 21, 2022
fb9ee5a
foo
manasij7479 Oct 21, 2022
cede61d
foo
manasij7479 Oct 22, 2022
73cbeaf
foo
manasij7479 Oct 22, 2022
2d2f64f
foo
manasij7479 Oct 22, 2022
1cd3900
foo
manasij7479 Oct 22, 2022
37f5d27
foo
manasij7479 Oct 23, 2022
fe69f41
foo
manasij7479 Oct 23, 2022
af0b467
foo
manasij7479 Oct 24, 2022
e17e17a
foo
manasij7479 Oct 25, 2022
73a67f9
foo
manasij7479 Oct 25, 2022
51ef4fd
foo
manasij7479 Oct 25, 2022
0efd8c6
foo
manasij7479 Oct 26, 2022
0d45d56
foo
manasij7479 Oct 26, 2022
11b616f
foo
manasij7479 Oct 26, 2022
1930c3b
foo
manasij7479 Oct 26, 2022
e74d1bf
foo
manasij7479 Oct 26, 2022
c16f329
foo
manasij7479 Oct 26, 2022
41582bb
foo
manasij7479 Oct 26, 2022
7759e2a
foo
manasij7479 Oct 29, 2022
77fb1de
foo
manasij7479 Oct 29, 2022
de6f256
foo
manasij7479 Oct 30, 2022
a92a8b7
foo
manasij7479 Nov 1, 2022
24d3c11
foo
manasij7479 Nov 1, 2022
4cd1609
foo
manasij7479 Nov 1, 2022
98cf7bd
foo
manasij7479 Nov 1, 2022
40e0182
foo
manasij7479 Nov 2, 2022
c1c6d56
foo
manasij7479 Nov 2, 2022
bccba9c
foo
manasij7479 Nov 4, 2022
b6fc1d4
foo
manasij7479 Nov 4, 2022
46ae8ff
foo
manasij7479 Nov 5, 2022
b2acfee
foo
manasij7479 Nov 5, 2022
e526624
foo
manasij7479 Nov 6, 2022
5da5ad9
foo
manasij7479 Nov 7, 2022
e692282
foo
manasij7479 Nov 8, 2022
da1903e
foo
manasij7479 Nov 9, 2022
651a9b0
Optimization harvesting
manasij7479 Jan 3, 2023
a5e0d57
better printing
manasij7479 Jan 4, 2023
b5c686b
More generalization
manasij7479 Jan 25, 2023
227cb3f
Remove redundant code
manasij7479 Jan 31, 2023
e864d58
Width Independence and more relations
manasij7479 Feb 16, 2023
4853b63
foo
manasij7479 Feb 16, 2023
b38b636
foo
manasij7479 Feb 17, 2023
bede2cb
foo
manasij7479 Feb 18, 2023
8693f1b
foo
manasij7479 Feb 19, 2023
13468f2
foo
manasij7479 Feb 21, 2023
af8c9c7
foo
manasij7479 Feb 21, 2023
794e425
foo
manasij7479 Feb 21, 2023
27dc108
foo
manasij7479 Feb 23, 2023
29d9d0c
foo
manasij7479 Mar 2, 2023
1e18cf3
foo
manasij7479 Mar 9, 2023
ec0f968
foo
manasij7479 Mar 9, 2023
cf5d258
foo
manasij7479 Mar 15, 2023
f45da2b
foo
manasij7479 Mar 16, 2023
c3c4b88
foo
manasij7479 Mar 17, 2023
2316ed5
foo
manasij7479 Mar 18, 2023
d0d19ee
foo
manasij7479 Mar 18, 2023
b440ccc
foo
manasij7479 Mar 20, 2023
d376a99
foo
manasij7479 Mar 21, 2023
10fa8fb
foo
manasij7479 Mar 22, 2023
6d30a9c
foo
manasij7479 Mar 22, 2023
b703146
foo
manasij7479 Apr 3, 2023
4ee7884
foo
manasij7479 Apr 3, 2023
c51ea71
foo
manasij7479 Apr 3, 2023
ed9f98f
foo
manasij7479 Apr 3, 2023
17a6e06
foo
manasij7479 Apr 4, 2023
09991ef
foo
manasij7479 Apr 4, 2023
af84b4a
Revert "foo"
manasij7479 Apr 4, 2023
7beb5ba
foo
manasij7479 Apr 4, 2023
db262b9
foo
manasij7479 Apr 5, 2023
94f86ac
foo
manasij7479 Apr 5, 2023
1cbfa05
foo
manasij7479 Apr 5, 2023
4d9d1c6
foo
manasij7479 Apr 9, 2023
84fe39a
foo
manasij7479 Apr 9, 2023
f1c31c9
foo
manasij7479 Apr 11, 2023
43daca7
Fix width jump
manasij7479 Apr 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 83 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif()
if (NOT LLVM_BUILD_TYPE)
set(LLVM_BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif()
set(LLVM_CONFIG_EXECUTABLE ${CMAKE_SOURCE_DIR}/third_party/llvm-${LLVM_BUILD_TYPE}-install/bin/llvm-config)
set(LLVM_CONFIG_EXECUTABLE ${CMAKE_SOURCE_DIR}/third_party/llvm-Release-install/bin/llvm-config)
if(NOT EXISTS ${LLVM_CONFIG_EXECUTABLE})
message(FATAL_ERROR "llvm-config could not be found!")
endif()
Expand All @@ -28,7 +28,7 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-exceptions -fno-rtti")
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-exceptions -fno-rtti -Wno-deprecated-enum-enum-conversion")

execute_process(
COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs
Expand Down Expand Up @@ -84,10 +84,10 @@ set(GTEST_CXXFLAGS "-DGTEST_HAS_RTTI=0")
set(GTEST_INCLUDEDIR "${LLVM_SRC}/utils/unittest/googletest/include")
set(GTEST_LIBS "-lgtest_main -lgtest")

set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -std=c++17")
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -std=c++20")

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++20")
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fvisibility-inlines-hidden")
set(PASS_LDFLAGS "-Wl,-undefined,dynamic_lookup")
endif()
Expand Down Expand Up @@ -129,11 +129,32 @@ find_library(HIREDIS_LIBRARY
third_party/hiredis-install/lib
NO_DEFAULT_PATH)

find_library(ALIVE_LIBRARY alive2 PATHS "${ALIVE_BUILDDIR}" NO_DEFAULT_PATH)
if (ALIVE_LIBRARY)
message(STATUS "Alive2: ${ALIVE_LIBRARY}")
find_library(ALIVE_IR ir PATHS "${ALIVE_BUILDDIR}" NO_DEFAULT_PATH)
if (ALIVE_IR)
message(STATUS "Alive2 IR")
else()
message(SEND_ERROR "Alive2 not found")
message(SEND_ERROR "Alive2 libir.a not found")
endif()

find_library(ALIVE_SMT smt PATHS "${ALIVE_BUILDDIR}" NO_DEFAULT_PATH)
if (ALIVE_SMT)
message(STATUS "Alive2 SMT")
else()
message(SEND_ERROR "Alive2 libsmt.a not found")
endif()

find_library(ALIVE_TOOLS tools PATHS "${ALIVE_BUILDDIR}" NO_DEFAULT_PATH)
if (ALIVE_TOOLS)
message(STATUS "Alive2 TOOLS")
else()
message(SEND_ERROR "Alive2 libtools.a not found")
endif()

find_library(ALIVE_UTIL util PATHS "${ALIVE_BUILDDIR}" NO_DEFAULT_PATH)
if (ALIVE_UTIL)
message(STATUS "Alive2 UTIL")
else()
message(SEND_ERROR "Alive2 libutil.a not found")
endif()

set(Z3 "${CMAKE_SOURCE_DIR}/third_party/z3-install/bin/z3")
Expand All @@ -147,6 +168,8 @@ else()
message(SEND_ERROR "Z3 shared lib not found")
endif()

set(ALIVE_LIBRARY ${ALIVE_IR} ${ALIVE_SMT} ${ALIVE_TOOLS} ${ALIVE_UTIL} ${Z3_LIBRARY})

set(SOUPER_CLANG_TOOL_FILES
lib/ClangTool/Actions.cpp
include/souper/ClangTool/Actions.h
Expand Down Expand Up @@ -195,12 +218,23 @@ set(SOUPER_INFER_FILES
include/souper/Infer/Interpreter.h
lib/Infer/Preconditions.cpp
include/souper/Infer/Preconditions.h
lib/Infer/SynthUtils.cpp
include/souper/Infer/SynthUtils.h
)

add_library(souperInfer STATIC
${SOUPER_INFER_FILES}
)

set(SOUPER_GENERALIZE_FILES
lib/Generalize/Reducer.cpp
include/souper/Generalize/Reducer.h
)

add_library(souperGeneralize STATIC
${SOUPER_GENERALIZE_FILES}
)

set(SOUPER_INST_FILES
lib/Inst/Inst.cpp
include/souper/Inst/Inst.h
Expand Down Expand Up @@ -239,19 +273,26 @@ add_library(souperTool STATIC
${SOUPER_TOOL_FILES}
)

set(SOUPER_CODEGEN_FILES
lib/Codegen/Codegen.cpp
lib/Codegen/MachineCost.cpp
include/souper/Codegen/Codegen.h
)

add_library(souperCodegen STATIC
${SOUPER_CODEGEN_FILES}
)

set(SOUPER_SOURCES
${SOUPER_EXTRACTOR_FILES}
${SOUPER_INST_FILES}
${SOUPER_KVSTORE_FILES}
${SOUPER_PARSER_FILES}
${SOUPER_SMTLIB2_FILES}
${SOUPER_TOOL_FILES}
${SOUPER_INFER_FILES})

set(SOUPER_CODEGEN_FILES
lib/Codegen/Codegen.cpp
include/souper/Codegen/Codegen.h
)
${SOUPER_INFER_FILES}
${SOUPER_GENERALIZE_FILES}
${SOUPER_CODEGEN_FILES})

add_library(souperPass SHARED
${KLEE_EXPR_FILES}
Expand All @@ -265,10 +306,6 @@ add_library(souperPassProfileAll SHARED
lib/Pass/Pass.cpp
)

add_library(souperCodegen SHARED
${SOUPER_CODEGEN_FILES}
)

target_compile_definitions(souperPassProfileAll PRIVATE DYNAMIC_PROFILE_ALL=1)

add_executable(clang-souper
Expand All @@ -295,6 +332,14 @@ add_executable(souper-check
tools/souper-check.cpp
)

add_executable(generalize
tools/generalize.cpp
)

add_executable(matcher-gen
tools/matcher-gen.cpp
)

add_executable(souper-interpret
tools/souper-interpret.cpp
)
Expand All @@ -319,6 +364,10 @@ add_executable(parser_tests
unittests/Parser/ParserTests.cpp
)

add_executable(codegen_tests
unittests/Codegen/CodegenTests.cpp
)

add_executable(interpreter_tests
unittests/Interpreter/InterpreterInfra.cpp
unittests/Interpreter/InterpreterTests.cpp)
Expand Down Expand Up @@ -362,8 +411,8 @@ configure_file(
)

foreach(target souper internal-solver-test lexer-test parser-test souper-check count-insts
souper2llvm souper-interpret
souperExtractor souperInfer souperInst souperKVStore souperParser
souper2llvm souper-interpret generalize matcher-gen
souperExtractor souperInfer souperGeneralize souperInst souperKVStore souperParser
souperSMTLIB2 souperTool souperPass souperPassProfileAll kleeExpr
souperCodegen)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${LLVM_CXXFLAGS}")
Expand All @@ -373,40 +422,45 @@ foreach(target souperClangTool clang-souper)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${CLANG_CXXFLAGS} ${LLVM_CXXFLAGS}")
target_include_directories(${target} PRIVATE "${LLVM_INCLUDEDIR}" ${CLANG_INCLUDEDIR})
endforeach()
foreach(target extractor_tests inst_tests parser_tests interpreter_tests bulk_tests)
foreach(target extractor_tests inst_tests parser_tests interpreter_tests bulk_tests codegen_tests)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${GTEST_CXXFLAGS} ${LLVM_CXXFLAGS}")
target_include_directories(${target} PRIVATE "${LLVM_INCLUDEDIR}" "${GTEST_INCLUDEDIR}")
endforeach()

# static
target_link_libraries(kleeExpr ${LLVM_LIBS} ${LLVM_LDFLAGS})
target_link_libraries(souperClangTool souperExtractor souperTool ${CLANG_LIBS} ${LLVM_LIBS} ${LLVM_LDFLAGS})
target_link_libraries(souperExtractor souperParser souperKVStore souperInfer souperInst kleeExpr)
target_link_libraries(souperExtractor souperParser souperKVStore souperInfer souperInst kleeExpr souperCodegen)
target_link_libraries(souperInfer souperExtractor ${LLVM_LIBS} ${LLVM_LDFLAGS} ${Z3_LIBRARY})
target_link_libraries(souperGeneralize souperInfer ${LLVM_LIBS} ${LLVM_LDFLAGS} ${Z3_LIBRARY})
target_link_libraries(souperInst ${LLVM_LIBS} ${LLVM_LDFLAGS})
target_link_libraries(souperKVStore ${HIREDIS_LIBRARY} ${LLVM_LIBS} ${LLVM_LDFLAGS})
target_link_libraries(souperParser souperInst ${LLVM_LIBS} ${LLVM_LDFLAGS} ${ALIVE_LIBRARY})
target_link_libraries(souperSMTLIB2 ${LLVM_LIBS} ${LLVM_LDFLAGS})
target_link_libraries(souperTool souperExtractor souperSMTLIB2)
target_link_libraries(souperCodegen ${LLVM_LIBS} ${LLVM_LDFLAGS})

# dynamic
target_link_libraries(souperCodegen ${PASS_LDFLAGS})
target_link_libraries(souperPass souperCodegen ${PASS_LDFLAGS} ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(souperPassProfileAll souperCodegen ${PASS_LDFLAGS} ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(souperPass ${PASS_LDFLAGS} ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(souperPassProfileAll ${PASS_LDFLAGS} ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})

# executables
target_link_libraries(souper souperExtractor souperKVStore souperParser souperSMTLIB2 souperTool kleeExpr ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(internal-solver-test souperSMTLIB2)
target_link_libraries(lexer-test souperParser)
target_link_libraries(parser-test souperParser)
target_link_libraries(souper-check souperTool souperExtractor souperKVStore souperSMTLIB2 souperParser ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(generalize souperTool souperExtractor souperKVStore souperSMTLIB2 souperParser souperInfer souperGeneralize ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(matcher-gen souperTool souperExtractor souperKVStore souperSMTLIB2 souperParser ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(souper-interpret souperTool souperExtractor souperKVStore souperSMTLIB2 souperParser ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(clang-souper souperClangTool souperExtractor souperKVStore souperParser souperSMTLIB2 souperTool kleeExpr ${CLANG_LIBS} ${LLVM_LIBS} ${LLVM_LDFLAGS} ${HIREDIS_LIBRARY} ${ALIVE_LIBRARY} ${Z3_LIBRARY})
target_link_libraries(count-insts souperParser)
target_link_libraries(souper2llvm souperParser souperCodegen)
target_link_libraries(extractor_tests souperExtractor souperParser ${GTEST_LIBS} ${ALIVE_LIBRARY})
target_link_libraries(inst_tests souperInfer souperPass souperInst souperExtractor ${GTEST_LIBS} ${ALIVE_LIBRARY})
target_link_libraries(parser_tests souperParser ${GTEST_LIBS} ${ALIVE_LIBRARY})
target_link_libraries(codegen_tests souperCodegen souperInst ${GTEST_LIBS} ${ALIVE_LIBRARY})
target_link_libraries(interpreter_tests souperInfer souperInst ${GTEST_LIBS} ${ALIVE_LIBRARY})
target_link_libraries(bulk_tests souperInfer souperInst ${GTEST_LIBS} ${ALIVE_LIBRARY} ${Z3_LIBRARY})

Expand Down Expand Up @@ -436,27 +490,12 @@ configure_file(

add_custom_target(check
COMMAND ${CMAKE_BINARY_DIR}/run_lit
DEPENDS extractor_tests inst_tests parser-test parser_tests profileRuntime souper souper-check souper-interpret souperPass souper2llvm souperPassProfileAll count-insts interpreter_tests bulk_tests
DEPENDS extractor_tests inst_tests parser-test parser_tests profileRuntime souper souper-check souper-interpret souperPass souper2llvm souperPassProfileAll count-insts interpreter_tests bulk_tests codegen_tests
USES_TERMINAL)

# we want assertions even in release mode!
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")

find_program(GO_EXECUTABLE NAMES go DOC "go executable")
if(NOT GO_EXECUTABLE STREQUAL "GO_EXECUTABLE-NOTFOUND")
add_executable(souperweb-backend
tools/souperweb-backend.cpp
)
set_target_properties(souperweb-backend
PROPERTIES COMPILE_FLAGS "${LLVM_CXXFLAGS}")
target_include_directories(souperweb-backend PRIVATE "${LLVM_INCLUDEDIR}")

target_link_libraries(souperweb-backend souperTool souperExtractor souperPass souperKVStore souperSMTLIB2 souperParser souperInst ${HIREDIS_LIBRARY})

add_custom_target(souperweb ALL COMMAND ${GO_EXECUTABLE} build -o ${CMAKE_BINARY_DIR}/souperweb ${CMAKE_SOURCE_DIR}/tools/souperweb.go
COMMENT "Building souperweb")
endif()

add_library(profileRuntime STATIC
runtime/souperPassProfile.c)

Expand All @@ -472,8 +511,10 @@ configure_file(${CMAKE_SOURCE_DIR}/utils/py_souper2llvm.in ${CMAKE_BINARY_DIR}/p
configure_file(${CMAKE_SOURCE_DIR}/include/souper/Tool/GetSolver.h.in ${CMAKE_BINARY_DIR}/include/souper/Tool/GetSolver.h @ONLY)

if (BUILD_CLANG_TOOL)
configure_file(${CMAKE_SOURCE_DIR}/utils/sclang.in ${CMAKE_BINARY_DIR}/sclang @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/utils/sclang.in ${CMAKE_BINARY_DIR}/sclang++ @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/utils/sclang.in ${CMAKE_BINARY_DIR}/sclang @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/utils/sclang.in ${CMAKE_BINARY_DIR}/sclang++ @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/utils/mclang.in ${CMAKE_BINARY_DIR}/mclang @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/utils/mclang.in ${CMAKE_BINARY_DIR}/mclang++ @ONLY)
endif()

add_subdirectory(docs)
65 changes: 26 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
from ubuntu:20.04

run set -x; \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
&& apt-get update -y -qq \
&& apt-get dist-upgrade -y -qq \
&& apt-get autoremove -y -qq \
&& apt-get remove -y -qq clang llvm llvm-runtime \
&& apt-get install libgmp10 \
&& echo 'ca-certificates valgrind libc6-dev libgmp-dev cmake ninja-build make autoconf automake libtool golang-go python subversion re2c git clang' > /usr/src/build-deps \
&& apt-get install -y $(cat /usr/src/build-deps) --no-install-recommends \
&& git clone https://github.com/antirez/redis /usr/src/redis

run export CC=clang CXX=clang++ \
&& cd /usr/src/redis \
&& git checkout 5.0.3 \
&& make -j10 \
&& make install

run export GOPATH=/usr/src/go \
&& go get github.com/gomodule/redigo/redis
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
&& apt-get update -y -qq \
&& apt-get dist-upgrade -y -qq \
&& apt-get autoremove -y -qq \
&& apt-get remove -y -qq clang llvm llvm-runtime \
&& apt-get install libgmp10 \
&& echo 'ca-certificates valgrind libc6-dev libgmp-dev cmake ninja-build make autoconf automake libtool python python3 subversion re2c git clang libstdc++-10-dev redis' > /usr/src/build-deps \
&& apt-get install -y $(cat /usr/src/build-deps) --no-install-recommends

add build_deps.sh /usr/src/souper/build_deps.sh
add clone_and_test.sh /usr/src/souper/clone_and_test.sh

run export CC=clang CXX=clang++ \
&& cd /usr/src/souper \
# && ./build_deps.sh Debug \
# && rm -r third_party/llvm-Debug-build \
&& ./build_deps.sh Release \
&& rm -r third_party/llvm-Release-build
&& cd /usr/src/souper \
# && ./build_deps.sh Debug \
# && rm -r third_party/llvm-Debug-build \
&& ./build_deps.sh Release \
&& rm -r third_party/llvm-Release-build


add CMakeLists.txt /usr/src/souper/CMakeLists.txt
Expand All @@ -41,19 +31,16 @@ add tools /usr/src/souper/tools
add utils /usr/src/souper/utils
add unittests /usr/src/souper/unittests

run export GOPATH=/usr/src/go \
&& export LD_LIBRARY_PATH=/usr/src/souper/third_party/z3-install/lib:$LD_LIBRARY_PATH \
&& mkdir -p /usr/src/souper-build \
&& cd /usr/src/souper-build \
&& CC=/usr/src/souper/third_party/llvm-Release-install/bin/clang CXX=/usr/src/souper/third_party/llvm-Release-install/bin/clang++ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DTEST_SYNTHESIS=ON ../souper \
&& ninja souperweb souperweb-backend \
&& ninja check \
&& cp souperweb souperweb-backend /usr/local/bin \
&& cd .. \
&& rm -rf /usr/src/souper-build \
&& strip /usr/local/bin/* \
&& groupadd -r souper \
&& useradd -m -r -g souper souper \
&& mkdir /data \
&& chown souper:souper /data \
&& rm -rf /usr/local/include /usr/local/lib/*.a /usr/local/lib/*.la
run export LD_LIBRARY_PATH=/usr/src/souper/third_party/z3-install/lib:$LD_LIBRARY_PATH \
&& mkdir -p /usr/src/souper-build \
&& cd /usr/src/souper-build \
&& CC=/usr/src/souper/third_party/llvm-Release-install/bin/clang CXX=/usr/src/souper/third_party/llvm-Release-install/bin/clang++ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DTEST_SYNTHESIS=ON ../souper \
&& ninja \
&& ninja check \
&& cd .. \
&& rm -rf /usr/src/souper-build \
&& groupadd -r souper \
&& useradd -m -r -g souper souper \
&& mkdir /data \
&& chown souper:souper /data \
&& rm -rf /usr/local/include /usr/local/lib/*.a /usr/local/lib/*.la
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Souper is a superoptimizer for LLVM IR. It uses an SMT solver to help identify
missing peephole optimizations in LLVM's midend optimizers.

The architecture and concepts of Souper are described in [Souper: A synthesizing superoptimizer](https://arxiv.org/pdf/1711.04422.pdf).

# Requirements

Souper should work on any reasonably modern Linux or OS X machine.
Expand All @@ -11,11 +13,6 @@ http://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain

You will also need CMake to build Souper and its dependencies.

If you have Go installed, you will also need the Redigo Redis client:
```
$ go get github.com/gomodule/redigo/redis
```

# Building Souper

1. Download and build dependencies:
Expand Down
Loading