source: trunk/lib_ir/CMakeLists.txt @ 3927

Last change on this file since 3927 was 3927, checked in by linmengl, 5 years ago

use a better ifh_1

File size: 2.7 KB
Line 
1cmake_minimum_required (VERSION 2.8)
2project (IR_Library)
3
4set(CXX_SSE_FLAGS "-msse2 -march=pentium4")
5# perf_flags for xmlwf perf script
6set(CXX_PERF_FLAGS "-DBUFFER_PROFILING -DPERF_SCRIPT")
7set(CMAKE_CXX_FLAGS "${CXX_SSE_FLAGS} -std=c++11 ")
8
9set(LLVM_OPT "opt-svn")
10set(LLVM_LLC "llc-svn")
11
12set(LLVM_SSE_FLAGS "-mattr=+sse,+sse2,-avx,-avx2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3")
13set(LLVM_LLC_FLAGS )#-x86-experimental-vector-shuffle-lowering)
14
15add_executable(test_s2p test_s2p.cpp s2p_optimized.o)
16add_executable(test_link test_link.cpp s2p_optimized.o)
17add_executable(test_pack test_pack.cpp s2p_optimized.o)
18
19include_directories("xmlwf/util" "xmlwf/lib")
20add_executable(xmlwf xmlwf/src/xmlwf.cpp s2p_optimized.o)
21
22add_executable(xmlwf_perf xmlwf/src/xmlwf.cpp s2p_optimized.o)
23set_target_properties(xmlwf_perf
24  PROPERTIES
25  COMPILE_FLAGS ${CXX_PERF_FLAGS}
26  )
27
28add_custom_target(asm_s2p
29  COMMAND ${LLVM_LLC} -O3 ${LLVM_SSE_FLAGS} s2p_optimized.bc
30  DEPENDS s2p_optimized.bc)
31
32# compile s2p.ll, and make sure test_s2p depends on it.
33add_custom_command(
34  OUTPUT  s2p_optimized.o s2p_optimized.bc
35  COMMAND ${LLVM_OPT} -O3 -std-compile-opts ${LLVM_SSE_FLAGS} ${PROJECT_SOURCE_DIR}/s2p.ll -o s2p_optimized.bc
36  COMMAND ${LLVM_LLC} -O3 ${LLVM_SSE_FLAGS} -filetype=obj s2p_optimized.bc
37  DEPENDS ${PROJECT_SOURCE_DIR}/s2p.ll)
38
39enable_testing()
40add_test(
41  NAME ctest_s2p
42  COMMAND python ${PROJECT_SOURCE_DIR}/test_s2p.py)
43add_test(
44  NAME ctest_link
45  COMMAND python ${PROJECT_SOURCE_DIR}/test_link.py)
46add_test(
47  NAME ctest_pack
48  COMMAND ./test_pack)
49add_test(
50  NAME ctest_xmlwf
51  COMMAND python ${PROJECT_SOURCE_DIR}/xmlwf/run_all.py)
52
53add_custom_target (check
54  COMMAND ${CMAKE_CTEST_COMMAND}
55  DEPENDS test_s2p test_link test_pack xmlwf)
56
57add_custom_target (perf_xmlwf
58  COMMAND python ${PROJECT_SOURCE_DIR}/xmlwf/perf_script.py
59  DEPENDS xmlwf_perf)
60
61
62# Try IR inline. Compile the whole xmlwf in IR and inline s2p into it.
63set(LLVM_LINK "llvm-link")
64set(LLVM_CLANG "/usr/local/bin/clang")
65# cxx_include should only be used for ir_inline approach.
66set(CXX_INCLUDE -I${PROJECT_SOURCE_DIR}/xmlwf/util -I${PROJECT_SOURCE_DIR}/xmlwf/lib)
67
68add_custom_target(xmlwf_ir_inline
69  COMMAND ${LLVM_LINK} ${PROJECT_SOURCE_DIR}/s2p.ll xmlwf.ll -o xmlwf_all.bc
70  COMMAND ${LLVM_OPT} -O3 -std-compile-opts -std-link-opts xmlwf_all.bc -o xmlwf_ir_inline.bc
71  COMMAND ${LLVM_LLC} -O3 ${LLVM_SSE_FLAGS} -filetype=obj xmlwf_ir_inline.bc
72  COMMAND ${CMAKE_CXX_COMPILER} xmlwf_ir_inline.o -o xmlwf_ir_inline
73  DEPENDS s2p.ll xmlwf.ll)
74
75add_custom_command(
76  OUTPUT xmlwf.ll
77  COMMAND ${LLVM_CLANG} -S -emit-llvm ${CXX_INCLUDE} ${PROJECT_SOURCE_DIR}/xmlwf/src/xmlwf.cpp ${CXX_PERF_FLAGS} -o xmlwf.ll
78  DEPENDS xmlwf/src/xmlwf.cpp)
79
Note: See TracBrowser for help on using the repository browser.