##############################################################
set (GBE_DEBUG_MEMORY false CACHE bool "Activate the memory debugger")
-set (GBE_COMPILE_UTESTS false CACHE bool "Will compile the unit tests")
set (GBE_USE_BLOB false CACHE bool "Compile everything from one big file")
##############################################################
set (GBE_DEBUG_MEMORY_FLAG "-DGBE_DEBUG_MEMORY=0")
endif (GBE_DEBUG_MEMORY)
-if (GBE_COMPILE_UTESTS)
- set (GBE_COMPILE_UTESTS_FLAG "-DGBE_COMPILE_UTESTS=1")
-else (GBE_COMPILE_UTESTS)
- set (GBE_COMPILE_UTESTS_FLAG "-DGBE_COMPILE_UTESTS=0")
-endif (GBE_COMPILE_UTESTS)
-
# Hide all symbols and allows the symbols declared as visible to be exported
-if (NOT GBE_COMPILE_UTESTS)
- set (CMAKE_C_CXX_FLAGS "-fvisibility=hidden")
-endif (NOT GBE_COMPILE_UTESTS)
+set (CMAKE_C_CXX_FLAGS "-fvisibility=hidden")
if (COMPILER STREQUAL "GCC")
set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -funroll-loops -Wstrict-aliasing=2 -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -ffast-math -fPIC -Wall")
endif (GBE_USE_BLOB)
-if (GBE_COMPILE_UTESTS)
- set (GBE_SRC
- ${GBE_SRC}
- utest/utest_vector.cpp
- utest/utest_llvm.cpp
- utest/utest_test_utest.cpp
- utest/utest_context.cpp
- utest/utest.cpp
- utest/utest.hpp)
-endif (GBE_COMPILE_UTESTS)
-
include_directories (.)
link_directories (${LLVM_LIBRARY_DIRS})
add_library (gbe SHARED ${GBE_SRC})
LLVMAsmParser
LLVMBitReader)
-if (GBE_COMPILE_UTESTS)
- set (TESTER_SRC utest/tester.cpp)
- add_executable (tester utest/tester.cpp)
- target_link_libraries (tester gbe)
-endif (GBE_COMPILE_UTESTS)
-
install (TARGETS gbe LIBRARY DESTINATION lib)
install (FILES backend/program.h backend/sim/simulator.h DESTINATION include/gen)
const uint32_t file = reg.nr & 0xf0;
const uint32_t nr = reg.nr & 0x0f;
if (file == GEN_ARF_FLAG) {
- GBE_ASSERT(nr < MAX_FLAG_REGISTER && (reg.subnr == 0 || reg.subnr == 1));
- return virtualNum + 2*nr + reg.subnr;
+ const uint32_t subnr = reg.subnr / sizeof(uint16_t);
+ GBE_ASSERT(nr < MAX_FLAG_REGISTER && (subnr == 0 || subnr == 1));
+ return virtualNum + 2*nr + subnr;
} else if (file == GEN_ARF_ACCUMULATOR) {
GBE_ASSERT(nr < MAX_ACC_REGISTER);
return virtualNum + MAX_FLAG_REGISTER + nr;