diff --git a/.gitignore b/.gitignore index 11756b408..5b4ef7ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ docs/_templates docs/_templates /.idea +.vscode /cmake-build-* diff --git a/.gitmodules b/.gitmodules index 9bf03225e..cfe20c527 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ path = deps/json url = https://github.com/nlohmann/json.git shallow = true +[submodule "deps/googletest"] + path = deps/googletest + url = https://github.com/google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aab7643e..26aa72a3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,6 @@ if(NOT TARGET ql) # Loads up the appropriate directories for installing stuff. include(GNUInstallDirs) - #=============================================================================# # Configuration options # #=============================================================================# @@ -22,7 +21,7 @@ include(GNUInstallDirs) # shared objects that get built and installed and are then depended on by the # Python lib get deleted by pip after the install. option( - BUILD_SHARED_LIBS + BUILD_SHARED_LIBS # FIXME: won't work anymore "Whether libraries should be built as a shared object or as a static library" ON ) @@ -172,6 +171,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Windows weirdness: need a .lib file to link against a DLL at compile-time # (I think), but only the .dll is generated when there are no exported symbols. @@ -186,23 +186,20 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Simple program that generates resource include files, to include the contents # of a file as a constant inside the OpenQL library. add_executable(resource src/resource/main.cpp) -function(create_resource fname) - set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${fname}") - get_filename_component(outdir "${CMAKE_CURRENT_BINARY_DIR}/${fname}" DIRECTORY) - get_filename_component(outname "${CMAKE_CURRENT_BINARY_DIR}/${fname}" NAME_WE) - set(outfile "${outdir}/${outname}.inc") +function(create_resource target_name infile outfile) + set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") + get_filename_component(outname "${outfile}" NAME_WE) + get_filename_component(outdir "${outfile}" DIRECTORY) add_custom_command( OUTPUT "${outfile}" COMMAND "${CMAKE_COMMAND}" -E make_directory "${outdir}" COMMAND resource "${infile}" "${outdir}" "${outname}" DEPENDS "${infile}" resource ) - string(REGEX REPLACE "[\\./\\]" "_" target_name "${fname}") add_custom_target( ${target_name} DEPENDS "${outfile}" ) - add_dependencies(ql ${target_name}) endfunction() # Add tree-gen. We need to do this *only* to get access to the generate_tree @@ -210,210 +207,97 @@ endfunction() # transitive dependency of libqasm. add_subdirectory(deps/libqasm/src/cqasm/tree-gen deps/tree-gen) +# Stack trace helper library, nothing functional here. +add_subdirectory(deps/backward-cpp) + +# Include the tests directory if requested. +if(OPENQL_BUILD_TESTS) + enable_testing() + + add_subdirectory(deps/googletest) + + # Convenience functions to add a test. + function(add_openql_unit_test name source) + add_executable("${name}" "${CMAKE_CURRENT_SOURCE_DIR}/${source}") + add_test( + NAME "${name}" + COMMAND "${name}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) + endfunction() + + function(add_openql_test name source) + add_openql_unit_test("${name}" "${source}") + target_link_libraries("${name}" PUBLIC ql) + endfunction() + + # Include the directories containing integration tests. + add_subdirectory(tests) + add_subdirectory(examples) +endif() + +add_subdirectory(src) + +add_library(ql_bare "src/openql.cc") +target_include_directories(ql_bare PUBLIC src/include) +target_link_libraries(ql_bare PUBLIC api) + +add_library(ql INTERFACE) +target_link_libraries(ql INTERFACE ql_bare all_architectures all_passes com_cfg com_sch) + #=============================================================================# -# OpenQL library target # +# Testing # #=============================================================================# -# Build the IR tree using tree-gen. -generate_tree( - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/ir.tree" - "${CMAKE_CURRENT_BINARY_DIR}/include/ql/ir/ir.gen.h" - "${CMAKE_CURRENT_BINARY_DIR}/src/ql/ir/ir.gen.cc" -) +#=============================================================================# +# OpenQL library target # +#=============================================================================# # Create the OpenQL library. This will be built either as a shared object/DLL # or as a static library based on BUILD_SHARED_LIBS; add_library switches # automatically. -add_library(ql - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/num.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/str.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/rangemap.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/exception.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/logger.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/filesystem.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/json.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/tree.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/vcd.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/options.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/utils/progress.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/platform.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/gate.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/classical.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/bundle.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/kernel.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/program.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/cqasm_reader.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/compat/detail/cqasm_reader.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/prim.cc" - "${CMAKE_CURRENT_BINARY_DIR}/src/ql/ir/ir.gen.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/ops.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/operator_info.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/describe.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/consistency.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/old_to_new.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/new_to_old.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/cqasm/read.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/ir/cqasm/write.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/options.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/topology.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ana/metrics.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ana/interaction_matrix.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ddg/types.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ddg/build.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ddg/ops.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ddg/consistency.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/ddg/dot.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/cfg/build.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/cfg/ops.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/cfg/consistency.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/cfg/dot.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/sch/heuristics.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/sch/scheduler.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/map/expression_mapper.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/map/qubit_mapping.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/dec/unitary.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/dec/rules.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/com/dec/structure.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/rmgr/resource_types/base.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/rmgr/types.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/rmgr/factory.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/rmgr/state.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/rmgr/manager.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/resource/qubit.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/resource/instrument.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/resource/inter_core_channel.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/pass_types/base.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/pass_types/specializations.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/condition.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/group.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/factory.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pmgr/manager.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/statistics/annotations.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/statistics/report.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/statistics/clean.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/types.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/common.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/image.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/circuit.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/interaction.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/detail/mapping.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/circuit.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/interaction.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/ana/visualize/mapping.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/io/cqasm/read.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/io/cqasm/report.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/dec/instructions/instructions.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/dec/generalize/generalize.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/dec/specialize/specialize.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/dec/structure/structure.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/opt/clifford/detail/clifford.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/opt/clifford/optimize.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/opt/const_prop/detail/propagate.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/opt/const_prop/const_prop.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/opt/dead_code_elim/dead_code_elim.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/sch/schedule/detail/scheduler.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/sch/schedule/schedule.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/sch/list_schedule/list_schedule.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/place_mip/detail/algorithm.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/place_mip/place_mip.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/options.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/free_cycle.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/past.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/alter.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/future.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/detail/mapper.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/pass/map/qubits/map/map.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/info_base.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/architecture.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/factory.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/info.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc/pass/gen/vq1asm/vq1asm.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/cc_light/info.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/none/info.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/diamond/info.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/diamond/pass/gen/microcode/microcode.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/arch/diamond/pass/gen/microcode/detail/functions.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/misc.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/pass.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/compiler.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/platform.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/creg.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/operation.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/unitary.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/kernel.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/program.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/api/cqasm_reader.cc" -) - -# Specify resources. -create_resource("src/ql/arch/cc/resources/hwconf_default.json") -create_resource("src/ql/arch/cc_light/resources/hwconf_default.json") -create_resource("src/ql/arch/cc_light/resources/hwconf_s5.json") -create_resource("src/ql/arch/cc_light/resources/hwconf_s7.json") -create_resource("src/ql/arch/cc_light/resources/hwconf_s17.json") -create_resource("src/ql/arch/none/resources/hwconf_default.json") -create_resource("src/ql/arch/diamond/resources/hwconf_default.json") - -# Generate a header file with configuration options that cannot be compiled -# (entirely) into the shared/static library due to use of templates. -set(QL_CHECKED_VEC ${OPENQL_CHECKED_VEC}) -set(QL_CHECKED_LIST ${OPENQL_CHECKED_LIST}) -set(QL_CHECKED_MAP ${OPENQL_CHECKED_MAP}) -set(QL_SHARED_LIB ${BUILD_SHARED_LIBS}) -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/config.h.template" - "${CMAKE_CURRENT_BINARY_DIR}/include/ql/config.h" -) # This definition is used to define OPENQL_DECLSPEC for __declspec. More info: # https://docs.microsoft.com/en-us/cpp/cpp/declspec?view=vs-2019 -target_compile_definitions(ql PRIVATE BUILDING_OPENQL) +target_compile_definitions(ql INTERFACE BUILDING_OPENQL) # There is no distinction between public and private header files right now, # and they'r all in the source directory. Note the / at the end of the path; # this is necessary for the header files to be installed in the right location. -target_include_directories(ql - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/" - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/src/" - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/" - PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include/" -) - +#target_include_directories(ql +# PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/" +# PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/src/" +# PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/" +# PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include/" +#) +# # Configure compilation. set_property(TARGET ql PROPERTY POSITION_INDEPENDENT_CODE ON) if(CMAKE_COMPILER_IS_GNUCXX) - target_compile_options(ql PRIVATE -Wall -Wfatal-errors -ggdb) + target_compile_options(ql INTERFACE -Wall -Wfatal-errors -ggdb) elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - target_compile_options(ql PRIVATE -Wall -Wfatal-errors -ggdb -Wno-unused-local-typedef) + target_compile_options(ql INTERFACE -Wall -Wfatal-errors -ggdb -Wno-unused-local-typedef) elseif(MSVC) - target_compile_options(ql PRIVATE /MP /D_USE_MATH_DEFINES /EHsc /bigobj) + target_compile_options(ql INTERFACE /MP /D_USE_MATH_DEFINES /EHsc /bigobj) else() message(SEND_ERROR "Unknown compiler!") endif() # Enable optimizations only for release builds. if(NOT MSVC AND "${CMAKE_BUILD_TYPE}" STREQUAL "Release") - target_compile_options(ql PRIVATE -O3) + target_compile_options(ql INTERFACE -O3) endif() # Use a mock version of unitary.cc if WITH_UNITARY_DECOMPOSITION is false. # This speeds up the build, but of course breaks unitary decomposition. if(NOT WITH_UNITARY_DECOMPOSITION) - target_compile_definitions(ql PRIVATE WITHOUT_UNITARY_DECOMPOSITION) + target_compile_definitions(ql INTERFACE WITHOUT_UNITARY_DECOMPOSITION) endif() # Enable GPL-based initial placement code if requested. if(WITH_INITIAL_PLACEMENT) - target_compile_definitions(ql PRIVATE INITIALPLACE) + target_compile_definitions(ql INTERFACE INITIALPLACE) endif() @@ -424,8 +308,8 @@ endif() # pthreads -------------------------------------------------------------------- # Look for thread support library (pthreads) -find_package(Threads REQUIRED) -target_link_libraries(ql PUBLIC ${CMAKE_THREAD_LIBS_INIT}) +# find_package(Threads REQUIRED) +# target_link_libraries(ql PUBLIC ${CMAKE_THREAD_LIBS_INIT}) # LEMON ----------------------------------------------------------------------- @@ -437,7 +321,6 @@ target_include_directories(lemon INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/deps/lemon" "${CMAKE_CURRENT_BINARY_DIR}/deps/lemon" ) -target_link_libraries(ql PUBLIC lemon) # Initial places uses lemon's Mip; ensure that LEMON's configuration supports # it. Annoyingly, LEMON's build just silently removes it when it's missing the @@ -475,133 +358,18 @@ target_include_directories(eigen INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/deps/eigen/Eigen" "${CMAKE_CURRENT_SOURCE_DIR}/deps/eigen/unsupported" ) -target_link_libraries(ql PRIVATE eigen) # nlohmann::json -------------------------------------------------------------- set(JSON_BuildTests OFF CACHE INTERNAL "") add_subdirectory(deps/json) -target_link_libraries(ql PUBLIC nlohmann_json::nlohmann_json) # libqasm --------------------------------------------------------------------- # Load libqasm. libqasm's CMakeLists expose the "cqasm" target to link against. add_subdirectory(deps/libqasm) -target_link_libraries(ql PUBLIC cqasm) - - -# X11/CImg --------------------------------------------------------------------- - -# Only enable the visualizer if building on Windows or the X11 library is found when building on Linux or Mac. -if(WIN32) - set(QL_VISUALIZER yes) -else() - find_package(X11) - if(X11_FOUND) - set(QL_VISUALIZER yes) - message("X11 libraries: ${X11_LIBRARIES}") - target_link_libraries(ql PUBLIC ${X11_LIBRARIES}) - message("X11 include path: ${X11_INCLUDE_DIR}") - target_include_directories(ql PRIVATE "${X11_INCLUDE_DIR}") - else() - set(QL_VISUALIZER no) - endif() -endif() - -if(QL_VISUALIZER) - target_compile_definitions(ql PRIVATE WITH_VISUALIZER) - target_include_directories(ql PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/deps/cimg/include/") -endif() - -# backward-cpp ---------------------------------------------------------------- - -# Stack trace helper library, nothing functional here. -add_subdirectory(deps/backward-cpp) -add_backward(ql) - -# add_backward doesn't set INTERFACE_LINK_LIBRARIES, only LINK_LIBRARIES. That -# goes wrong when we're compiling statically, because said libraries are shared -# and need to be included in the final link. -set_property(TARGET ql APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${BACKWARD_LIBRARIES}) - - -#=============================================================================# -# Testing # -#=============================================================================# - -# Include the tests directory if requested. -if(OPENQL_BUILD_TESTS) - enable_testing() - - # Convenience function to add an integration test. - function(add_openql_test name source workdir) - add_executable("${name}" "${CMAKE_CURRENT_SOURCE_DIR}/${source}") - target_link_libraries("${name}" ql) - add_test( - NAME "${name}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${workdir}" - COMMAND "${name}" - ) - endfunction() - - # Include the directories containing integration tests. - add_subdirectory(tests) - add_subdirectory(examples) - - # Convenience function to add a unit test. - function(add_openql_unit_test source) - string(REPLACE "/" "_" name ${source}) - string(REPLACE "_tests_" "_" name ${name}) - string(REPLACE ".cc" "" name ${name}) - set(name test_${name}) - add_executable("${name}" "${CMAKE_CURRENT_SOURCE_DIR}/src/ql/${source}") - target_link_libraries("${name}" ql) - add_test( - NAME "${name}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests" - COMMAND "${name}" - ) - endfunction() - - # Register unit tests. - file( - GLOB_RECURSE unit_tests - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/ql - ${CMAKE_CURRENT_SOURCE_DIR}/src/ql/*/tests/*.cc - ) - foreach(unit_test ${unit_tests}) - add_openql_unit_test(${unit_test}) - endforeach() - - # I hate CMake. - file( - GLOB_RECURSE unit_tests - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/ql - ${CMAKE_CURRENT_SOURCE_DIR}/src/ql/*/*/tests/*.cc - ) - foreach(unit_test ${unit_tests}) - add_openql_unit_test(${unit_test}) - endforeach() - file( - GLOB_RECURSE unit_tests - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/ql - ${CMAKE_CURRENT_SOURCE_DIR}/src/ql/*/*/*/tests/*.cc - ) - foreach(unit_test ${unit_tests}) - add_openql_unit_test(${unit_test}) - endforeach() - file( - GLOB_RECURSE unit_tests - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/ql - ${CMAKE_CURRENT_SOURCE_DIR}/src/ql/*/*/*/*/tests/*.cc - ) - foreach(unit_test ${unit_tests}) - add_openql_unit_test(${unit_test}) - endforeach() - -endif() #=============================================================================# @@ -625,7 +393,7 @@ install( ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) install( - DIRECTORY "$" + DIRECTORY "$" # FIXME? DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" ) diff --git a/RELEASE.md b/RELEASE.md index 98eb16505..0832d8790 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,7 +10,7 @@ secrets are configured correctly. is to be released. For example, `release-0.0.1`, but the suffix doesn't matter. - - Change the version in `include/ql/version.h` (this is the only functional + - Change the version in `src/ql/include/ql/version.h` (this is the only functional place where the version is hardcoded) and change any other files where applicable (changelog, etc) and update `CHANGELOG.md` accordingly, then commit and make a PR for it. @@ -35,7 +35,7 @@ secrets are configured correctly. - If needed, also merge to `master`. - Draft a new release through the GitHub interface. Set the "tag version" - to the same version you put in `include/ql/version.h`, the title to + to the same version you put in `src/ql/include/ql/version.h`, the title to "Release `version`: `name`", and write release notes in the body. The release notes should include at least: diff --git a/deps/googletest b/deps/googletest new file mode 160000 index 000000000..0e0d9feef --- /dev/null +++ b/deps/googletest @@ -0,0 +1 @@ +Subproject commit 0e0d9feefab1b51aaab9dfd70132e93c0b6964e5 diff --git a/docs/conf.py b/docs/conf.py index 4a04526f2..8949a6068 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -129,14 +129,14 @@ def get_version(verbose=0): """ Extract version information from source code """ matcher = re.compile('[\t ]*#define[\t ]+OPENQL_VERSION_STRING[\t ]+"(.*)"') - with open(os.path.join('..', 'include', 'ql', 'version.h'), 'r') as f: + with open(os.path.join('..', 'src', 'ql', 'include', 'ql', 'version.h'), 'r') as f: for ln in f: m = matcher.match(ln) if m: version = m.group(1) break else: - raise Exception('failed to parse version string from include/ql/version.h') + raise Exception('failed to parse version string from src/ql/include/ql/version.h') return version diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d91eb6efd..3a0b449c8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -add_openql_test(multi_qubits_randomized_benchmarking multi_qubits_randomized_benchmarking.cc ../tests) -add_openql_test(randomized_benchmarking randomized_benchmarking.cc ../tests) -add_openql_test(rb_single rb_single.cc ../tests) -add_openql_test(simple simple.cc ../tests) +add_openql_test(multi_qubits_randomized_benchmarking multi_qubits_randomized_benchmarking.cc) +add_openql_test(randomized_benchmarking randomized_benchmarking.cc) +add_openql_test(rb_single rb_single.cc) +add_openql_test(simple simple.cc) diff --git a/examples/multi_qubits_randomized_benchmarking.cc b/examples/multi_qubits_randomized_benchmarking.cc index 330228faa..8d36119cc 100644 --- a/examples/multi_qubits_randomized_benchmarking.cc +++ b/examples/multi_qubits_randomized_benchmarking.cc @@ -8,7 +8,7 @@ #include -#include +#include "openql.h" // clifford inverse lookup table for grounded state const size_t inv_clifford_lut_gs[] = {0, 2, 1, 3, 8, 10, 6, 11, 4, 9, 5, 7, 12, 16, 23, 21, 13, 17, 18, 19, 20, 15, 22, 14}; diff --git a/examples/simple.cc b/examples/simple.cc index acb23ae58..31ce13378 100644 --- a/examples/simple.cc +++ b/examples/simple.cc @@ -1,5 +1,5 @@ #include -#include +#include "openql.h" int main(int argc, char **argv) { // create platform diff --git a/setup.py b/setup.py index c5b0d6334..bd91607c7 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ root_dir = os.getcwd() # root of the repository src_dir = root_dir + os.sep + 'src' # C++ source directory -inc_dir = root_dir + os.sep + 'include' # C++ include directory +inc_dir = root_dir + os.sep + 'src' + os.sep + 'ql' + os.sep + 'include' # C++ include directory pysrc_dir = root_dir + os.sep + 'python' # Python source files target_dir = root_dir + os.sep + 'pybuild' # python-specific build directory build_dir = target_dir + os.sep + 'build' # directory for setuptools to dump various files into diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..31ca24675 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(ql) \ No newline at end of file diff --git a/include/openql.h b/src/include/openql.h similarity index 100% rename from include/openql.h rename to src/include/openql.h diff --git a/include/openql_i.h b/src/include/openql_i.h similarity index 100% rename from include/openql_i.h rename to src/include/openql_i.h diff --git a/include/openql b/src/openql similarity index 100% rename from include/openql rename to src/openql diff --git a/src/openql.cc b/src/openql.cc new file mode 100644 index 000000000..f1b20f60a --- /dev/null +++ b/src/openql.cc @@ -0,0 +1 @@ +#include "openql.h" \ No newline at end of file diff --git a/src/ql/CMakeLists.txt b/src/ql/CMakeLists.txt new file mode 100644 index 000000000..542280685 --- /dev/null +++ b/src/ql/CMakeLists.txt @@ -0,0 +1,24 @@ +# Generate a header file with configuration options that cannot be compiled +# (entirely) into the shared/static library due to use of templates. +set(QL_CHECKED_VEC ${OPENQL_CHECKED_VEC}) +set(QL_CHECKED_LIST ${OPENQL_CHECKED_LIST}) +set(QL_CHECKED_MAP ${OPENQL_CHECKED_MAP}) +set(QL_SHARED_LIB ${BUILD_SHARED_LIBS}) +configure_file( + "include/ql/config.h.template" + "${CMAKE_CURRENT_BINARY_DIR}/include/ql/config.h" +) + +add_library(config INTERFACE) +target_include_directories(config INTERFACE "include") +target_include_directories(config INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/include/") + +add_subdirectory(api) +add_subdirectory(arch) +add_subdirectory(com) +add_subdirectory(ir) +add_subdirectory(pass) +add_subdirectory(pmgr) +add_subdirectory(resource) +add_subdirectory(rmgr) +add_subdirectory(utils) \ No newline at end of file diff --git a/src/ql/api/CMakeLists.txt b/src/ql/api/CMakeLists.txt new file mode 100644 index 000000000..3639178a4 --- /dev/null +++ b/src/ql/api/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(api + "misc.cc" + "pass.cc" + "compiler.cc" + "platform.cc" + "creg.cc" + "operation.cc" + "unitary.cc" + "kernel.cc" + "program.cc" + "cqasm_reader.cc" +) + +target_include_directories(api PUBLIC include) + +target_link_libraries(api PRIVATE config) +target_link_libraries(api PUBLIC ir_compat) +target_link_libraries(api PUBLIC pmgr) +target_link_libraries(api PUBLIC com_dec) +target_link_libraries(api PUBLIC arch_diamond_annotations) \ No newline at end of file diff --git a/include/ql/api/api.h b/src/ql/api/include/ql/api/api.h similarity index 100% rename from include/ql/api/api.h rename to src/ql/api/include/ql/api/api.h diff --git a/include/ql/api/compiler.h b/src/ql/api/include/ql/api/compiler.h similarity index 100% rename from include/ql/api/compiler.h rename to src/ql/api/include/ql/api/compiler.h diff --git a/include/ql/api/cqasm_reader.h b/src/ql/api/include/ql/api/cqasm_reader.h similarity index 100% rename from include/ql/api/cqasm_reader.h rename to src/ql/api/include/ql/api/cqasm_reader.h diff --git a/include/ql/api/creg.h b/src/ql/api/include/ql/api/creg.h similarity index 100% rename from include/ql/api/creg.h rename to src/ql/api/include/ql/api/creg.h diff --git a/include/ql/api/declarations.h b/src/ql/api/include/ql/api/declarations.h similarity index 100% rename from include/ql/api/declarations.h rename to src/ql/api/include/ql/api/declarations.h diff --git a/include/ql/api/kernel.h b/src/ql/api/include/ql/api/kernel.h similarity index 100% rename from include/ql/api/kernel.h rename to src/ql/api/include/ql/api/kernel.h diff --git a/include/ql/api/misc.h b/src/ql/api/include/ql/api/misc.h similarity index 100% rename from include/ql/api/misc.h rename to src/ql/api/include/ql/api/misc.h diff --git a/include/ql/api/operation.h b/src/ql/api/include/ql/api/operation.h similarity index 100% rename from include/ql/api/operation.h rename to src/ql/api/include/ql/api/operation.h diff --git a/include/ql/api/pass.h b/src/ql/api/include/ql/api/pass.h similarity index 100% rename from include/ql/api/pass.h rename to src/ql/api/include/ql/api/pass.h diff --git a/include/ql/api/platform.h b/src/ql/api/include/ql/api/platform.h similarity index 100% rename from include/ql/api/platform.h rename to src/ql/api/include/ql/api/platform.h diff --git a/include/ql/api/program.h b/src/ql/api/include/ql/api/program.h similarity index 100% rename from include/ql/api/program.h rename to src/ql/api/include/ql/api/program.h diff --git a/include/ql/api/unitary.h b/src/ql/api/include/ql/api/unitary.h similarity index 100% rename from include/ql/api/unitary.h rename to src/ql/api/include/ql/api/unitary.h diff --git a/src/ql/arch/CMakeLists.txt b/src/ql/arch/CMakeLists.txt new file mode 100644 index 000000000..c8861bcd5 --- /dev/null +++ b/src/ql/arch/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(all_architectures OBJECT) + +macro(add_arch_library name) + add_library("${name}" OBJECT "${ARGN}") + target_sources(all_architectures PUBLIC $) +endmacro() + +add_subdirectory(cc) +add_subdirectory(cc_light) +add_subdirectory(diamond) +add_subdirectory(none) + +add_library(arch + "info_base.cc" + "architecture.cc" + "factory.cc" +) + +target_include_directories(arch PUBLIC include) + +target_link_libraries(arch PUBLIC utils) +target_link_libraries(arch PRIVATE ir_compat) +target_link_libraries(arch PRIVATE pmgr) \ No newline at end of file diff --git a/src/ql/arch/architecture.cc b/src/ql/arch/architecture.cc index bf954f164..5e227b78c 100644 --- a/src/ql/arch/architecture.cc +++ b/src/ql/arch/architecture.cc @@ -4,6 +4,8 @@ */ #include "ql/arch/architecture.h" +#include "ql/pmgr/declarations.h" +#include "ql/ir/compat/platform.h" namespace ql { namespace arch { diff --git a/src/ql/arch/cc/CMakeLists.txt b/src/ql/arch/cc/CMakeLists.txt new file mode 100644 index 000000000..d48618f16 --- /dev/null +++ b/src/ql/arch/cc/CMakeLists.txt @@ -0,0 +1,23 @@ +add_arch_library(arch_cc + "info.cc" + "pass/gen/vq1asm/detail/backend.cc" + "pass/gen/vq1asm/detail/codegen.cc" + "pass/gen/vq1asm/detail/codesection.cc" + "pass/gen/vq1asm/detail/datapath.cc" + "pass/gen/vq1asm/detail/functions.cc" + "pass/gen/vq1asm/detail/operands.cc" + "pass/gen/vq1asm/detail/settings.cc" + "pass/gen/vq1asm/detail/vcd.cc" + "pass/gen/vq1asm/vq1asm.cc" +) + +create_resource(cc_hwconf_default "resources/hwconf_default.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/cc/resources/hwconf_default.inc") +add_dependencies(arch_cc cc_hwconf_default) + +target_include_directories(arch_cc PUBLIC include) +target_include_directories(arch_cc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") + +target_link_libraries(arch_cc PUBLIC utils) +target_link_libraries(arch_cc PUBLIC pmgr) +target_link_libraries(arch_cc PRIVATE ir) +target_link_libraries(arch_cc PUBLIC config) \ No newline at end of file diff --git a/include/ql/arch/cc/info.h b/src/ql/arch/cc/include/ql/arch/cc/info.h similarity index 97% rename from include/ql/arch/cc/info.h rename to src/ql/arch/cc/include/ql/arch/cc/info.h index 8e8b6b072..09a1ce824 100644 --- a/include/ql/arch/cc/info.h +++ b/src/ql/arch/cc/include/ql/arch/cc/info.h @@ -12,6 +12,7 @@ #include "ql/utils/json.h" #include "ql/pmgr/manager.h" #include "ql/arch/info_base.h" +#include "ql/arch/factory.h" namespace ql { namespace arch { @@ -22,7 +23,8 @@ namespace cc { */ class Info : public InfoBase { public: - + static bool is_architecture_registered; + /** * Writes the documentation for this architecture to the given output * stream. @@ -77,7 +79,6 @@ class Info : public InfoBase { * is considered a backend pass. */ void populate_backend_passes(pmgr::Manager &manager, const utils::Str &variant) const override; - }; } // namespace cc diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/backend.h similarity index 89% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/backend.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/backend.h index ac4745c28..12de01100 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/backend.h @@ -8,9 +8,9 @@ #pragma once -#include "types.h" -#include "options.h" -#include "codegen.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codegen.h" #include "ql/ir/ir.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h similarity index 91% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h index fb5a34bfb..6d8a62307 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h @@ -4,9 +4,9 @@ #pragma once -#include "types.h" -#include "options.h" -#include "settings.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/settings.h" namespace ql { namespace arch { diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h similarity index 94% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h index 4e25b0709..5bba24cf3 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codegen.h @@ -11,15 +11,15 @@ #include "ql/ir/ir.h" -#include "operands.h" -#include "types.h" -#include "options.h" -#include "bundle_info.h" -#include "codesection.h" -#include "functions.h" -#include "datapath.h" -#include "settings.h" -#include "vcd.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/operands.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codesection.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/functions.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/datapath.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/settings.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/vcd.h" namespace ql { namespace arch { diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h similarity index 95% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h index d81a9b2fa..a0f3a1a12 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/codesection.h @@ -2,8 +2,8 @@ #include "ql/ir/ir.h" -#include "types.h" -#include "operands.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/operands.h" // Constants // FIXME: move out of .h diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h similarity index 96% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h index 974fe412b..0e7002d86 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/datapath.h @@ -10,8 +10,8 @@ #include -#include "types.h" -#include "bundle_info.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/bundle_info.h" #include "ql/utils/logger.h" #include "ql/ir/compat/compat.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/functions.h similarity index 95% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/functions.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/functions.h index de39e3394..0b6b897a6 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/functions.h @@ -2,10 +2,10 @@ #include "ql/ir/ir.h" -#include "types.h" -#include "operands.h" -#include "datapath.h" -#include "codesection.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/operands.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/datapath.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codesection.h" namespace ql { namespace arch { diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/operands.h similarity index 98% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/operands.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/operands.h index cf07ff2be..a2ce29c36 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/operands.h @@ -7,7 +7,7 @@ #include "ql/ir/ir.h" -#include "types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" /** * Helper macro for QL_ICE() that throws when the given condition is not diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/options.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/options.h similarity index 93% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/options.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/options.h index 1bad034bc..65f275c3e 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/options.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/options.h @@ -8,7 +8,8 @@ #pragma once -#include "types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/config.h" // constants #define CC_BACKEND_VERSION_STRING "0.4.0" @@ -18,7 +19,7 @@ #define OPT_SUPPORT_STATIC_CODEWORDS 1 // support (currently: require) static codewords, instead of allocating them on demand #define OPT_STATIC_CODEWORDS_ARRAYS 1 // JSON field static_codeword_override is an array with one element per qubit parameter #define OPT_VECTOR_MODE 0 // 1=generate single code word for all output groups together (requires codewords allocated by backend) -#define OPT_CC_USER_FUNCTIONS 1 // 1=add support for some user functions (experimental) + // NOTE JvS: I added these to the documentation string for the backend pass, so // you can see these values at runtime. diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/settings.h similarity index 98% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/settings.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/settings.h index d4f8ea6a2..3477ab25c 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/settings.h @@ -8,8 +8,8 @@ #pragma once -#include "types.h" -#include "options.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" #include "ql/ir/compat/platform.h" // FIXME #include "ql/ir/ir.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/types.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/types.h similarity index 100% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/types.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/types.h diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h similarity index 92% rename from src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h index 1e2d130b6..600a3956d 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/detail/vcd.h @@ -10,8 +10,8 @@ #include "ql/utils/vcd.h" -#include "types.h" -#include "settings.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/types.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/settings.h" namespace ql { namespace arch { diff --git a/include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h similarity index 97% rename from include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h rename to src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h index 0b39b7803..8155ba210 100644 --- a/include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h +++ b/src/ql/arch/cc/include/ql/arch/cc/pass/gen/vq1asm/vq1asm.h @@ -18,6 +18,8 @@ namespace vq1asm { * QuTech Central Controller Q1 processor assembly generator pass. */ class GenerateVQ1AsmPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/arch/cc/info.cc b/src/ql/arch/cc/info.cc index db33eef4d..6e53c07ee 100644 --- a/src/ql/arch/cc/info.cc +++ b/src/ql/arch/cc/info.cc @@ -14,6 +14,8 @@ namespace ql { namespace arch { namespace cc { +bool Info::is_architecture_registered = Factory::register_architecture(); + // local constants const utils::Str predicateKeyInstructionType = "cc-desugar-instruction-type"; const utils::Str predicateValueMeas = "cc-desugar-meas"; @@ -655,7 +657,6 @@ void Info::post_process_platform( * is considered a backend pass. */ void Info::populate_backend_passes(pmgr::Manager &manager, const utils::Str &variant) const { - // Remove prescheduler if enabled implicitly (pointless since we add our own scheduling). // FIXME: bit of a hack, and invalidates https://openql.readthedocs.io/en/latest/gen/reference_architectures.html#default-pass-list utils::Str ps_name = "prescheduler"; diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.cc index edfee6896..936fcaabb 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/backend.cc @@ -5,8 +5,8 @@ * @brief backend for the Central Controller */ -#include "backend.h" -#include "operands.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/backend.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/operands.h" #include "ql/utils/str.h" #include "ql/utils/filesystem.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.cc index e46ed64ef..91f58b7ca 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/codegen.cc @@ -7,8 +7,8 @@ * functions is correct */ -#include "codegen.h" -#include "codesection.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codegen.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codesection.h" #include "ql/version.h" #include "ql/com/options.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.cc index d7f0069f5..fa942fce7 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/codesection.cc @@ -1,5 +1,5 @@ -#include "codesection.h" -#include "options.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codesection.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" #include "ql/version.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.cc index afd3c454b..e68840cfb 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/datapath.cc @@ -6,7 +6,7 @@ * @note */ -#include "datapath.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/datapath.h" #include diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.cc index 44db51a9f..c81241286 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/functions.cc @@ -1,5 +1,5 @@ -#include "functions.h" -#include "codegen.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/functions.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/codegen.h" #include "ql/ir/describe.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.cc index e67bfd019..1672a997f 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/operands.cc @@ -3,7 +3,7 @@ * FIXME: could be useful for other backends and should be moved if this becomes appropriate */ -#include "operands.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/operands.h" #include "ql/ir/ops.h" #include "ql/ir/describe.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.cc index f99f9ec6c..9ba3f73fe 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/settings.cc @@ -6,7 +6,7 @@ * @note */ -#include "settings.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/settings.h" namespace ql { namespace arch { diff --git a/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.cc b/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.cc index 924e8cf47..0c747930c 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/detail/vcd.cc @@ -6,7 +6,7 @@ * @note */ -#include "vcd.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/vcd.h" #include #include "ql/com/options.h" diff --git a/src/ql/arch/cc/pass/gen/vq1asm/vq1asm.cc b/src/ql/arch/cc/pass/gen/vq1asm/vq1asm.cc index e154b358e..a27b68dc6 100644 --- a/src/ql/arch/cc/pass/gen/vq1asm/vq1asm.cc +++ b/src/ql/arch/cc/pass/gen/vq1asm/vq1asm.cc @@ -5,7 +5,8 @@ #include "ql/arch/cc/pass/gen/vq1asm/vq1asm.h" #include "ql/pmgr/pass_types/base.h" -#include "detail/backend.h" +#include "ql/arch/cc/pass/gen/vq1asm/detail/backend.h" +#include "ql/pmgr/factory.h" namespace ql { namespace arch { @@ -14,6 +15,8 @@ namespace pass { namespace gen { namespace vq1asm { +bool GenerateVQ1AsmPass::is_pass_registered = pmgr::Factory::register_pass("arch.cc.gen.VQ1Asm"); + /** * Dumps docs for the code generator. */ diff --git a/src/ql/arch/cc_light/CMakeLists.txt b/src/ql/arch/cc_light/CMakeLists.txt new file mode 100644 index 000000000..32f858211 --- /dev/null +++ b/src/ql/arch/cc_light/CMakeLists.txt @@ -0,0 +1,19 @@ +add_arch_library(arch_cc_light + "info.cc" +) + +create_resource(cc_light_hwconf_default "resources/hwconf_default.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/cc_light/resources/hwconf_default.inc") +create_resource(cc_light_hwconf_s5 "resources/hwconf_s5.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/cc_light/resources/hwconf_s5.inc") +create_resource(cc_light_hwconf_s7 "resources/hwconf_s7.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/cc_light/resources/hwconf_s7.inc") +create_resource(cc_light_hwconf_s17 "resources/hwconf_s17.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/cc_light/resources/hwconf_s17.inc") +target_include_directories(arch_cc_light PUBLIC include) + +add_dependencies(arch_cc_light cc_light_hwconf_default) +add_dependencies(arch_cc_light cc_light_hwconf_s5) +add_dependencies(arch_cc_light cc_light_hwconf_s7) +add_dependencies(arch_cc_light cc_light_hwconf_s17) + +target_include_directories(arch_cc_light PUBLIC include) +target_include_directories(arch_cc_light PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") +target_link_libraries(arch_cc_light PUBLIC utils) +target_link_libraries(arch_cc_light PUBLIC pmgr) \ No newline at end of file diff --git a/include/ql/arch/cc_light/info.h b/src/ql/arch/cc_light/include/ql/arch/cc_light/info.h similarity index 98% rename from include/ql/arch/cc_light/info.h rename to src/ql/arch/cc_light/include/ql/arch/cc_light/info.h index 507804e8c..4e2d1bf6f 100644 --- a/include/ql/arch/cc_light/info.h +++ b/src/ql/arch/cc_light/include/ql/arch/cc_light/info.h @@ -22,6 +22,7 @@ namespace cc_light { */ class Info : public InfoBase { public: + static bool is_architecture_registered; /** * Writes the documentation for this architecture to the given output diff --git a/src/ql/arch/cc_light/info.cc b/src/ql/arch/cc_light/info.cc index d971fa6f6..fc6df4c8f 100644 --- a/src/ql/arch/cc_light/info.cc +++ b/src/ql/arch/cc_light/info.cc @@ -9,11 +9,14 @@ #include "ql/arch/cc_light/resources/hwconf_s5.inc" #include "ql/arch/cc_light/resources/hwconf_s7.inc" #include "ql/arch/cc_light/resources/hwconf_s17.inc" +#include "ql/arch/factory.h" namespace ql { namespace arch { namespace cc_light { +bool Info::is_architecture_registered = Factory::register_architecture(); + /** * Writes the documentation for this architecture to the given output * stream. diff --git a/src/ql/arch/diamond/CMakeLists.txt b/src/ql/arch/diamond/CMakeLists.txt new file mode 100644 index 000000000..b056ce5a0 --- /dev/null +++ b/src/ql/arch/diamond/CMakeLists.txt @@ -0,0 +1,19 @@ +add_subdirectory(pass/gen/microcode) + +add_arch_library(arch_diamond + "info.cc" +) + + +create_resource(diamond_hwconf_default "resources/hwconf_default.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/diamond/resources/hwconf_default.inc") +add_dependencies(arch_diamond diamond_hwconf_default) + +target_include_directories(arch_diamond PUBLIC "include") +target_include_directories(arch_diamond PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") + +target_link_libraries(arch_diamond PUBLIC utils) +target_link_libraries(arch_diamond PUBLIC pmgr) + +add_library(arch_diamond_annotations INTERFACE) # This is done to break a cyclic dependency between cmake targets +target_include_directories(arch_diamond_annotations INTERFACE "include") +target_link_libraries(arch_diamond_annotations INTERFACE utils) \ No newline at end of file diff --git a/include/ql/arch/diamond/annotations.h b/src/ql/arch/diamond/include/ql/arch/diamond/annotations.h similarity index 100% rename from include/ql/arch/diamond/annotations.h rename to src/ql/arch/diamond/include/ql/arch/diamond/annotations.h diff --git a/include/ql/arch/diamond/info.h b/src/ql/arch/diamond/include/ql/arch/diamond/info.h similarity index 98% rename from include/ql/arch/diamond/info.h rename to src/ql/arch/diamond/include/ql/arch/diamond/info.h index ad1256011..4c1735e2e 100644 --- a/include/ql/arch/diamond/info.h +++ b/src/ql/arch/diamond/include/ql/arch/diamond/info.h @@ -22,6 +22,7 @@ namespace diamond { */ class Info : public InfoBase { public: + static bool is_architecture_registered; /** * Writes the documentation for this architecture to the given output diff --git a/src/ql/arch/diamond/info.cc b/src/ql/arch/diamond/info.cc index 95b46ce5e..3fda43ff7 100644 --- a/src/ql/arch/diamond/info.cc +++ b/src/ql/arch/diamond/info.cc @@ -5,11 +5,14 @@ #include "ql/arch/diamond/info.h" #include "ql/arch/diamond/resources/hwconf_default.inc" +#include "ql/arch/factory.h" namespace ql { namespace arch { namespace diamond { +bool Info::is_architecture_registered = Factory::register_architecture(); + /** * Writes the documentation for this architecture to the given output * stream. diff --git a/src/ql/arch/diamond/pass/gen/microcode/CMakeLists.txt b/src/ql/arch/diamond/pass/gen/microcode/CMakeLists.txt new file mode 100644 index 000000000..fe236999d --- /dev/null +++ b/src/ql/arch/diamond/pass/gen/microcode/CMakeLists.txt @@ -0,0 +1,11 @@ +add_arch_library(arch_diamond_pass_gen + "microcode.cc" + "detail/functions.cc" +) + +target_include_directories(arch_diamond_pass_gen PUBLIC include) + +target_link_libraries(arch_diamond_pass_gen PUBLIC utils) +target_link_libraries(arch_diamond_pass_gen PUBLIC pmgr) +target_link_libraries(arch_diamond_pass_gen PUBLIC ir_compat) +target_link_libraries(arch_diamond_pass_gen PRIVATE com) \ No newline at end of file diff --git a/src/ql/arch/diamond/pass/gen/microcode/detail/functions.cc b/src/ql/arch/diamond/pass/gen/microcode/detail/functions.cc index be4a58871..3e5c8ae5f 100644 --- a/src/ql/arch/diamond/pass/gen/microcode/detail/functions.cc +++ b/src/ql/arch/diamond/pass/gen/microcode/detail/functions.cc @@ -2,8 +2,7 @@ #include "ql/utils/filesystem.h" #include "ql/ir/compat/platform.h" #include "ql/com/options.h" -#include "functions.h" - +#include "ql/arch/diamond/pass/gen/microcode/detail/functions.h" namespace ql { namespace arch { diff --git a/src/ql/arch/diamond/pass/gen/microcode/detail/functions.h b/src/ql/arch/diamond/pass/gen/microcode/include/ql/arch/diamond/pass/gen/microcode/detail/functions.h similarity index 100% rename from src/ql/arch/diamond/pass/gen/microcode/detail/functions.h rename to src/ql/arch/diamond/pass/gen/microcode/include/ql/arch/diamond/pass/gen/microcode/detail/functions.h diff --git a/include/ql/arch/diamond/pass/gen/microcode/microcode.h b/src/ql/arch/diamond/pass/gen/microcode/include/ql/arch/diamond/pass/gen/microcode/microcode.h similarity index 97% rename from include/ql/arch/diamond/pass/gen/microcode/microcode.h rename to src/ql/arch/diamond/pass/gen/microcode/include/ql/arch/diamond/pass/gen/microcode/microcode.h index 4dc32171d..c3c2de702 100644 --- a/include/ql/arch/diamond/pass/gen/microcode/microcode.h +++ b/src/ql/arch/diamond/pass/gen/microcode/include/ql/arch/diamond/pass/gen/microcode/microcode.h @@ -19,6 +19,8 @@ namespace microcode { * QuTech Central Controller Q1 processor assembly generator pass. */ class GenerateMicrocodePass : public pmgr::pass_types::ProgramTransformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/arch/diamond/pass/gen/microcode/microcode.cc b/src/ql/arch/diamond/pass/gen/microcode/microcode.cc index a736d6450..bc0ac9233 100644 --- a/src/ql/arch/diamond/pass/gen/microcode/microcode.cc +++ b/src/ql/arch/diamond/pass/gen/microcode/microcode.cc @@ -13,6 +13,7 @@ #include "ql/utils/filesystem.h" #include "ql/ir/compat/platform.h" #include "ql/com/options.h" +#include "ql/pmgr/factory.h" namespace ql { namespace arch { @@ -23,6 +24,8 @@ namespace microcode { using namespace utils; +bool GenerateMicrocodePass::is_pass_registered = pmgr::Factory::register_pass("arch.diamond.gen.Microcode"); + /** * Dumps docs for the code generator */ diff --git a/src/ql/arch/factory.cc b/src/ql/arch/factory.cc index fc4ff0e53..a07ebb42e 100644 --- a/src/ql/arch/factory.cc +++ b/src/ql/arch/factory.cc @@ -3,11 +3,7 @@ */ #include "ql/arch/factory.h" - -#include "ql/arch/cc/info.h" -#include "ql/arch/cc_light/info.h" -#include "ql/arch/none/info.h" -#include "ql/arch/diamond/info.h" +#include "ql/pmgr/manager.h" namespace ql { namespace arch { @@ -16,10 +12,10 @@ namespace arch { * Constructs a default architecture factory for OpenQL. */ Factory::Factory() { - register_architecture(); - register_architecture(); - register_architecture(); - register_architecture(); + // QL_ASSERT(eqasm_compiler_names().count("cc") == 1 && "eqasm compiler 'cc' should be registered"); + // QL_ASSERT(eqasm_compiler_names().count("cc_light") == 1 && "eqasm compiler 'cc_light' should be registered"); + // QL_ASSERT(eqasm_compiler_names().count("diamond") == 1 && "eqasm compiler 'diamond' should be registered"); + // QL_ASSERT(eqasm_compiler_names().count("none") == 1 && "eqasm compiler 'none' should be registered"); } /** @@ -66,7 +62,7 @@ CArchitectureRef Factory::build_from_map( CArchitectureRef Factory::build_from_namespace( const utils::Str &namspace ) const { - return build_from_map(namespace_names, namspace); + return build_from_map(namespace_names(), namspace); } /** @@ -77,7 +73,7 @@ CArchitectureRef Factory::build_from_namespace( CArchitectureRef Factory::build_from_eqasm_compiler( const utils::Str &eqasm_compiler ) const { - return build_from_map(eqasm_compiler_names, eqasm_compiler); + return build_from_map(eqasm_compiler_names(), eqasm_compiler); } /** @@ -85,7 +81,7 @@ CArchitectureRef Factory::build_from_eqasm_compiler( */ void Factory::dump_architectures(std::ostream &os, const utils::Str &line_prefix) const { - for (const auto &it : namespace_names) { + for (const auto &it : namespace_names()) { const auto arch = it.second.as_const(); os << line_prefix << "* " << arch->get_friendly_name() << " *\n"; diff --git a/include/ql/arch/architecture.h b/src/ql/arch/include/ql/arch/architecture.h similarity index 92% rename from include/ql/arch/architecture.h rename to src/ql/arch/include/ql/arch/architecture.h index d582a1c8a..89ff0a5ef 100644 --- a/include/ql/arch/architecture.h +++ b/src/ql/arch/include/ql/arch/architecture.h @@ -9,12 +9,22 @@ #include "ql/utils/str.h" #include "ql/utils/ptr.h" #include "ql/utils/json.h" -#include "ql/ir/compat/platform.h" #include "ql/arch/declarations.h" #include "ql/arch/info_base.h" -#include "ql/pmgr/declarations.h" namespace ql { + +namespace pmgr { + class Manager; +} + +namespace ir { + namespace compat { + class Platform; + using PlatformRef = utils::One; + } +} + namespace arch { /** diff --git a/include/ql/arch/declarations.h b/src/ql/arch/include/ql/arch/declarations.h similarity index 100% rename from include/ql/arch/declarations.h rename to src/ql/arch/include/ql/arch/declarations.h diff --git a/include/ql/arch/factory.h b/src/ql/arch/include/ql/arch/factory.h similarity index 79% rename from include/ql/arch/factory.h rename to src/ql/arch/include/ql/arch/factory.h index 0d9f7f24c..5f0a45968 100644 --- a/include/ql/arch/factory.h +++ b/src/ql/arch/include/ql/arch/factory.h @@ -26,13 +26,19 @@ class Factory { * Map from architecture namespace name to a constructor function for that * particular architecture type. */ - utils::Map namespace_names = {}; + static utils::Map& namespace_names() { + static utils::Map namespace_names{}; + return namespace_names; + } /** * Map from "eqasm_compiler" key value to a constructor function for that * particular architecture type. */ - utils::Map eqasm_compiler_names = {}; + static utils::Map& eqasm_compiler_names() { + static utils::Map eqasm_compiler_names{}; + return eqasm_compiler_names; + } public: @@ -58,13 +64,15 @@ class Factory { * Registers an architecture class with the given type name. */ template - void register_architecture() { + static bool register_architecture() { InfoRef architecture; architecture.emplace(); - namespace_names.set(architecture->get_namespace_name()) = architecture; + namespace_names().set(architecture->get_namespace_name()) = architecture; for (const auto &name : architecture->get_eqasm_compiler_names()) { - eqasm_compiler_names.set(name) = architecture; + eqasm_compiler_names().set(name) = architecture; } + + return true; } /** diff --git a/include/ql/arch/info_base.h b/src/ql/arch/include/ql/arch/info_base.h similarity index 95% rename from include/ql/arch/info_base.h rename to src/ql/arch/include/ql/arch/info_base.h index 1d458b459..1fa8efb33 100644 --- a/include/ql/arch/info_base.h +++ b/src/ql/arch/include/ql/arch/info_base.h @@ -10,11 +10,22 @@ #include "ql/utils/list.h" #include "ql/utils/ptr.h" #include "ql/utils/json.h" -#include "ql/ir/compat/platform.h" -#include "ql/pmgr/declarations.h" +#include "ql/utils/tree.h" #include "ql/arch/declarations.h" namespace ql { + +namespace pmgr { + class Manager; +} + +namespace ir { + namespace compat { + class Platform; + using PlatformRef = utils::One; + } +} + namespace arch { /** diff --git a/src/ql/arch/info_base.cc b/src/ql/arch/info_base.cc index 0245512bf..0f2b69ecb 100644 --- a/src/ql/arch/info_base.cc +++ b/src/ql/arch/info_base.cc @@ -3,6 +3,7 @@ */ #include "ql/arch/info_base.h" +#include "ql/ir/compat/platform.h" namespace ql { namespace arch { diff --git a/src/ql/arch/none/CMakeLists.txt b/src/ql/arch/none/CMakeLists.txt new file mode 100644 index 000000000..4ba6fb4ec --- /dev/null +++ b/src/ql/arch/none/CMakeLists.txt @@ -0,0 +1,13 @@ +add_arch_library(arch_none + "info.cc" +) + +target_include_directories(arch_none PUBLIC include) +create_resource(none_hwconf_default "resources/hwconf_default.json" "${CMAKE_CURRENT_BINARY_DIR}/include/ql/arch/none/resources/hwconf_default.inc") + +add_dependencies(arch_none none_hwconf_default) + +target_include_directories(arch_none PUBLIC include) +target_include_directories(arch_none PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") +target_link_libraries(arch_none PUBLIC utils) +target_link_libraries(arch_none PRIVATE arch) \ No newline at end of file diff --git a/include/ql/arch/none/info.h b/src/ql/arch/none/include/ql/arch/none/info.h similarity index 97% rename from include/ql/arch/none/info.h rename to src/ql/arch/none/include/ql/arch/none/info.h index 10dd2845d..89bb68855 100644 --- a/include/ql/arch/none/info.h +++ b/src/ql/arch/none/include/ql/arch/none/info.h @@ -10,7 +10,6 @@ #include "ql/utils/set.h" #include "ql/utils/ptr.h" #include "ql/utils/json.h" -#include "ql/pmgr/manager.h" #include "ql/arch/info_base.h" namespace ql { @@ -22,6 +21,7 @@ namespace none { */ class Info : public InfoBase { public: + static bool is_architecture_registered; /** * Writes the documentation for this architecture to the given output diff --git a/src/ql/arch/none/info.cc b/src/ql/arch/none/info.cc index a0b91ad93..d36d35711 100644 --- a/src/ql/arch/none/info.cc +++ b/src/ql/arch/none/info.cc @@ -5,11 +5,14 @@ #include "ql/arch/none/info.h" #include "ql/arch/none/resources/hwconf_default.inc" +#include "ql/arch/factory.h" namespace ql { namespace arch { namespace none { +bool Info::is_architecture_registered = Factory::register_architecture(); + /** * Writes the documentation for this architecture to the given output * stream. diff --git a/src/ql/com/CMakeLists.txt b/src/ql/com/CMakeLists.txt new file mode 100644 index 000000000..cfb7af9db --- /dev/null +++ b/src/ql/com/CMakeLists.txt @@ -0,0 +1,15 @@ +add_subdirectory(dec) +add_subdirectory(ddg) +add_subdirectory(ana) +add_subdirectory(map) +add_subdirectory(cfg) +add_subdirectory(sch) + +add_library(com + "options.cc" + "topology.cc" +) + +target_include_directories(com PUBLIC include) + +target_link_libraries(com PUBLIC utils) \ No newline at end of file diff --git a/src/ql/com/ana/CMakeLists.txt b/src/ql/com/ana/CMakeLists.txt new file mode 100644 index 000000000..f953d1a8b --- /dev/null +++ b/src/ql/com/ana/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(com_ana + "metrics.cc" + "interaction_matrix.cc" +) + +target_include_directories(com_ana PUBLIC include) + +target_link_libraries(com_ana PUBLIC utils) +target_link_libraries(com_ana PUBLIC ir) +target_link_libraries(com_ana PUBLIC ir_compat) \ No newline at end of file diff --git a/include/ql/com/ana/interaction_matrix.h b/src/ql/com/ana/include/ql/com/ana/interaction_matrix.h similarity index 100% rename from include/ql/com/ana/interaction_matrix.h rename to src/ql/com/ana/include/ql/com/ana/interaction_matrix.h diff --git a/include/ql/com/ana/metrics.h b/src/ql/com/ana/include/ql/com/ana/metrics.h similarity index 100% rename from include/ql/com/ana/metrics.h rename to src/ql/com/ana/include/ql/com/ana/metrics.h diff --git a/src/ql/com/cfg/CMakeLists.txt b/src/ql/com/cfg/CMakeLists.txt new file mode 100644 index 000000000..d70db2ac3 --- /dev/null +++ b/src/ql/com/cfg/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(com_cfg + "build.cc" + "ops.cc" + "consistency.cc" + "dot.cc" +) + +target_include_directories(com_cfg PUBLIC include) +target_link_libraries(com_cfg PUBLIC utils) +target_link_libraries(com_cfg PUBLIC ir) \ No newline at end of file diff --git a/include/ql/com/cfg/build.h b/src/ql/com/cfg/include/ql/com/cfg/build.h similarity index 100% rename from include/ql/com/cfg/build.h rename to src/ql/com/cfg/include/ql/com/cfg/build.h diff --git a/include/ql/com/cfg/consistency.h b/src/ql/com/cfg/include/ql/com/cfg/consistency.h similarity index 100% rename from include/ql/com/cfg/consistency.h rename to src/ql/com/cfg/include/ql/com/cfg/consistency.h diff --git a/include/ql/com/cfg/dot.h b/src/ql/com/cfg/include/ql/com/cfg/dot.h similarity index 100% rename from include/ql/com/cfg/dot.h rename to src/ql/com/cfg/include/ql/com/cfg/dot.h diff --git a/include/ql/com/cfg/ops.h b/src/ql/com/cfg/include/ql/com/cfg/ops.h similarity index 100% rename from include/ql/com/cfg/ops.h rename to src/ql/com/cfg/include/ql/com/cfg/ops.h diff --git a/include/ql/com/cfg/types.h b/src/ql/com/cfg/include/ql/com/cfg/types.h similarity index 100% rename from include/ql/com/cfg/types.h rename to src/ql/com/cfg/include/ql/com/cfg/types.h diff --git a/src/ql/com/ddg/CMakeLists.txt b/src/ql/com/ddg/CMakeLists.txt new file mode 100644 index 000000000..6fd216446 --- /dev/null +++ b/src/ql/com/ddg/CMakeLists.txt @@ -0,0 +1,11 @@ +add_library(com_ddg + "types.cc" + "build.cc" + "ops.cc" + "consistency.cc" + "dot.cc" +) + +target_include_directories(com_ddg PUBLIC include) +target_link_libraries(com_ddg PUBLIC utils) +target_link_libraries(com_ddg PUBLIC ir) \ No newline at end of file diff --git a/include/ql/com/ddg/build.h b/src/ql/com/ddg/include/ql/com/ddg/build.h similarity index 100% rename from include/ql/com/ddg/build.h rename to src/ql/com/ddg/include/ql/com/ddg/build.h diff --git a/include/ql/com/ddg/consistency.h b/src/ql/com/ddg/include/ql/com/ddg/consistency.h similarity index 100% rename from include/ql/com/ddg/consistency.h rename to src/ql/com/ddg/include/ql/com/ddg/consistency.h diff --git a/include/ql/com/ddg/dot.h b/src/ql/com/ddg/include/ql/com/ddg/dot.h similarity index 100% rename from include/ql/com/ddg/dot.h rename to src/ql/com/ddg/include/ql/com/ddg/dot.h diff --git a/include/ql/com/ddg/ops.h b/src/ql/com/ddg/include/ql/com/ddg/ops.h similarity index 100% rename from include/ql/com/ddg/ops.h rename to src/ql/com/ddg/include/ql/com/ddg/ops.h diff --git a/include/ql/com/ddg/types.h b/src/ql/com/ddg/include/ql/com/ddg/types.h similarity index 100% rename from include/ql/com/ddg/types.h rename to src/ql/com/ddg/include/ql/com/ddg/types.h diff --git a/src/ql/com/ddg/tests/CMakeLists.txt b/src/ql/com/ddg/tests/CMakeLists.txt new file mode 100644 index 000000000..7ae8aafc0 --- /dev/null +++ b/src/ql/com/ddg/tests/CMakeLists.txt @@ -0,0 +1 @@ +add_openql_test(ddg ddc.cc) \ No newline at end of file diff --git a/src/ql/com/dec/CMakeLists.txt b/src/ql/com/dec/CMakeLists.txt new file mode 100644 index 000000000..432d409ee --- /dev/null +++ b/src/ql/com/dec/CMakeLists.txt @@ -0,0 +1,12 @@ +add_library(com_dec + "unitary.cc" + "rules.cc" + "structure.cc" +) + +target_include_directories(com_dec PUBLIC include) + +target_link_libraries(com_dec PUBLIC utils) +target_link_libraries(com_dec PUBLIC ir) +target_link_libraries(com_dec PUBLIC com_map) +target_link_libraries(com_dec PUBLIC eigen) \ No newline at end of file diff --git a/include/ql/com/dec/rules.h b/src/ql/com/dec/include/ql/com/dec/rules.h similarity index 100% rename from include/ql/com/dec/rules.h rename to src/ql/com/dec/include/ql/com/dec/rules.h diff --git a/include/ql/com/dec/structure.h b/src/ql/com/dec/include/ql/com/dec/structure.h similarity index 100% rename from include/ql/com/dec/structure.h rename to src/ql/com/dec/include/ql/com/dec/structure.h diff --git a/include/ql/com/dec/unitary.h b/src/ql/com/dec/include/ql/com/dec/unitary.h similarity index 100% rename from include/ql/com/dec/unitary.h rename to src/ql/com/dec/include/ql/com/dec/unitary.h diff --git a/include/ql/com/options.h b/src/ql/com/include/ql/com/options.h similarity index 100% rename from include/ql/com/options.h rename to src/ql/com/include/ql/com/options.h diff --git a/include/ql/com/topology.h b/src/ql/com/include/ql/com/topology.h similarity index 100% rename from include/ql/com/topology.h rename to src/ql/com/include/ql/com/topology.h diff --git a/src/ql/com/map/CMakeLists.txt b/src/ql/com/map/CMakeLists.txt new file mode 100644 index 000000000..f0b5d26ac --- /dev/null +++ b/src/ql/com/map/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(com_map + "expression_mapper.cc" + "qubit_mapping.cc" +) + +target_include_directories(com_map PUBLIC include) + +target_link_libraries(com_map PUBLIC utils) +target_link_libraries(com_map PUBLIC ir) \ No newline at end of file diff --git a/include/ql/com/map/expression_mapper.h b/src/ql/com/map/include/ql/com/map/expression_mapper.h similarity index 100% rename from include/ql/com/map/expression_mapper.h rename to src/ql/com/map/include/ql/com/map/expression_mapper.h diff --git a/include/ql/com/map/qubit_mapping.h b/src/ql/com/map/include/ql/com/map/qubit_mapping.h similarity index 100% rename from include/ql/com/map/qubit_mapping.h rename to src/ql/com/map/include/ql/com/map/qubit_mapping.h diff --git a/src/ql/com/sch/CMakeLists.txt b/src/ql/com/sch/CMakeLists.txt new file mode 100644 index 000000000..949ab94aa --- /dev/null +++ b/src/ql/com/sch/CMakeLists.txt @@ -0,0 +1,11 @@ +add_library(com_sch + "heuristics.cc" + "scheduler.cc" +) + +target_include_directories(com_sch PUBLIC include) + +target_link_libraries(com_sch PUBLIC utils) +target_link_libraries(com_sch PUBLIC com_ddg) +target_link_libraries(com_sch PUBLIC ir) +target_link_libraries(com_sch PUBLIC rmgr) \ No newline at end of file diff --git a/include/ql/com/sch/heuristics.h b/src/ql/com/sch/include/ql/com/sch/heuristics.h similarity index 100% rename from include/ql/com/sch/heuristics.h rename to src/ql/com/sch/include/ql/com/sch/heuristics.h diff --git a/include/ql/com/sch/scheduler.h b/src/ql/com/sch/include/ql/com/sch/scheduler.h similarity index 100% rename from include/ql/com/sch/scheduler.h rename to src/ql/com/sch/include/ql/com/sch/scheduler.h diff --git a/src/ql/config.h.template b/src/ql/include/ql/config.h.template similarity index 88% rename from src/ql/config.h.template rename to src/ql/include/ql/config.h.template index 800b4639e..20e456829 100644 --- a/src/ql/config.h.template +++ b/src/ql/include/ql/config.h.template @@ -24,3 +24,5 @@ // Enable hacks to allow wait/barrier gates to appear in decompositions for the // old IR. #define OPT_DECOMPOSE_WAIT_BARRIER + +#define OPT_CC_USER_FUNCTIONS 1 // 1=add support for some user functions (experimental) \ No newline at end of file diff --git a/include/ql/version.h b/src/ql/include/ql/version.h similarity index 100% rename from include/ql/version.h rename to src/ql/include/ql/version.h diff --git a/src/ql/ir/CMakeLists.txt b/src/ql/ir/CMakeLists.txt new file mode 100644 index 000000000..4054e2649 --- /dev/null +++ b/src/ql/ir/CMakeLists.txt @@ -0,0 +1,45 @@ +add_subdirectory(compat) +add_subdirectory(cqasm) + +if(OPENQL_BUILD_TESTS) + add_subdirectory(tests) +endif() + +# Build the IR tree using tree-gen. +generate_tree( + "${CMAKE_CURRENT_SOURCE_DIR}/ir.tree" + "${CMAKE_CURRENT_BINARY_DIR}/include/ql/ir/ir.gen.h" + "${CMAKE_CURRENT_BINARY_DIR}/ir.gen.cc" +) + +add_custom_target( + generated_files + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/ql/ir/ir.gen.h" "${CMAKE_CURRENT_BINARY_DIR}/ir.gen.cc" +) + +add_library(ir + "prim.cc" + "${CMAKE_CURRENT_BINARY_DIR}/include/ql/ir/ir.gen.h" + "${CMAKE_CURRENT_BINARY_DIR}/ir.gen.cc" + "ops.cc" + "operator_info.cc" + "describe.cc" + "consistency.cc" + "old_to_new.cc" + "new_to_old.cc" + "dump.cc" + "annotations.cc" +) + +add_dependencies(ir generated_files) + +target_include_directories(ir PUBLIC include) +target_include_directories(ir PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") + +target_link_libraries(ir PUBLIC utils) +target_link_libraries(ir PUBLIC ir_compat) +target_link_libraries(ir PUBLIC ir_cqasm) +target_link_libraries(ir PUBLIC arch_diamond_annotations) +target_link_libraries(ir PUBLIC com) +target_link_libraries(ir PUBLIC com_ana) +target_link_libraries(ir PUBLIC rmgr) \ No newline at end of file diff --git a/src/ql/pass/ana/statistics/annotations.cc b/src/ql/ir/annotations.cc similarity index 91% rename from src/ql/pass/ana/statistics/annotations.cc rename to src/ql/ir/annotations.cc index 539c1d56c..b1af06977 100644 --- a/src/ql/pass/ana/statistics/annotations.cc +++ b/src/ql/ir/annotations.cc @@ -2,12 +2,10 @@ * Defines common types and utility functions related to the statistics passes. */ -#include "ql/pass/ana/statistics/annotations.h" +#include "ql/ir/annotations.h" namespace ql { -namespace pass { -namespace ana { -namespace statistics { +namespace ir { /** * Attaches a statistic to the given node. @@ -77,7 +75,5 @@ utils::List AdditionalStats::pop(const ir::ProgramRef &program) { return pop_node(*program); } -} // namespace statistics -} // namespace ana -} // namespace pass +} // namespace ir } // namespace ql diff --git a/src/ql/ir/compat/CMakeLists.txt b/src/ql/ir/compat/CMakeLists.txt new file mode 100644 index 000000000..6bf90e6c9 --- /dev/null +++ b/src/ql/ir/compat/CMakeLists.txt @@ -0,0 +1,18 @@ +add_library(ir_compat + "platform.cc" + "gate.cc" + "classical.cc" + "bundle.cc" + "kernel.cc" + "program.cc" + "cqasm_reader.cc" + "detail/cqasm_reader.cc" + "detail/cqasm_reader.h" +) + +target_include_directories(ir_compat PUBLIC include) + +target_link_libraries(ir_compat PRIVATE utils) +target_link_libraries(ir_compat PRIVATE com) +target_link_libraries(ir_compat PRIVATE com_dec) +target_link_libraries(ir_compat PUBLIC arch) \ No newline at end of file diff --git a/include/ql/ir/compat/bundle.h b/src/ql/ir/compat/include/ql/ir/compat/bundle.h similarity index 100% rename from include/ql/ir/compat/bundle.h rename to src/ql/ir/compat/include/ql/ir/compat/bundle.h diff --git a/include/ql/ir/compat/classical.h b/src/ql/ir/compat/include/ql/ir/compat/classical.h similarity index 100% rename from include/ql/ir/compat/classical.h rename to src/ql/ir/compat/include/ql/ir/compat/classical.h diff --git a/include/ql/ir/compat/compat.h b/src/ql/ir/compat/include/ql/ir/compat/compat.h similarity index 100% rename from include/ql/ir/compat/compat.h rename to src/ql/ir/compat/include/ql/ir/compat/compat.h diff --git a/include/ql/ir/compat/cqasm_reader.h b/src/ql/ir/compat/include/ql/ir/compat/cqasm_reader.h similarity index 96% rename from include/ql/ir/compat/cqasm_reader.h rename to src/ql/ir/compat/include/ql/ir/compat/cqasm_reader.h index de54962f4..902960ec3 100644 --- a/include/ql/ir/compat/cqasm_reader.h +++ b/src/ql/ir/compat/include/ql/ir/compat/cqasm_reader.h @@ -7,7 +7,8 @@ #include "ql/utils/str.h" #include "ql/utils/json.h" #include "ql/utils/opt.h" -#include "ql/pmgr/pass_types/specializations.h" +#include "ql/ir/compat/platform.h" +#include "ql/ir/compat/program.h" namespace ql { namespace ir { diff --git a/include/ql/ir/compat/gate.h b/src/ql/ir/compat/include/ql/ir/compat/gate.h similarity index 100% rename from include/ql/ir/compat/gate.h rename to src/ql/ir/compat/include/ql/ir/compat/gate.h diff --git a/include/ql/ir/compat/kernel.h b/src/ql/ir/compat/include/ql/ir/compat/kernel.h similarity index 100% rename from include/ql/ir/compat/kernel.h rename to src/ql/ir/compat/include/ql/ir/compat/kernel.h diff --git a/include/ql/ir/compat/platform.h b/src/ql/ir/compat/include/ql/ir/compat/platform.h similarity index 99% rename from include/ql/ir/compat/platform.h rename to src/ql/ir/compat/include/ql/ir/compat/platform.h index fa0227da3..79279e001 100644 --- a/include/ql/ir/compat/platform.h +++ b/src/ql/ir/compat/include/ql/ir/compat/platform.h @@ -10,10 +10,13 @@ #include "ql/utils/json.h" #include "ql/utils/tree.h" #include "ql/ir/compat/gate.h" -#include "ql/com/topology.h" #include "ql/arch/declarations.h" namespace ql { +namespace com { + class Topology; +} + namespace ir { namespace compat { diff --git a/include/ql/ir/compat/program.h b/src/ql/ir/compat/include/ql/ir/compat/program.h similarity index 100% rename from include/ql/ir/compat/program.h rename to src/ql/ir/compat/include/ql/ir/compat/program.h diff --git a/src/ql/ir/compat/platform.cc b/src/ql/ir/compat/platform.cc index 1997f39db..f01c8b5b1 100644 --- a/src/ql/ir/compat/platform.cc +++ b/src/ql/ir/compat/platform.cc @@ -7,8 +7,8 @@ #include #include "ql/config.h" #include "ql/utils/filesystem.h" -#include "ql/rmgr/manager.h" #include "ql/arch/factory.h" +#include "ql/com/topology.h" namespace ql { namespace ir { @@ -116,7 +116,7 @@ void Platform::dump_docs(std::ostream &os, const utils::Str &line_prefix) { * `"resources"` section * )"); - rmgr::Manager::dump_docs(os, line_prefix + " "); + // rmgr::Manager::dump_docs(os, line_prefix + " "); // FIXME? Or obsolete os << line_prefix << std::endl; utils::dump_str(os, line_prefix, R"( * `"instructions"` section * diff --git a/src/ql/ir/compat/program.cc b/src/ql/ir/compat/program.cc index d24b7c583..2a9043799 100644 --- a/src/ql/ir/compat/program.cc +++ b/src/ql/ir/compat/program.cc @@ -2,7 +2,6 @@ * Quantum program abstraction implementation. */ -#include #include "ql/ir/compat/program.h" #include "ql/utils/filesystem.h" diff --git a/src/ql/ir/cqasm/CMakeLists.txt b/src/ql/ir/cqasm/CMakeLists.txt new file mode 100644 index 000000000..b60346b85 --- /dev/null +++ b/src/ql/ir/cqasm/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(ir_cqasm + "read.cc" + "write.cc" +) + +target_include_directories(ir_cqasm PUBLIC include) +target_link_libraries(ir_cqasm PUBLIC utils) +target_link_libraries(ir_cqasm PUBLIC ir) +target_link_libraries(ir_cqasm PUBLIC com_ddg) \ No newline at end of file diff --git a/include/ql/ir/cqasm/read.h b/src/ql/ir/cqasm/include/ql/ir/cqasm/read.h similarity index 100% rename from include/ql/ir/cqasm/read.h rename to src/ql/ir/cqasm/include/ql/ir/cqasm/read.h diff --git a/include/ql/ir/cqasm/write.h b/src/ql/ir/cqasm/include/ql/ir/cqasm/write.h similarity index 100% rename from include/ql/ir/cqasm/write.h rename to src/ql/ir/cqasm/include/ql/ir/cqasm/write.h diff --git a/src/ql/ir/cqasm/write.cc b/src/ql/ir/cqasm/write.cc index 9fbad84dd..9a872c6ea 100644 --- a/src/ql/ir/cqasm/write.cc +++ b/src/ql/ir/cqasm/write.cc @@ -8,7 +8,7 @@ #include "ql/ir/ops.h" #include "ql/ir/describe.h" #include "ql/ir/operator_info.h" -#include "ql/pass/ana/statistics/report.h" +#include "ql/ir/dump.h" namespace ql { namespace ir { @@ -228,7 +228,7 @@ class Writer : public Visitor { // Print program-wide statistics as comments at the end if requested. if (options.include_statistics) { os << el(); - pass::ana::statistics::report::dump(ir, node.program, os, line_prefix + "# "); + dump(ir, node.program, os, line_prefix + "# "); } } @@ -470,7 +470,7 @@ class Writer : public Visitor { // Print block-wide statistics as comments at the end if requested. if (options.include_statistics) { os << el(); - pass::ana::statistics::report::dump(ir, block, os, line_prefix + " # "); + dump(ir, block, os, line_prefix + " # "); } } diff --git a/src/ql/ir/dump.cc b/src/ql/ir/dump.cc new file mode 100644 index 000000000..eb9b2bc2d --- /dev/null +++ b/src/ql/ir/dump.cc @@ -0,0 +1,85 @@ +/** \file + * Defines the statistics reporting pass. + */ + +#include "ql/ir/dump.h" + +#include "ql/utils/filesystem.h" +#include "ql/com/ana/metrics.h" +#include "ql/ir/annotations.h" + +namespace ql { +namespace ir { + +/** + * Dumps basic statistics for the given kernel to the given output stream. + */ +void dump( + const ir::Ref &ir, + const ir::BlockRef &block, + std::ostream &os, + const utils::Str &line_prefix +) { + using namespace com::ana; + + os << line_prefix << "Duration (assuming no control-flow): " << compute_block(ir, block) << "\n"; + os << line_prefix << "Number of quantum gates: " << compute_block(ir, block) << "\n"; + os << line_prefix << "Number of multi-qubit gates: " << compute_block(ir, block) << "\n"; + os << line_prefix << "Number of classical operations: " << compute_block(ir, block) << "\n"; + os << line_prefix << "Number of qubits used: " << compute_block(ir, block).sparse_size() << "\n"; + os << line_prefix << "Qubit cycles use (assuming no control-flow): " << compute_block(ir, block) << "\n"; + for (const auto &line : AdditionalStats::pop(block)) { + os << line_prefix << "----- " << line << "\n"; + } + os.flush(); +} + +/** + * Dumps basic statistics for the given program to the given output stream. This + * only dumps the global statistics, not the statistics for each individual + * kernel. + */ +void dump( + const ir::Ref &ir, + const ir::ProgramRef &program, + std::ostream &os, + const utils::Str &line_prefix +) { + using namespace com::ana; + + os << line_prefix << "Total duration (assuming no control-flow): " << compute_program(ir) << "\n"; + os << line_prefix << "Total number of quantum gates: " << compute_program(ir) << "\n"; + os << line_prefix << "Total number of multi-qubit gates: " << compute_program(ir) << "\n"; + os << line_prefix << "Total number of classical operations: " << compute_program(ir) << "\n"; + os << line_prefix << "Number of qubits used: " << compute_program(ir).sparse_size() << "\n"; + os << line_prefix << "Qubit cycles use (assuming no control-flow): " << compute_program(ir) << "\n"; + for (const auto &line : AdditionalStats::pop(program)) { + os << line_prefix << line << "\n"; + } + os.flush(); +} + +/** + * Dumps statistics for the given program and its kernels to the given output + * stream. + */ +void dump_all( + const ir::Ref &ir, + std::ostream &os, + const utils::Str &line_prefix +) { + if (ir->program.empty()) { + os << line_prefix << "no program node to dump statistics for" << std::endl; + } else { + for (const auto &block : ir->program->blocks) { + os << line_prefix << "For block with name \"" << block->name << "\":\n"; + dump(ir, block, os, line_prefix + " "); + os << "\n"; + } + os << line_prefix << "Global statistics:\n"; + dump(ir, ir->program, os, line_prefix); + } +} + +} // namespace ir +} // namespace ql diff --git a/include/ql/pass/ana/statistics/annotations.h b/src/ql/ir/include/ql/ir/annotations.h similarity index 92% rename from include/ql/pass/ana/statistics/annotations.h rename to src/ql/ir/include/ql/ir/annotations.h index e8fdc1739..806f56fb3 100644 --- a/include/ql/pass/ana/statistics/annotations.h +++ b/src/ql/ir/include/ql/ir/annotations.h @@ -10,9 +10,7 @@ #include "ql/ir/compat/compat.h" namespace ql { -namespace pass { -namespace ana { -namespace statistics { +namespace ir { /** * Annotation object that may be used by other passes to attach additional @@ -59,7 +57,5 @@ struct AdditionalStats { }; -} // namespace statistics -} // namespace ana -} // namespace pass +} // namespace ir } // namespace ql diff --git a/include/ql/ir/consistency.h b/src/ql/ir/include/ql/ir/consistency.h similarity index 100% rename from include/ql/ir/consistency.h rename to src/ql/ir/include/ql/ir/consistency.h diff --git a/include/ql/ir/describe.h b/src/ql/ir/include/ql/ir/describe.h similarity index 100% rename from include/ql/ir/describe.h rename to src/ql/ir/include/ql/ir/describe.h diff --git a/src/ql/ir/include/ql/ir/dump.h b/src/ql/ir/include/ql/ir/dump.h new file mode 100644 index 000000000..b3b39224e --- /dev/null +++ b/src/ql/ir/include/ql/ir/dump.h @@ -0,0 +1,46 @@ +/** \file + * Defines the statistics reporting pass. + */ + +#pragma once + +#include +#include "ql/ir/ir.h" + +namespace ql { +namespace ir { + +/** + * Dumps basic statistics for the given block to the given output stream. + */ +void dump( + const ir::Ref &ir, + const ir::BlockRef &block, + std::ostream &os = std::cout, + const utils::Str &line_prefix = "" +); + +/** + * Dumps basic statistics for the given program to the given output stream. This + * only dumps the global statistics, not the statistics for each individual + * kernel. + */ +void dump( + const ir::Ref &ir, + const ir::ProgramRef &program, + std::ostream &os = std::cout, + const utils::Str &line_prefix = "" +); + +/** + * Dumps statistics for the given program and its top-level blocks to the given + * output stream. + */ +void dump_all( + const ir::Ref &ir, + std::ostream &os = std::cout, + const utils::Str &line_prefix = "" +); + +} // namespace ir +} // namespace ql diff --git a/include/ql/ir/ir.h b/src/ql/ir/include/ql/ir/ir.h similarity index 100% rename from include/ql/ir/ir.h rename to src/ql/ir/include/ql/ir/ir.h diff --git a/include/ql/ir/new_to_old.h b/src/ql/ir/include/ql/ir/new_to_old.h similarity index 100% rename from include/ql/ir/new_to_old.h rename to src/ql/ir/include/ql/ir/new_to_old.h diff --git a/include/ql/ir/old_to_new.h b/src/ql/ir/include/ql/ir/old_to_new.h similarity index 100% rename from include/ql/ir/old_to_new.h rename to src/ql/ir/include/ql/ir/old_to_new.h diff --git a/include/ql/ir/operator_info.h b/src/ql/ir/include/ql/ir/operator_info.h similarity index 100% rename from include/ql/ir/operator_info.h rename to src/ql/ir/include/ql/ir/operator_info.h diff --git a/include/ql/ir/ops.h b/src/ql/ir/include/ql/ir/ops.h similarity index 100% rename from include/ql/ir/ops.h rename to src/ql/ir/include/ql/ir/ops.h diff --git a/include/ql/ir/prim.h b/src/ql/ir/include/ql/ir/prim.h similarity index 100% rename from include/ql/ir/prim.h rename to src/ql/ir/include/ql/ir/prim.h diff --git a/src/ql/ir/old_to_new.cc b/src/ql/ir/old_to_new.cc index a0f0bf45f..318896913 100644 --- a/src/ql/ir/old_to_new.cc +++ b/src/ql/ir/old_to_new.cc @@ -11,7 +11,7 @@ #include "ql/arch/architecture.h" #include "ql/rmgr/manager.h" #include "ql/arch/diamond/annotations.h" -#include "ql/arch/cc/pass/gen/vq1asm/detail/options.h" // FIXME: remove when OPT_CC_USER_FUNCTIONS is no longer needed +#include "ql/config.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG diff --git a/src/ql/ir/tests/CMakeLists.txt b/src/ql/ir/tests/CMakeLists.txt new file mode 100644 index 000000000..dd5bfb346 --- /dev/null +++ b/src/ql/ir/tests/CMakeLists.txt @@ -0,0 +1,3 @@ +add_openql_unit_test(ir_test ir_test.cc) + +target_link_libraries(ir_test PRIVATE pmgr ir com_ddg arch_cc_light pass_io_cqasm rmgr utils com_sch) \ No newline at end of file diff --git a/src/ql/ir/tests/ir.cc b/src/ql/ir/tests/ir_test.cc similarity index 100% rename from src/ql/ir/tests/ir.cc rename to src/ql/ir/tests/ir_test.cc diff --git a/src/ql/pass/CMakeLists.txt b/src/ql/pass/CMakeLists.txt new file mode 100644 index 000000000..b8ece00a6 --- /dev/null +++ b/src/ql/pass/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(all_passes INTERFACE) + +macro(add_pass_library name) + add_library("${name}" OBJECT "${ARGN}") + target_sources(all_passes PUBLIC $) +endmacro() + +add_subdirectory(ana) +add_subdirectory(dec) +add_subdirectory(io) +add_subdirectory(map/qubits) +add_subdirectory(opt) +add_subdirectory(sch) \ No newline at end of file diff --git a/src/ql/pass/ana/CMakeLists.txt b/src/ql/pass/ana/CMakeLists.txt new file mode 100644 index 000000000..ea8860803 --- /dev/null +++ b/src/ql/pass/ana/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(visualize) +add_subdirectory(statistics) \ No newline at end of file diff --git a/src/ql/pass/ana/statistics/CMakeLists.txt b/src/ql/pass/ana/statistics/CMakeLists.txt new file mode 100644 index 000000000..ef9fcaa6f --- /dev/null +++ b/src/ql/pass/ana/statistics/CMakeLists.txt @@ -0,0 +1,10 @@ +add_pass_library(pass_ana_statistics + "report.cc" + "clean.cc" +) + +target_include_directories(pass_ana_statistics PUBLIC include) + +target_link_libraries(pass_ana_statistics PUBLIC utils) +target_link_libraries(pass_ana_statistics PUBLIC pmgr) +target_link_libraries(pass_ana_statistics PUBLIC ir) \ No newline at end of file diff --git a/src/ql/pass/ana/statistics/clean.cc b/src/ql/pass/ana/statistics/clean.cc index af22336ba..9880309d3 100644 --- a/src/ql/pass/ana/statistics/clean.cc +++ b/src/ql/pass/ana/statistics/clean.cc @@ -3,6 +3,7 @@ */ #include "ql/pass/ana/statistics/clean.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -10,6 +11,10 @@ namespace ana { namespace statistics { namespace clean { +using AdditionalStats = ir::AdditionalStats; + +bool CleanStatisticsPass::is_pass_registered = pmgr::Factory::register_pass("ana.statistics.Clean"); + /** * Dumps docs for the statistics cleaner. */ diff --git a/include/ql/pass/ana/statistics/clean.h b/src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/clean.h similarity index 94% rename from include/ql/pass/ana/statistics/clean.h rename to src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/clean.h index d1dcdd83b..101590493 100644 --- a/include/ql/pass/ana/statistics/clean.h +++ b/src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/clean.h @@ -5,7 +5,7 @@ #pragma once #include "ql/pmgr/pass_types/specializations.h" -#include "ql/pass/ana/statistics/annotations.h" +#include "ql/ir/annotations.h" namespace ql { namespace pass { @@ -17,6 +17,8 @@ namespace clean { * Statistics cleaning pass. */ class CleanStatisticsPass : public pmgr::pass_types::Analysis { + static bool is_pass_registered; + protected: /** diff --git a/include/ql/pass/ana/statistics/report.h b/src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/report.h similarity index 91% rename from include/ql/pass/ana/statistics/report.h rename to src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/report.h index c6f9c10f4..b927b9a2e 100644 --- a/include/ql/pass/ana/statistics/report.h +++ b/src/ql/pass/ana/statistics/include/ql/pass/ana/statistics/report.h @@ -5,7 +5,8 @@ #pragma once #include "ql/pmgr/pass_types/specializations.h" -#include "ql/pass/ana/statistics/annotations.h" +#include "ql/ir/annotations.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -49,6 +50,8 @@ void dump_all( * Statistics reporting pass. */ class ReportStatisticsPass : public pmgr::pass_types::Analysis { + static bool is_pass_registered; + protected: /** @@ -90,6 +93,8 @@ class ReportStatisticsPass : public pmgr::pass_types::Analysis { */ using Pass = ReportStatisticsPass; +bool isRegistered = pmgr::Factory::register_pass("ana.statistics.Report"); + } // namespace report } // namespace statistics } // namespace ana diff --git a/src/ql/pass/ana/statistics/report.cc b/src/ql/pass/ana/statistics/report.cc index 29dacfddf..664455bc9 100644 --- a/src/ql/pass/ana/statistics/report.cc +++ b/src/ql/pass/ana/statistics/report.cc @@ -6,6 +6,7 @@ #include "ql/utils/filesystem.h" #include "ql/com/ana/metrics.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -13,6 +14,8 @@ namespace ana { namespace statistics { namespace report { +using AdditionalStats = ir::AdditionalStats; + /** * Dumps basic statistics for the given kernel to the given output stream. */ @@ -83,6 +86,8 @@ void dump_all( } } +bool ReportStatisticsPass::is_pass_registered = pmgr::Factory::register_pass("ana.statistics.Report"); + /** * Dumps docs for the statistics reporter. */ diff --git a/src/ql/pass/ana/visualize/CMakeLists.txt b/src/ql/pass/ana/visualize/CMakeLists.txt new file mode 100644 index 000000000..e0c91f18a --- /dev/null +++ b/src/ql/pass/ana/visualize/CMakeLists.txt @@ -0,0 +1,37 @@ +add_pass_library(pass_ana_visualize + "detail/types.cc" + "detail/common.cc" + "detail/image.cc" + "detail/circuit.cc" + "detail/interaction.cc" + "detail/mapping.cc" + "circuit.cc" + "interaction.cc" + "mapping.cc" +) + +target_include_directories(pass_ana_visualize PUBLIC include) + +target_link_libraries(pass_ana_visualize PUBLIC utils) +target_link_libraries(pass_ana_visualize PUBLIC pmgr) + +# Only enable the visualizer if building on Windows or the X11 library is found when building on Linux or Mac. +if(WIN32) + set(QL_VISUALIZER yes) +else() + find_package(X11) + if(X11_FOUND) + set(QL_VISUALIZER yes) + message("X11 libraries: ${X11_LIBRARIES}") + target_link_libraries(pass_ana_visualize PUBLIC ${X11_LIBRARIES}) + message("X11 include path: ${X11_INCLUDE_DIR}") + target_include_directories(pass_ana_visualize PRIVATE "${X11_INCLUDE_DIR}") + else() + set(QL_VISUALIZER no) + endif() +endif() + +if(QL_VISUALIZER) + target_compile_definitions(pass_ana_visualize PRIVATE WITH_VISUALIZER) + target_include_directories(pass_ana_visualize PRIVATE "${CMAKE_SOURCE_DIR}/deps/cimg/include/") +endif() diff --git a/src/ql/pass/ana/visualize/circuit.cc b/src/ql/pass/ana/visualize/circuit.cc index f0ddb0e35..6c49941a8 100644 --- a/src/ql/pass/ana/visualize/circuit.cc +++ b/src/ql/pass/ana/visualize/circuit.cc @@ -4,7 +4,8 @@ #include "ql/pass/ana/visualize/circuit.h" -#include "detail/circuit.h" +#include "ql/pass/ana/visualize/detail/circuit.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -12,6 +13,8 @@ namespace ana { namespace visualize { namespace circuit { +bool VisualizeCircuitPass::is_pass_registered = pmgr::Factory::register_pass("ana.visualize.Circuit"); + /** * Dumps docs for the circuit visualizer. */ diff --git a/include/ql/pass/ana/visualize/circuit.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/circuit.h similarity index 96% rename from include/ql/pass/ana/visualize/circuit.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/circuit.h index 5e99950a4..0a4e2366f 100644 --- a/include/ql/pass/ana/visualize/circuit.h +++ b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/circuit.h @@ -16,6 +16,8 @@ namespace circuit { * Circuit visualizer pass. */ class VisualizeCircuitPass : public pmgr::pass_types::ProgramAnalysis { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/ana/visualize/detail/circuit.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/circuit.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/circuit.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/circuit.h diff --git a/src/ql/pass/ana/visualize/detail/common.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/common.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/common.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/common.h diff --git a/src/ql/pass/ana/visualize/detail/image.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/image.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/image.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/image.h diff --git a/src/ql/pass/ana/visualize/detail/interaction.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/interaction.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/interaction.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/interaction.h diff --git a/src/ql/pass/ana/visualize/detail/mapping.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/mapping.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/mapping.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/mapping.h diff --git a/src/ql/pass/ana/visualize/detail/types.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/types.h similarity index 100% rename from src/ql/pass/ana/visualize/detail/types.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/detail/types.h diff --git a/include/ql/pass/ana/visualize/interaction.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/interaction.h similarity index 97% rename from include/ql/pass/ana/visualize/interaction.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/interaction.h index 59980ebda..b83dc27c6 100644 --- a/include/ql/pass/ana/visualize/interaction.h +++ b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/interaction.h @@ -16,6 +16,8 @@ namespace interaction { * Interaction graph visualizer pass. */ class VisualizeInteractionPass : public pmgr::pass_types::ProgramAnalysis { + static bool is_pass_registered; + protected: /** diff --git a/include/ql/pass/ana/visualize/mapping.h b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/mapping.h similarity index 96% rename from include/ql/pass/ana/visualize/mapping.h rename to src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/mapping.h index 40d8e700c..23b5479ae 100644 --- a/include/ql/pass/ana/visualize/mapping.h +++ b/src/ql/pass/ana/visualize/include/ql/pass/ana/visualize/mapping.h @@ -16,6 +16,8 @@ namespace mapping { * Mapping graph visualizer pass. */ class VisualizeMappingPass : public pmgr::pass_types::ProgramAnalysis { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/ana/visualize/interaction.cc b/src/ql/pass/ana/visualize/interaction.cc index 78f766806..7a3cc50ae 100644 --- a/src/ql/pass/ana/visualize/interaction.cc +++ b/src/ql/pass/ana/visualize/interaction.cc @@ -4,7 +4,8 @@ #include "ql/pass/ana/visualize/interaction.h" -#include "detail/interaction.h" +#include "ql/pass/ana/visualize/detail/interaction.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -12,6 +13,8 @@ namespace ana { namespace visualize { namespace interaction { +bool VisualizeInteractionPass::is_pass_registered = pmgr::Factory::register_pass("ana.visualize.Interaction"); + /** * Dumps docs for the interaction graph visualizer. */ diff --git a/src/ql/pass/ana/visualize/mapping.cc b/src/ql/pass/ana/visualize/mapping.cc index 7d21b1280..36454ea7d 100644 --- a/src/ql/pass/ana/visualize/mapping.cc +++ b/src/ql/pass/ana/visualize/mapping.cc @@ -4,7 +4,8 @@ #include "ql/pass/ana/visualize/mapping.h" -#include "detail/mapping.h" +#include "ql/pass/ana/visualize/detail/mapping.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -12,6 +13,8 @@ namespace ana { namespace visualize { namespace mapping { +bool VisualizeMappingPass::is_pass_registered = pmgr::Factory::register_pass("ana.visualize.Mapping"); + /** * Dumps docs for the mapping graph visualizer. */ diff --git a/src/ql/pass/dec/CMakeLists.txt b/src/ql/pass/dec/CMakeLists.txt new file mode 100644 index 000000000..ea6691267 --- /dev/null +++ b/src/ql/pass/dec/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(generalize) +add_subdirectory(specialize) +add_subdirectory(structure) +add_subdirectory(instructions) \ No newline at end of file diff --git a/src/ql/pass/dec/generalize/CMakeLists.txt b/src/ql/pass/dec/generalize/CMakeLists.txt new file mode 100644 index 000000000..cdccd8f4d --- /dev/null +++ b/src/ql/pass/dec/generalize/CMakeLists.txt @@ -0,0 +1,8 @@ +add_pass_library(pass_dec_generalize + "generalize.cc" +) + +target_include_directories(pass_dec_generalize PUBLIC include) + +target_link_libraries(pass_dec_generalize PRIVATE com_dec) +target_link_libraries(pass_dec_generalize PUBLIC pmgr) \ No newline at end of file diff --git a/src/ql/pass/dec/generalize/generalize.cc b/src/ql/pass/dec/generalize/generalize.cc index 73746e706..6cb203050 100644 --- a/src/ql/pass/dec/generalize/generalize.cc +++ b/src/ql/pass/dec/generalize/generalize.cc @@ -6,12 +6,15 @@ #include "ql/ir/ops.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { namespace dec { namespace generalize { +bool GeneralizeInstructionsPass::is_pass_registered = pmgr::Factory::register_pass("dec.Generalize"); + /** * Dumps docs for the instruction generalizer. */ diff --git a/include/ql/pass/dec/generalize/generalize.h b/src/ql/pass/dec/generalize/include/ql/pass/dec/generalize/generalize.h similarity index 97% rename from include/ql/pass/dec/generalize/generalize.h rename to src/ql/pass/dec/generalize/include/ql/pass/dec/generalize/generalize.h index 6d596eca9..4ad4dc86e 100644 --- a/include/ql/pass/dec/generalize/generalize.h +++ b/src/ql/pass/dec/generalize/include/ql/pass/dec/generalize/generalize.h @@ -16,6 +16,8 @@ namespace generalize { * Instruction generalization pass. */ class GeneralizeInstructionsPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/dec/instructions/CMakeLists.txt b/src/ql/pass/dec/instructions/CMakeLists.txt new file mode 100644 index 000000000..bd587331b --- /dev/null +++ b/src/ql/pass/dec/instructions/CMakeLists.txt @@ -0,0 +1,7 @@ +add_pass_library(pass_dev_instructions + "instructions.cc" +) + +target_include_directories(pass_dev_instructions PUBLIC include) +target_link_libraries(pass_dev_instructions PRIVATE com_dec) +target_link_libraries(pass_dev_instructions PUBLIC pmgr) \ No newline at end of file diff --git a/include/ql/pass/dec/instructions/instructions.h b/src/ql/pass/dec/instructions/include/ql/pass/dec/instructions/instructions.h similarity index 97% rename from include/ql/pass/dec/instructions/instructions.h rename to src/ql/pass/dec/instructions/include/ql/pass/dec/instructions/instructions.h index 253fccb94..a11ed661b 100644 --- a/include/ql/pass/dec/instructions/instructions.h +++ b/src/ql/pass/dec/instructions/include/ql/pass/dec/instructions/instructions.h @@ -16,6 +16,8 @@ namespace instructions { * Instruction decomposition pass. */ class DecomposeInstructionsPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/dec/instructions/instructions.cc b/src/ql/pass/dec/instructions/instructions.cc index 05e4cdaaa..eb51e5d1f 100644 --- a/src/ql/pass/dec/instructions/instructions.cc +++ b/src/ql/pass/dec/instructions/instructions.cc @@ -6,12 +6,15 @@ #include "ql/ir/old_to_new.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { namespace dec { namespace instructions { +bool DecomposeInstructionsPass::is_pass_registered = pmgr::Factory::register_pass("dec.Instructions"); + /** * Dumps docs for the instruction decomposer. */ diff --git a/src/ql/pass/dec/specialize/CMakeLists.txt b/src/ql/pass/dec/specialize/CMakeLists.txt new file mode 100644 index 000000000..0178676d5 --- /dev/null +++ b/src/ql/pass/dec/specialize/CMakeLists.txt @@ -0,0 +1,8 @@ +add_pass_library(pass_dec_specialize + "specialize.cc" +) + +target_include_directories(pass_dec_specialize PUBLIC include) +target_link_libraries(pass_dec_specialize PUBLIC com_dec) +target_link_libraries(pass_dec_specialize PUBLIC utils) +target_link_libraries(pass_dec_specialize PUBLIC pmgr) \ No newline at end of file diff --git a/include/ql/pass/dec/specialize/specialize.h b/src/ql/pass/dec/specialize/include/ql/pass/dec/specialize/specialize.h similarity index 97% rename from include/ql/pass/dec/specialize/specialize.h rename to src/ql/pass/dec/specialize/include/ql/pass/dec/specialize/specialize.h index 658bdfa7e..3b9c6a86c 100644 --- a/include/ql/pass/dec/specialize/specialize.h +++ b/src/ql/pass/dec/specialize/include/ql/pass/dec/specialize/specialize.h @@ -16,6 +16,8 @@ namespace specialize { * Instruction specialization pass. */ class SpecializeInstructionsPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/dec/specialize/specialize.cc b/src/ql/pass/dec/specialize/specialize.cc index ae404ff6b..72b4b8524 100644 --- a/src/ql/pass/dec/specialize/specialize.cc +++ b/src/ql/pass/dec/specialize/specialize.cc @@ -6,12 +6,15 @@ #include "ql/ir/ops.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { namespace dec { namespace specialize { +bool SpecializeInstructionsPass::is_pass_registered = pmgr::Factory::register_pass("dec.Specialize"); + /** * Dumps docs for the instruction specializer. */ diff --git a/src/ql/pass/dec/structure/CMakeLists.txt b/src/ql/pass/dec/structure/CMakeLists.txt new file mode 100644 index 000000000..ce7ac490d --- /dev/null +++ b/src/ql/pass/dec/structure/CMakeLists.txt @@ -0,0 +1,9 @@ +add_pass_library(pass_dec_structure + "structure.cc" +) + +target_include_directories(pass_dec_structure PUBLIC include) + +target_link_libraries(pass_dec_structure PRIVATE com_dec) +target_link_libraries(pass_dec_structure PRIVATE com_cfg) +target_link_libraries(pass_dec_structure PUBLIC pmgr) \ No newline at end of file diff --git a/include/ql/pass/dec/structure/structure.h b/src/ql/pass/dec/structure/include/ql/pass/dec/structure/structure.h similarity index 96% rename from include/ql/pass/dec/structure/structure.h rename to src/ql/pass/dec/structure/include/ql/pass/dec/structure/structure.h index a910d8d3b..c12a7e55e 100644 --- a/include/ql/pass/dec/structure/structure.h +++ b/src/ql/pass/dec/structure/include/ql/pass/dec/structure/structure.h @@ -16,6 +16,8 @@ namespace structure { * Structure decomposition pass. */ class DecomposeStructurePass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/dec/structure/structure.cc b/src/ql/pass/dec/structure/structure.cc index b853d4bf5..05405b0f9 100644 --- a/src/ql/pass/dec/structure/structure.cc +++ b/src/ql/pass/dec/structure/structure.cc @@ -10,12 +10,15 @@ #include "ql/com/cfg/consistency.h" #include "ql/com/cfg/dot.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { namespace dec { namespace structure { +bool DecomposeStructurePass::is_pass_registered = pmgr::Factory::register_pass("dec.Structure"); + /** * Dumps docs for the structure decomposer. */ diff --git a/src/ql/pass/io/CMakeLists.txt b/src/ql/pass/io/CMakeLists.txt new file mode 100644 index 000000000..7b6f59a9c --- /dev/null +++ b/src/ql/pass/io/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(cqasm) \ No newline at end of file diff --git a/src/ql/pass/io/cqasm/CMakeLists.txt b/src/ql/pass/io/cqasm/CMakeLists.txt new file mode 100644 index 000000000..f57c167e5 --- /dev/null +++ b/src/ql/pass/io/cqasm/CMakeLists.txt @@ -0,0 +1,9 @@ +add_pass_library(pass_io_cqasm + "read.cc" + "report.cc" +) + +target_include_directories(pass_io_cqasm PUBLIC include) + +target_link_libraries(pass_io_cqasm PUBLIC utils) +target_link_libraries(pass_io_cqasm PUBLIC pmgr) \ No newline at end of file diff --git a/include/ql/pass/io/cqasm/read.h b/src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/read.h similarity index 96% rename from include/ql/pass/io/cqasm/read.h rename to src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/read.h index b5e29e949..01a1c4706 100644 --- a/include/ql/pass/io/cqasm/read.h +++ b/src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/read.h @@ -19,6 +19,8 @@ namespace read { * cQASM reader pass. */ class ReadCQasmPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/include/ql/pass/io/cqasm/report.h b/src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/report.h similarity index 96% rename from include/ql/pass/io/cqasm/report.h rename to src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/report.h index 1eab1a10b..2b95abc8e 100644 --- a/include/ql/pass/io/cqasm/report.h +++ b/src/ql/pass/io/cqasm/include/ql/pass/io/cqasm/report.h @@ -18,6 +18,8 @@ namespace report { * cQASM writer pass. */ class ReportCQasmPass : public pmgr::pass_types::Analysis { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/io/cqasm/read.cc b/src/ql/pass/io/cqasm/read.cc index 0e4b7cd60..b612887b0 100644 --- a/src/ql/pass/io/cqasm/read.cc +++ b/src/ql/pass/io/cqasm/read.cc @@ -6,6 +6,7 @@ #include "ql/utils/filesystem.h" #include "ql/ir/cqasm/read.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -13,6 +14,8 @@ namespace io { namespace cqasm { namespace read { +bool ReadCQasmPass::is_pass_registered = pmgr::Factory::register_pass("io.cqasm.Read"); + /** * Dumps docs for the cQASM reader. */ diff --git a/src/ql/pass/io/cqasm/report.cc b/src/ql/pass/io/cqasm/report.cc index 99d076f92..6202b96bd 100644 --- a/src/ql/pass/io/cqasm/report.cc +++ b/src/ql/pass/io/cqasm/report.cc @@ -6,7 +6,7 @@ #include "ql/utils/filesystem.h" #include "ql/ir/cqasm/write.h" -#include "ql/pass/ana/statistics/report.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -14,6 +14,8 @@ namespace io { namespace cqasm { namespace report { +bool ReportCQasmPass::is_pass_registered = pmgr::Factory::register_pass("io.cqasm.Report"); + /** * Dumps docs for the cQASM writer. */ diff --git a/src/ql/pass/map/qubits/CMakeLists.txt b/src/ql/pass/map/qubits/CMakeLists.txt new file mode 100644 index 000000000..9eb62829a --- /dev/null +++ b/src/ql/pass/map/qubits/CMakeLists.txt @@ -0,0 +1,13 @@ +add_subdirectory(map) +add_subdirectory(place_mip) + +add_pass_library(pass_map_qubits + "initial_placement_algo.cc" +) + +target_include_directories(pass_map_qubits PUBLIC include) + +target_link_libraries(pass_map_qubits PUBLIC pmgr) +target_link_libraries(pass_map_qubits PUBLIC ir) +target_link_libraries(pass_map_qubits PUBLIC utils) +target_link_libraries(pass_map_qubits PUBLIC com) diff --git a/src/ql/pass/map/qubits/place_mip/detail/algorithm.h b/src/ql/pass/map/qubits/include/ql/pass/map/qubits/initial_placement_algo.h similarity index 98% rename from src/ql/pass/map/qubits/place_mip/detail/algorithm.h rename to src/ql/pass/map/qubits/include/ql/pass/map/qubits/initial_placement_algo.h index cec251f77..3d181103b 100644 --- a/src/ql/pass/map/qubits/place_mip/detail/algorithm.h +++ b/src/ql/pass/map/qubits/include/ql/pass/map/qubits/initial_placement_algo.h @@ -60,8 +60,6 @@ namespace ql { namespace pass { namespace map { namespace qubits { -namespace place_mip { -namespace detail { /** * Options structure for configuring the initial placement algorithm. @@ -131,7 +129,7 @@ std::ostream &operator<<(std::ostream &os, Result ipr); /** * Initial placement algorithm. */ -class Algorithm { +class InitialPlacementAlgo { private: /** @@ -216,8 +214,6 @@ class Algorithm { }; -} // namespace detail -} // namespace place } // namespace qubits } // namespace map } // namespace pass diff --git a/src/ql/pass/map/qubits/place_mip/detail/algorithm.cc b/src/ql/pass/map/qubits/initial_placement_algo.cc similarity index 98% rename from src/ql/pass/map/qubits/place_mip/detail/algorithm.cc rename to src/ql/pass/map/qubits/initial_placement_algo.cc index 819f107cd..2df7a18fd 100644 --- a/src/ql/pass/map/qubits/place_mip/detail/algorithm.cc +++ b/src/ql/pass/map/qubits/initial_placement_algo.cc @@ -2,7 +2,7 @@ * Initial placement engine. */ -#include "algorithm.h" +#include "ql/pass/map/qubits/initial_placement_algo.h" #ifdef INITIALPLACE @@ -18,8 +18,6 @@ namespace ql { namespace pass { namespace map { namespace qubits { -namespace place_mip { -namespace detail { using namespace lemon; using namespace utils; @@ -41,7 +39,7 @@ std::ostream &operator<<(std::ostream &os, Result ipr) { // find an initial placement of the virtual qubits for the given circuit // the resulting placement is put in the provided virt2real map // result indicates one of the result indicators (InitialPlaceResult, see above) -Result Algorithm::body(com::map::QubitMapping &v2r) { +Result InitialPlacementAlgo::body(com::map::QubitMapping &v2r) { QL_DOUT("InitialPlace.body ..."); // check validity of circuit @@ -424,7 +422,7 @@ Result Algorithm::body(com::map::QubitMapping &v2r) { * background, and even continues poking around on the stack of the main * thread! */ -Bool Algorithm::wrapper(com::map::QubitMapping &v2r) { +Bool InitialPlacementAlgo::wrapper(com::map::QubitMapping &v2r) { throw Exception( "Initial placement with timeout is disabled, because its current " "implementation is completely broken. On timeout, the entire process " @@ -494,7 +492,7 @@ Bool Algorithm::wrapper(com::map::QubitMapping &v2r) { // when it expires, result is set to ipr_timedout; // details of how this is accomplished, can be found above; // v2r is updated by PlaceBody/PlaceWrapper when it has found a mapping -Result Algorithm::run( +Result InitialPlacementAlgo::run( const ir::compat::KernelRef &k, const Options &opt, com::map::QubitMapping &v2r @@ -551,12 +549,10 @@ Result Algorithm::run( * Returns the amount of time taken by the mixed-integer-programming solver * for the call to run() in seconds. */ -utils::Real Algorithm::get_time_taken() const { +utils::Real InitialPlacementAlgo::get_time_taken() const { return time_taken; } -} // namespace detail -} // namespace place } // namespace qubits } // namespace map } // namespace pass diff --git a/src/ql/pass/map/qubits/map/CMakeLists.txt b/src/ql/pass/map/qubits/map/CMakeLists.txt new file mode 100644 index 000000000..fdb72fc69 --- /dev/null +++ b/src/ql/pass/map/qubits/map/CMakeLists.txt @@ -0,0 +1,21 @@ +add_pass_library(pass_map_qubits_map + "detail/options.cc" + "detail/free_cycle.cc" + "detail/past.cc" + "detail/alter.cc" + "detail/future.cc" + "detail/mapper.cc" + "map.cc" +) + +target_include_directories(pass_map_qubits_map PUBLIC include) + +target_link_libraries(pass_map_qubits_map PUBLIC pmgr) +target_link_libraries(pass_map_qubits_map PUBLIC rmgr) +target_link_libraries(pass_map_qubits_map PUBLIC utils) +target_link_libraries(pass_map_qubits_map PUBLIC com) +target_link_libraries(pass_map_qubits_map PUBLIC com_map) +target_link_libraries(pass_map_qubits_map PUBLIC pass_map_qubits) + +# FIXME: this dependency is a bit weird. Also there is another Scheduler class in com/sch. +target_link_libraries(pass_map_qubits_map PUBLIC pass_sch_schedule) diff --git a/src/ql/pass/map/qubits/map/detail/alter.cc b/src/ql/pass/map/qubits/map/detail/alter.cc index df04f74fa..ae00ff5c8 100644 --- a/src/ql/pass/map/qubits/map/detail/alter.cc +++ b/src/ql/pass/map/qubits/map/detail/alter.cc @@ -2,7 +2,7 @@ * Alter implementation. */ -#include "alter.h" +#include "ql/pass/map/qubits/map/detail/alter.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG diff --git a/src/ql/pass/map/qubits/map/detail/free_cycle.cc b/src/ql/pass/map/qubits/map/detail/free_cycle.cc index a4abeb78b..95b9784e4 100644 --- a/src/ql/pass/map/qubits/map/detail/free_cycle.cc +++ b/src/ql/pass/map/qubits/map/detail/free_cycle.cc @@ -2,7 +2,7 @@ * FreeCycle implementation. */ -#include "free_cycle.h" +#include "ql/pass/map/qubits/map/detail/free_cycle.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG diff --git a/src/ql/pass/map/qubits/map/detail/future.cc b/src/ql/pass/map/qubits/map/detail/future.cc index 26379aa51..07bdce4ea 100644 --- a/src/ql/pass/map/qubits/map/detail/future.cc +++ b/src/ql/pass/map/qubits/map/detail/future.cc @@ -2,7 +2,7 @@ * Future implementation. */ -#include "future.h" +#include "ql/pass/map/qubits/map/detail/future.h" #include "ql/utils/filesystem.h" diff --git a/src/ql/pass/map/qubits/map/detail/mapper.cc b/src/ql/pass/map/qubits/map/detail/mapper.cc index f9e2c4a61..830189838 100644 --- a/src/ql/pass/map/qubits/map/detail/mapper.cc +++ b/src/ql/pass/map/qubits/map/detail/mapper.cc @@ -2,12 +2,12 @@ * OpenQL virtual to real qubit mapping and routing. */ -#include "mapper.h" +#include "ql/pass/map/qubits/map/detail/mapper.h" #include #include "ql/utils/filesystem.h" -#include "ql/pass/ana/statistics/annotations.h" -#include "ql/pass/map/qubits/place_mip/detail/algorithm.h" +#include "ql/ir/annotations.h" +#include "ql/pass/map/qubits/initial_placement_algo.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG @@ -891,7 +891,7 @@ void Mapper::place(const ir::compat::KernelRef &k, com::map::QubitMapping &v2r) ipopt.horizon = options->mip_horizon; ipopt.timeout = options->mip_timeout; - place_mip::detail::Algorithm ip; + InitialPlacementAlgo ip; auto ipok = ip.run(k, ipopt, v2r); // compute mapping (in v2r) using ip model, may fail QL_DOUT("InitialPlace: kernel=" << k->name << " timeout=" << options->mip_timeout << " horizon=" << options->mip_horizon << " result=" << ipok << " iptimetaken=" << ip.get_time_taken() << " seconds [DONE]"); #else // ifdef INITIALPLACE @@ -1107,7 +1107,7 @@ void Mapper::map_kernel(const ir::compat::KernelRef &k) { void Mapper::map(const ir::compat::ProgramRef &prog, const OptionsRef &opt) { // Shorthand. - using pass::ana::statistics::AdditionalStats; + using AdditionalStats = ir::AdditionalStats; // Perform program-wide initialization. initialize(prog->platform, opt); diff --git a/src/ql/pass/map/qubits/map/detail/options.cc b/src/ql/pass/map/qubits/map/detail/options.cc index e4b421908..56cf1b077 100644 --- a/src/ql/pass/map/qubits/map/detail/options.cc +++ b/src/ql/pass/map/qubits/map/detail/options.cc @@ -2,7 +2,7 @@ * Defines the parsed options structures for the mapper. */ -#include "options.h" +#include "ql/pass/map/qubits/map/detail/options.h" namespace ql { namespace pass { diff --git a/src/ql/pass/map/qubits/map/detail/past.cc b/src/ql/pass/map/qubits/map/detail/past.cc index 4d0b59bbc..cac51cf72 100644 --- a/src/ql/pass/map/qubits/map/detail/past.cc +++ b/src/ql/pass/map/qubits/map/detail/past.cc @@ -2,10 +2,9 @@ * Past implementation. */ -#include "past.h" +#include "ql/pass/map/qubits/map/detail/past.h" #include "ql/utils/filesystem.h" -#include "ql/pass/map/qubits/place_mip/detail/algorithm.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG diff --git a/src/ql/pass/map/qubits/map/detail/alter.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/alter.h similarity index 98% rename from src/ql/pass/map/qubits/map/detail/alter.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/alter.h index 655c01d40..e2ef6a011 100644 --- a/src/ql/pass/map/qubits/map/detail/alter.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/alter.h @@ -10,9 +10,9 @@ #include "ql/utils/list.h" #include "ql/ir/compat/compat.h" #include "ql/rmgr/manager.h" -#include "options.h" -#include "free_cycle.h" -#include "past.h" +#include "ql/pass/map/qubits/map/detail/options.h" +#include "ql/pass/map/qubits/map/detail/free_cycle.h" +#include "ql/pass/map/qubits/map/detail/past.h" namespace ql { namespace pass { diff --git a/src/ql/pass/map/qubits/map/detail/free_cycle.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/free_cycle.h similarity index 99% rename from src/ql/pass/map/qubits/map/detail/free_cycle.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/free_cycle.h index 8eacb7b6a..244278ea6 100644 --- a/src/ql/pass/map/qubits/map/detail/free_cycle.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/free_cycle.h @@ -11,7 +11,7 @@ #include "ql/ir/compat/compat.h" #include "ql/rmgr/manager.h" #include "ql/com/map/qubit_mapping.h" -#include "options.h" +#include "ql/pass/map/qubits/map/detail/options.h" namespace ql { namespace pass { diff --git a/src/ql/pass/map/qubits/map/detail/future.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/future.h similarity index 97% rename from src/ql/pass/map/qubits/map/detail/future.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/future.h index 3d84ac3fc..33cd8b77f 100644 --- a/src/ql/pass/map/qubits/map/detail/future.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/future.h @@ -12,9 +12,9 @@ #include "ql/utils/list.h" #include "ql/ir/compat/compat.h" #include "ql/pass/sch/schedule/detail/scheduler.h" -#include "options.h" -#include "past.h" -#include "alter.h" +#include "ql/pass/map/qubits/map/detail/options.h" +#include "ql/pass/map/qubits/map/detail/past.h" +#include "ql/pass/map/qubits/map/detail/alter.h" namespace ql { namespace pass { diff --git a/src/ql/pass/map/qubits/map/detail/mapper.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/mapper.h similarity index 98% rename from src/ql/pass/map/qubits/map/detail/mapper.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/mapper.h index ab84df62a..381041cdf 100644 --- a/src/ql/pass/map/qubits/map/detail/mapper.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/mapper.h @@ -13,11 +13,11 @@ #include "ql/utils/progress.h" #include "ql/ir/compat/compat.h" #include "ql/com/map/qubit_mapping.h" -#include "options.h" -#include "free_cycle.h" -#include "past.h" -#include "alter.h" -#include "future.h" +#include "ql/pass/map/qubits/map/detail/options.h" +#include "ql/pass/map/qubits/map/detail/free_cycle.h" +#include "ql/pass/map/qubits/map/detail/past.h" +#include "ql/pass/map/qubits/map/detail/alter.h" +#include "ql/pass/map/qubits/map/detail/future.h" namespace ql { namespace pass { diff --git a/src/ql/pass/map/qubits/map/detail/options.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/options.h similarity index 100% rename from src/ql/pass/map/qubits/map/detail/options.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/options.h diff --git a/src/ql/pass/map/qubits/map/detail/past.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/past.h similarity index 99% rename from src/ql/pass/map/qubits/map/detail/past.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/past.h index b7228f6f6..957c55df4 100644 --- a/src/ql/pass/map/qubits/map/detail/past.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/detail/past.h @@ -11,8 +11,8 @@ #include "ql/utils/vec.h" #include "ql/ir/compat/compat.h" #include "ql/com/map/qubit_mapping.h" -#include "options.h" -#include "free_cycle.h" +#include "ql/pass/map/qubits/map/detail/options.h" +#include "ql/pass/map/qubits/map/detail/free_cycle.h" namespace ql { namespace pass { diff --git a/include/ql/pass/map/qubits/map/map.h b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/map.h similarity index 97% rename from include/ql/pass/map/qubits/map/map.h rename to src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/map.h index a8a328594..242627abc 100644 --- a/include/ql/pass/map/qubits/map/map.h +++ b/src/ql/pass/map/qubits/map/include/ql/pass/map/qubits/map/map.h @@ -22,6 +22,8 @@ struct Options; * Qubit mapper pass. */ class MapQubitsPass : public pmgr::pass_types::ProgramTransformation { + static bool is_pass_registered; + private: /** diff --git a/src/ql/pass/map/qubits/map/map.cc b/src/ql/pass/map/qubits/map/map.cc index 1bdae6ddb..b5697f2da 100644 --- a/src/ql/pass/map/qubits/map/map.cc +++ b/src/ql/pass/map/qubits/map/map.cc @@ -4,7 +4,8 @@ #include "ql/pass/map/qubits/map/map.h" -#include "detail/mapper.h" +#include "ql/pass/map/qubits/map/detail/mapper.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -12,6 +13,8 @@ namespace map { namespace qubits { namespace map { +bool MapQubitsPass::is_pass_registered = pmgr::Factory::register_pass("map.qubits.Map"); + /** * Dumps docs for the qubit mapper. */ diff --git a/src/ql/pass/map/qubits/place_mip/CMakeLists.txt b/src/ql/pass/map/qubits/place_mip/CMakeLists.txt new file mode 100644 index 000000000..1722c1a3c --- /dev/null +++ b/src/ql/pass/map/qubits/place_mip/CMakeLists.txt @@ -0,0 +1,11 @@ +add_pass_library(pass_map_qubits_place_mip + "place_mip.cc" +) + +target_include_directories(pass_map_qubits_place_mip PUBLIC include) + +target_link_libraries(pass_map_qubits_place_mip PUBLIC pmgr) +target_link_libraries(pass_map_qubits_place_mip PUBLIC ir) +target_link_libraries(pass_map_qubits_place_mip PUBLIC utils) +target_link_libraries(pass_map_qubits_place_mip PUBLIC com) +target_link_libraries(pass_map_qubits_place_mip PUBLIC pass_map_qubits) diff --git a/include/ql/pass/map/qubits/place_mip/place_mip.h b/src/ql/pass/map/qubits/place_mip/include/ql/pass/map/qubits/place_mip/place_mip.h similarity index 97% rename from include/ql/pass/map/qubits/place_mip/place_mip.h rename to src/ql/pass/map/qubits/place_mip/include/ql/pass/map/qubits/place_mip/place_mip.h index bb9da97df..4706d2c6b 100644 --- a/include/ql/pass/map/qubits/place_mip/place_mip.h +++ b/src/ql/pass/map/qubits/place_mip/include/ql/pass/map/qubits/place_mip/place_mip.h @@ -17,6 +17,8 @@ namespace place_mip { * Initial qubit placer pass. */ class PlaceQubitsPass : public pmgr::pass_types::KernelTransformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/map/qubits/place_mip/place_mip.cc b/src/ql/pass/map/qubits/place_mip/place_mip.cc index f92021178..fee34a583 100644 --- a/src/ql/pass/map/qubits/place_mip/place_mip.cc +++ b/src/ql/pass/map/qubits/place_mip/place_mip.cc @@ -4,8 +4,9 @@ #include "ql/pass/map/qubits/place_mip/place_mip.h" -#include "ql/pass/ana/statistics/annotations.h" -#include "detail/algorithm.h" +#include "ql/ir/annotations.h" +#include "ql/pass/map/qubits/initial_placement_algo.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -13,6 +14,8 @@ namespace map { namespace qubits { namespace place_mip { +bool PlaceQubitsPass::is_pass_registered = pmgr::Factory::register_pass("map.qubits.PlaceMIP"); + /** * Dumps docs for the initial qubit placer. */ @@ -118,7 +121,7 @@ utils::Int PlaceQubitsPass::run( // Run the algorithm. com::map::QubitMapping mapping(kernel->platform->qubit_count, true); - detail::Algorithm algorithm; + InitialPlacementAlgo algorithm; auto result = algorithm.run(kernel, opts, mapping); // Save the results as statistics. diff --git a/src/ql/pass/opt/CMakeLists.txt b/src/ql/pass/opt/CMakeLists.txt new file mode 100644 index 000000000..29b334348 --- /dev/null +++ b/src/ql/pass/opt/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(clifford) +add_subdirectory(const_prop) +add_subdirectory(dead_code_elim) \ No newline at end of file diff --git a/src/ql/pass/opt/clifford/CMakeLists.txt b/src/ql/pass/opt/clifford/CMakeLists.txt new file mode 100644 index 000000000..bfce2cfe5 --- /dev/null +++ b/src/ql/pass/opt/clifford/CMakeLists.txt @@ -0,0 +1,10 @@ +add_pass_library(pass_opt_clifford + "detail/clifford.cc" + "optimize.cc" +) + +target_include_directories(pass_opt_clifford PUBLIC include) + +target_link_libraries(pass_opt_clifford PUBLIC utils) +target_link_libraries(pass_opt_clifford PUBLIC pmgr) +target_link_libraries(pass_opt_clifford PRIVATE ir) \ No newline at end of file diff --git a/src/ql/pass/opt/clifford/detail/clifford.cc b/src/ql/pass/opt/clifford/detail/clifford.cc index 16f7dd707..200455f8c 100644 --- a/src/ql/pass/opt/clifford/detail/clifford.cc +++ b/src/ql/pass/opt/clifford/detail/clifford.cc @@ -2,7 +2,7 @@ * Clifford sequence optimizer. */ -#include "clifford.h" +#include "ql/pass/opt/clifford/detail/clifford.h" #include "ql/utils/num.h" #include "ql/com/options.h" diff --git a/src/ql/pass/opt/clifford/detail/clifford.h b/src/ql/pass/opt/clifford/include/ql/pass/opt/clifford/detail/clifford.h similarity index 100% rename from src/ql/pass/opt/clifford/detail/clifford.h rename to src/ql/pass/opt/clifford/include/ql/pass/opt/clifford/detail/clifford.h diff --git a/include/ql/pass/opt/clifford/optimize.h b/src/ql/pass/opt/clifford/include/ql/pass/opt/clifford/optimize.h similarity index 84% rename from include/ql/pass/opt/clifford/optimize.h rename to src/ql/pass/opt/clifford/include/ql/pass/opt/clifford/optimize.h index 6e57422cb..77936e0e7 100644 --- a/include/ql/pass/opt/clifford/optimize.h +++ b/src/ql/pass/opt/clifford/include/ql/pass/opt/clifford/optimize.h @@ -12,20 +12,14 @@ namespace opt { namespace clifford { namespace optimize { -/** - * Clifford sequence optimizer. - * FIXME JvS: remove; only used by old pass manager - */ -void clifford_optimize( - const ir::compat::ProgramRef &programp, - const ir::compat::PlatformRef &platform, - const utils::Str &passname -); - /** * Clifford optimizer pass. */ class CliffordOptimizePass : public pmgr::pass_types::KernelTransformation { + static bool is_pass_registered; + +using X = pmgr::pass_types::KernelTransformation; + protected: /** diff --git a/src/ql/pass/opt/clifford/optimize.cc b/src/ql/pass/opt/clifford/optimize.cc index 599e6760f..69f138c5f 100644 --- a/src/ql/pass/opt/clifford/optimize.cc +++ b/src/ql/pass/opt/clifford/optimize.cc @@ -5,8 +5,9 @@ #include "ql/pass/opt/clifford/optimize.h" #include "ql/pmgr/pass_types/base.h" -#include "ql/pass/ana/statistics/annotations.h" -#include "detail/clifford.h" +#include "ql/ir/annotations.h" +#include "ql/pass/opt/clifford/detail/clifford.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -14,6 +15,8 @@ namespace opt { namespace clifford { namespace optimize { +bool CliffordOptimizePass::is_pass_registered = pmgr::Factory::register_pass("opt.clifford.Optimize"); + /** * Dumps docs for the Clifford optimizer. */ @@ -58,7 +61,7 @@ utils::Int CliffordOptimizePass::run( const pmgr::pass_types::Context &context ) const { auto cycles_saved = detail::Clifford().optimize_kernel(kernel); - ana::statistics::AdditionalStats::push( + ir::AdditionalStats::push( kernel, utils::to_string(cycles_saved) + " cycles saved by " + context.full_pass_name ); diff --git a/src/ql/pass/opt/clifford/tests/clifford.cc b/src/ql/pass/opt/clifford/tests/clifford.cc new file mode 100644 index 000000000..016bc5483 --- /dev/null +++ b/src/ql/pass/opt/clifford/tests/clifford.cc @@ -0,0 +1,32 @@ +#include "ql/pass/testsupport/passtest.h" +#include "ql/pass/opt/clifford/optimize.h" + + +namespace ql { +namespace pass { + +using CliffordOptimizePass = pass::opt::clifford::optimize::CliffordOptimizePass; +class CliffordOptimizePassTest : public PassTest {}; + +TEST_F(CliffordOptimizePassTest, EmptyProgram) { + EXPECT_EQ(run(), 0); + EXPECT_TRUE(kernel->gates.empty()); +} + +TEST_F(CliffordOptimizePassTest, SingleHadamardGate) { + kernel->hadamard(0); + EXPECT_EQ(run(), 0); + + checkGates({"ry90 q[0]", "x q[0]"}); +} + +TEST_F(CliffordOptimizePassTest, DoubleHadamardGate) { + kernel->hadamard(0); + kernel->hadamard(0); + EXPECT_EQ(run(), 0); + + checkGates({}); +} + +} // namespace pass +} // namespace ql \ No newline at end of file diff --git a/src/ql/pass/opt/const_prop/CMakeLists.txt b/src/ql/pass/opt/const_prop/CMakeLists.txt new file mode 100644 index 000000000..ad3b2ba9e --- /dev/null +++ b/src/ql/pass/opt/const_prop/CMakeLists.txt @@ -0,0 +1,10 @@ +add_pass_library(pass_opt_const_prop + "detail/propagate.cc" + "const_prop.cc" +) + +target_include_directories(pass_opt_const_prop PUBLIC include) + +target_link_libraries(pass_opt_const_prop PUBLIC utils) +target_link_libraries(pass_opt_const_prop PUBLIC pmgr) +target_link_libraries(pass_opt_const_prop PRIVATE ir) \ No newline at end of file diff --git a/src/ql/pass/opt/const_prop/const_prop.cc b/src/ql/pass/opt/const_prop/const_prop.cc index 53791a913..e960e576d 100644 --- a/src/ql/pass/opt/const_prop/const_prop.cc +++ b/src/ql/pass/opt/const_prop/const_prop.cc @@ -3,9 +3,10 @@ */ #include "ql/pass/opt/const_prop/const_prop.h" -#include "detail/propagate.h" +#include "ql/pass/opt/const_prop/detail/propagate.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { @@ -45,6 +46,8 @@ utils::Int ConstantPropagationPass::run( return 0; } +bool ConstantPropagationPass::is_pass_registered = pmgr::Factory::register_pass("opt.ConstProp"); + /** * Dumps docs for constant propagation pass. */ diff --git a/src/ql/pass/opt/const_prop/detail/propagate.cc b/src/ql/pass/opt/const_prop/detail/propagate.cc index 54f9978d6..c517b6639 100644 --- a/src/ql/pass/opt/const_prop/detail/propagate.cc +++ b/src/ql/pass/opt/const_prop/detail/propagate.cc @@ -4,8 +4,8 @@ #define DEBUG(x) QL_DOUT(x) -#include "propagate.h" -#include "platform_functions.h" +#include "ql/pass/opt/const_prop/detail/propagate.h" +#include "ql/pass/opt/const_prop/detail/platform_functions.h" #include "ql/ir/describe.h" #include "ql/ir/ops.h" diff --git a/include/ql/pass/opt/const_prop/const_prop.h b/src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/const_prop.h similarity index 96% rename from include/ql/pass/opt/const_prop/const_prop.h rename to src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/const_prop.h index 3a18e8d29..8c9e640bc 100644 --- a/include/ql/pass/opt/const_prop/const_prop.h +++ b/src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/const_prop.h @@ -15,6 +15,8 @@ namespace const_prop { * Constant propagation pass. */ class ConstantPropagationPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + public: /** diff --git a/src/ql/pass/opt/const_prop/detail/platform_functions.h b/src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/detail/platform_functions.h similarity index 100% rename from src/ql/pass/opt/const_prop/detail/platform_functions.h rename to src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/detail/platform_functions.h diff --git a/src/ql/pass/opt/const_prop/detail/propagate.h b/src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/detail/propagate.h similarity index 100% rename from src/ql/pass/opt/const_prop/detail/propagate.h rename to src/ql/pass/opt/const_prop/include/ql/pass/opt/const_prop/detail/propagate.h diff --git a/src/ql/pass/opt/dead_code_elim/CMakeLists.txt b/src/ql/pass/opt/dead_code_elim/CMakeLists.txt new file mode 100644 index 000000000..d5d571702 --- /dev/null +++ b/src/ql/pass/opt/dead_code_elim/CMakeLists.txt @@ -0,0 +1,9 @@ +add_pass_library(pass_opt_dead_code_elim + "dead_code_elim.cc" +) + +target_include_directories(pass_opt_dead_code_elim PUBLIC include) + +target_link_libraries(pass_opt_dead_code_elim PUBLIC utils) +target_link_libraries(pass_opt_dead_code_elim PUBLIC pmgr) +target_link_libraries(pass_opt_dead_code_elim PRIVATE ir) \ No newline at end of file diff --git a/src/ql/pass/opt/dead_code_elim/dead_code_elim.cc b/src/ql/pass/opt/dead_code_elim/dead_code_elim.cc index 914369979..d0a8be544 100644 --- a/src/ql/pass/opt/dead_code_elim/dead_code_elim.cc +++ b/src/ql/pass/opt/dead_code_elim/dead_code_elim.cc @@ -6,6 +6,7 @@ #include "ql/pmgr/pass_types/base.h" #include "ql/ir/describe.h" +#include "ql/pmgr/factory.h" #define DEBUG(x) QL_DOUT(x) @@ -160,6 +161,8 @@ utils::Int DeadCodeEliminationPass::run( return 0; } +bool DeadCodeEliminationPass::is_pass_registered = pmgr::Factory::register_pass("opt.DeadCodeElim"); + /** * Dumps docs for dead code elimination pass. */ diff --git a/include/ql/pass/opt/dead_code_elim/dead_code_elim.h b/src/ql/pass/opt/dead_code_elim/include/ql/pass/opt/dead_code_elim/dead_code_elim.h similarity index 97% rename from include/ql/pass/opt/dead_code_elim/dead_code_elim.h rename to src/ql/pass/opt/dead_code_elim/include/ql/pass/opt/dead_code_elim/dead_code_elim.h index 5d2cf1f3b..81e668b98 100644 --- a/include/ql/pass/opt/dead_code_elim/dead_code_elim.h +++ b/src/ql/pass/opt/dead_code_elim/include/ql/pass/opt/dead_code_elim/dead_code_elim.h @@ -15,6 +15,8 @@ namespace dead_code_elim { * Dead code elimination pass. */ class DeadCodeEliminationPass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + public: /** diff --git a/src/ql/pass/sch/CMakeLists.txt b/src/ql/pass/sch/CMakeLists.txt new file mode 100644 index 000000000..6a91874f8 --- /dev/null +++ b/src/ql/pass/sch/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(schedule) +add_subdirectory(list_schedule) \ No newline at end of file diff --git a/src/ql/pass/sch/list_schedule/CMakeLists.txt b/src/ql/pass/sch/list_schedule/CMakeLists.txt new file mode 100644 index 000000000..92ab16c09 --- /dev/null +++ b/src/ql/pass/sch/list_schedule/CMakeLists.txt @@ -0,0 +1,10 @@ +add_pass_library(pass_sch_list_schedule + "list_schedule.cc" +) + +target_include_directories(pass_sch_list_schedule PUBLIC include) + +target_link_libraries(pass_sch_list_schedule PUBLIC pmgr) +target_link_libraries(pass_sch_list_schedule PRIVATE ir) +target_link_libraries(pass_sch_list_schedule PRIVATE com_ddg) +target_link_libraries(pass_sch_list_schedule PRIVATE com_sch) \ No newline at end of file diff --git a/include/ql/pass/sch/list_schedule/list_schedule.h b/src/ql/pass/sch/list_schedule/include/ql/pass/sch/list_schedule/list_schedule.h similarity index 97% rename from include/ql/pass/sch/list_schedule/list_schedule.h rename to src/ql/pass/sch/list_schedule/include/ql/pass/sch/list_schedule/list_schedule.h index a4325b8e5..ac98b84fc 100644 --- a/include/ql/pass/sch/list_schedule/list_schedule.h +++ b/src/ql/pass/sch/list_schedule/include/ql/pass/sch/list_schedule/list_schedule.h @@ -15,6 +15,8 @@ namespace list_schedule { * Scheduler pass. */ class ListSchedulePass : public pmgr::pass_types::Transformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/sch/list_schedule/list_schedule.cc b/src/ql/pass/sch/list_schedule/list_schedule.cc index 0fd205847..069f670d1 100644 --- a/src/ql/pass/sch/list_schedule/list_schedule.cc +++ b/src/ql/pass/sch/list_schedule/list_schedule.cc @@ -11,6 +11,7 @@ #include "ql/com/ddg/dot.h" #include "ql/com/sch/scheduler.h" #include "ql/pmgr/pass_types/base.h" +#include "ql/pmgr/factory.h" // uncomment next line to enable multi-line dumping // #define MULTI_LINE_LOG_DEBUG @@ -20,6 +21,8 @@ namespace pass { namespace sch { namespace list_schedule { +bool ListSchedulePass::is_pass_registered = pmgr::Factory::register_pass("sch.ListSchedule"); + /** * Dumps docs for the scheduler. */ diff --git a/src/ql/pass/sch/schedule/CMakeLists.txt b/src/ql/pass/sch/schedule/CMakeLists.txt new file mode 100644 index 000000000..bb4b37257 --- /dev/null +++ b/src/ql/pass/sch/schedule/CMakeLists.txt @@ -0,0 +1,13 @@ +add_pass_library(pass_sch_schedule + "detail/scheduler.cc" + "schedule.cc" +) + +target_include_directories(pass_sch_schedule PUBLIC include) + +target_link_libraries(pass_sch_schedule PUBLIC pmgr) +target_link_libraries(pass_sch_schedule PUBLIC rmgr) +target_link_libraries(pass_sch_schedule PUBLIC utils) +target_link_libraries(pass_sch_schedule PUBLIC com) + +target_link_libraries(pass_sch_schedule PUBLIC lemon) \ No newline at end of file diff --git a/src/ql/pass/sch/schedule/detail/scheduler.cc b/src/ql/pass/sch/schedule/detail/scheduler.cc index 3d58d403f..a4ee275c7 100644 --- a/src/ql/pass/sch/schedule/detail/scheduler.cc +++ b/src/ql/pass/sch/schedule/detail/scheduler.cc @@ -84,7 +84,7 @@ * "scheduler_commute". */ -#include "scheduler.h" +#include "ql/pass/sch/schedule/detail/scheduler.h" #include "ql/utils/vec.h" #include "ql/utils/filesystem.h" diff --git a/src/ql/pass/sch/schedule/detail/scheduler.h b/src/ql/pass/sch/schedule/include/ql/pass/sch/schedule/detail/scheduler.h similarity index 100% rename from src/ql/pass/sch/schedule/detail/scheduler.h rename to src/ql/pass/sch/schedule/include/ql/pass/sch/schedule/detail/scheduler.h diff --git a/include/ql/pass/sch/schedule/schedule.h b/src/ql/pass/sch/schedule/include/ql/pass/sch/schedule/schedule.h similarity index 96% rename from include/ql/pass/sch/schedule/schedule.h rename to src/ql/pass/sch/schedule/include/ql/pass/sch/schedule/schedule.h index a2f016047..b46730a6b 100644 --- a/include/ql/pass/sch/schedule/schedule.h +++ b/src/ql/pass/sch/schedule/include/ql/pass/sch/schedule/schedule.h @@ -16,6 +16,8 @@ namespace schedule { * Scheduler pass. */ class SchedulePass : public pmgr::pass_types::KernelTransformation { + static bool is_pass_registered; + protected: /** diff --git a/src/ql/pass/sch/schedule/schedule.cc b/src/ql/pass/sch/schedule/schedule.cc index 5ac654b24..9068cc338 100644 --- a/src/ql/pass/sch/schedule/schedule.cc +++ b/src/ql/pass/sch/schedule/schedule.cc @@ -6,13 +6,16 @@ #include "ql/utils/filesystem.h" #include "ql/pmgr/pass_types/base.h" -#include "detail/scheduler.h" +#include "ql/pass/sch/schedule/detail/scheduler.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pass { namespace sch { namespace schedule { +bool SchedulePass::is_pass_registered = pmgr::Factory::register_pass("sch.Schedule"); + /** * Dumps docs for the scheduler. */ diff --git a/src/ql/pass/testsupport.h b/src/ql/pass/testsupport.h new file mode 100644 index 000000000..dbf8afcfd --- /dev/null +++ b/src/ql/pass/testsupport.h @@ -0,0 +1,49 @@ +#include "gtest/gtest.h" +#include "ql/utils/ptr.h" +#include "ql/utils/logger.h" +#include "ql/pmgr/factory.h" +#include "ql/ir/compat/program.h" +#include "ql/ir/compat/platform.h" + +// fixme: should not be exposed in the public API + +namespace ql { +namespace pass { + + +template +class PassTest : public ::testing::Test { +private: + Pass victim{utils::Ptr(), "TestInstance", "TestType"}; + + ir::compat::PlatformRef platform = ir::compat::Platform::build("TestPlatform", utils::Str("cc_light")); + ir::compat::ProgramRef program = utils::make("TestProgram", platform, 7, 32, 10); + utils::Options options{}; + pmgr::pass_types::Context context{"TestPass", "TestOutputPrefix", options}; + const utils::UInt numberQubits = 5; + +public: + void checkGates(std::initializer_list expectedGates) { + + //fixme: in .cc file + ASSERT_EQ(expectedGates.size(), kernel->gates.size()); + + utils::UInt index = 0; + for (auto& expectedGate: expectedGates) { + EXPECT_EQ(expectedGate, kernel->gates[index]->qasm()); + ++index; + } + }; + + ir::compat::KernelRef kernel = utils::make( + "TestKernel", + platform, + numberQubits); + + utils::Int run() { + return victim.run(program, kernel, context); + } +}; + +} // namespace pass +} // namespace ql \ No newline at end of file diff --git a/src/ql/pmgr/CMakeCache.txt b/src/ql/pmgr/CMakeCache.txt new file mode 100644 index 000000000..a99c139f5 --- /dev/null +++ b/src/ql/pmgr/CMakeCache.txt @@ -0,0 +1,396 @@ +# This is the CMakeCache file. +# For build in directory: /home/plehenaff/OpenQL/src/ql/pmgr +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//For backwards compatibility, what version of CMake commands and +// syntax should this version of CMake try to support. +CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4 + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:STRING=/usr/bin/clang++ + +//LLVM archiver +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/llvm-ar-14 + +//Generate index for LLVM archive +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/llvm-ranlib-14 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//No help, variable specified on the command line. +CMAKE_EXPORT_COMPILE_COMMANDS:UNINITIALIZED=1 + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=Project + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Single output directory for building all executables. +EXECUTABLE_OUTPUT_PATH:PATH= + +//Single output directory for building all libraries. +LIBRARY_OUTPUT_PATH:PATH= + +//No help, variable specified on the command line. +OPENQL_BUILD_TESTS:UNINITIALIZED==ON + +//Value Computed by CMake +Project_BINARY_DIR:STATIC=/home/plehenaff/OpenQL/src/ql/pmgr + +//Value Computed by CMake +Project_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +Project_SOURCE_DIR:STATIC=/home/plehenaff/OpenQL/src/ql + +//Dependencies for the target +arch_LIB_DEPENDS:STATIC=general;utils;general;ir_compat;general;pmgr; + +//Dependencies for the target +arch_cc_pass_gen_vq1asm_LIB_DEPENDS:STATIC=general;ir;general;utils; + +//Dependencies for the target +com_LIB_DEPENDS:STATIC=general;utils; + +//Dependencies for the target +com_dec_LIB_DEPENDS:STATIC=general;utils;general;ir; + +//Dependencies for the target +ir_compat_LIB_DEPENDS:STATIC=general;utils;general;com;general;arch; + +//Dependencies for the target +ir_cqasm_LIB_DEPENDS:STATIC=general;utils;general;ir; + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/plehenaff/OpenQL/src/ql/pmgr +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=22 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/plehenaff/OpenQL/src/ql +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=11 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCCompiler.cmake b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCCompiler.cmake new file mode 100644 index 000000000..d7dc955c0 --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCCompiler.cmake @@ -0,0 +1,72 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "11.2.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake new file mode 100644 index 000000000..4dee35217 --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake @@ -0,0 +1,83 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "Clang") +set(CMAKE_CXX_COMPILER_VERSION "14.0.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/llvm-ar-14") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/llvm-ranlib-14") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX ) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/llvm-14/lib/clang/14.0.0/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/usr/lib/llvm-14/lib;/lib;/usr/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 000000000..b7f3a7d72 Binary files /dev/null and b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin differ diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 000000000..722293a7a Binary files /dev/null and b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CMakeSystem.cmake b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeSystem.cmake new file mode 100644 index 000000000..380529b0a --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/3.22.1/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-4.18.0-372.19.1.el8_6.x86_64") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "4.18.0-372.19.1.el8_6.x86_64") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-4.18.0-372.19.1.el8_6.x86_64") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "4.18.0-372.19.1.el8_6.x86_64") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 000000000..41b99d778 --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,803 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/a.out b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/a.out new file mode 100755 index 000000000..b538d9c3c Binary files /dev/null and b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdC/a.out differ diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 000000000..25c62a8c3 --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,791 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/a.out b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/a.out new file mode 100755 index 000000000..575152b32 Binary files /dev/null and b/src/ql/pmgr/CMakeFiles/3.22.1/CompilerIdCXX/a.out differ diff --git a/src/ql/pmgr/CMakeFiles/cmake.check_cache b/src/ql/pmgr/CMakeFiles/cmake.check_cache new file mode 100644 index 000000000..3dccd7317 --- /dev/null +++ b/src/ql/pmgr/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/src/ql/pmgr/CMakeLists.txt b/src/ql/pmgr/CMakeLists.txt new file mode 100644 index 000000000..339eddf72 --- /dev/null +++ b/src/ql/pmgr/CMakeLists.txt @@ -0,0 +1,15 @@ +add_library(pmgr + "group.cc" + "factory.cc" + "manager.cc" + "condition.cc" + "pass_types/base.cc" + "pass_types/specializations.cc" +) + +target_include_directories(pmgr PUBLIC include) + +target_link_libraries(pmgr PUBLIC utils) +target_link_libraries(pmgr PUBLIC ir) +target_link_libraries(pmgr PUBLIC ir_cqasm) +target_link_libraries(pmgr PUBLIC ir_compat) \ No newline at end of file diff --git a/src/ql/pmgr/factory.cc b/src/ql/pmgr/factory.cc index 39a336b1b..79e52f305 100644 --- a/src/ql/pmgr/factory.cc +++ b/src/ql/pmgr/factory.cc @@ -6,29 +6,6 @@ #include "ql/utils/pair.h" #include "ql/pmgr/group.h" - -// Pass definition headers. This list should be generated at some point. -#include "ql/pass/ana/visualize/circuit.h" -#include "ql/pass/ana/visualize/interaction.h" -#include "ql/pass/ana/visualize/mapping.h" -#include "ql/pass/ana/statistics/clean.h" -#include "ql/pass/ana/statistics/report.h" -#include "ql/pass/io/cqasm/read.h" -#include "ql/pass/io/cqasm/report.h" -#include "ql/pass/dec/instructions/instructions.h" -#include "ql/pass/dec/generalize/generalize.h" -#include "ql/pass/dec/specialize/specialize.h" -#include "ql/pass/dec/structure/structure.h" -#include "ql/pass/opt/clifford/optimize.h" -#include "ql/pass/opt/const_prop/const_prop.h" -#include "ql/pass/opt/dead_code_elim/dead_code_elim.h" -#include "ql/pass/sch/schedule/schedule.h" -#include "ql/pass/sch/list_schedule/list_schedule.h" -//#include "ql/pass/map/qubits/place_mip/place_mip.h" // Broken: need half-decent IR for gates and virtual vs real qubit operands first. -#include "ql/pass/map/qubits/map/map.h" -#include "ql/arch/cc/pass/gen/vq1asm/vq1asm.h" -#include "ql/arch/diamond/pass/gen/microcode/microcode.h" - namespace ql { namespace pmgr { @@ -36,28 +13,27 @@ namespace pmgr { * Constructs a default pass factory for OpenQL. */ Factory::Factory() { - - // Default pass registration. This list should be generated at some point. - register_pass<::ql::pass::ana::visualize::circuit::Pass>("ana.visualize.Circuit"); - register_pass<::ql::pass::ana::visualize::interaction::Pass>("ana.visualize.Interaction"); - register_pass<::ql::pass::ana::visualize::mapping::Pass>("ana.visualize.Mapping"); - register_pass<::ql::pass::ana::statistics::clean::Pass>("ana.statistics.Clean"); - register_pass<::ql::pass::ana::statistics::report::Pass>("ana.statistics.Report"); - register_pass<::ql::pass::io::cqasm::read::Pass>("io.cqasm.Read"); - register_pass<::ql::pass::io::cqasm::report::Pass>("io.cqasm.Report"); - register_pass<::ql::pass::dec::instructions::Pass>("dec.Instructions"); - register_pass<::ql::pass::dec::generalize::Pass>("dec.Generalize"); - register_pass<::ql::pass::dec::specialize::Pass>("dec.Specialize"); - register_pass<::ql::pass::dec::structure::Pass>("dec.Structure"); - register_pass<::ql::pass::opt::clifford::optimize::Pass>("opt.clifford.Optimize"); - register_pass<::ql::pass::opt::const_prop::Pass>("opt.ConstProp"); - register_pass<::ql::pass::opt::dead_code_elim::Pass>("opt.DeadCodeElim"); - register_pass<::ql::pass::sch::schedule::Pass>("sch.Schedule"); - register_pass<::ql::pass::sch::list_schedule::Pass>("sch.ListSchedule"); - //register_pass<::ql::pass::map::qubits::place_mip::Pass>("map.qubits.PlaceMIP"); // Broken: need half-decent IR for gates and virtual vs real qubit operands first. - register_pass<::ql::pass::map::qubits::map::Pass>("map.qubits.Map"); - register_pass<::ql::arch::cc::pass::gen::vq1asm::Pass>("arch.cc.gen.VQ1Asm"); - register_pass<::ql::arch::diamond::pass::gen::microcode::Pass>("arch.diamond.gen.Microcode"); + // QL_ASSERT(pass_types().count("ana.statistics.Report") == 1); + // register_pass<::ql::pass::ana::visualize::circuit::Pass>("ana.visualize.Circuit"); + // register_pass<::ql::pass::ana::visualize::interaction::Pass>("ana.visualize.Interaction"); + // register_pass<::ql::pass::ana::visualize::mapping::Pass>("ana.visualize.Mapping"); + // register_pass<::ql::pass::ana::statistics::clean::Pass>("ana.statistics.Clean"); + // register_pass<::ql::pass::ana::statistics::report::Pass>("ana.statistics.Report"); + // register_pass<::ql::pass::io::cqasm::read::Pass>("io.cqasm.Read"); + // register_pass<::ql::pass::io::cqasm::report::Pass>("io.cqasm.Report"); + // register_pass<::ql::pass::dec::instructions::Pass>("dec.Instructions"); + // register_pass<::ql::pass::dec::generalize::Pass>("dec.Generalize"); + // register_pass<::ql::pass::dec::specialize::Pass>("dec.Specialize"); + // register_pass<::ql::pass::dec::structure::Pass>("dec.Structure"); + // register_pass<::ql::pass::opt::clifford::optimize::Pass>("opt.clifford.Optimize"); + // register_pass<::ql::pass::opt::const_prop::Pass>("opt.ConstProp"); + // register_pass<::ql::pass::opt::dead_code_elim::Pass>("opt.DeadCodeElim"); + // register_pass<::ql::pass::sch::schedule::Pass>("sch.Schedule"); + // register_pass<::ql::pass::sch::list_schedule::Pass>("sch.ListSchedule"); + // register_pass<::ql::pass::map::qubits::place_mip::Pass>("map.qubits.PlaceMIP"); // Broken: need half-decent IR for gates and virtual vs real qubit operands first. + // register_pass<::ql::pass::map::qubits::map::Pass>("map.qubits.Map"); + // register_pass<::ql::arch::cc::pass::gen::vq1asm::Pass>("arch.cc.gen.VQ1Asm"); + // register_pass<::ql::arch::diamond::pass::gen::microcode::Pass>("arch.diamond.gen.Microcode"); } @@ -85,7 +61,7 @@ CFactoryRef Factory::configure( // Pull the selected DNU passes into the main namespace, and remove all // other DNUs. // NOTE: iterating over original pass_types to avoid iterator invalidation! - for (const auto &pair : pass_types) { + for (const auto &pair : pass_types()) { const auto &type_name = pair.first; const auto &constructor_fn = pair.second; @@ -122,11 +98,11 @@ CFactoryRef Factory::configure( } // Delete the original entry for a dnu type unconditionally. - ref->pass_types.erase(type_name); + ref->pass_types().erase(type_name); // Make a new entry if the original type name is in the dnu set. if (dnu.find(type_name) != dnu.end()) { - ref->pass_types.set(stripped_type_name) = constructor_fn; + ref->pass_types().set(stripped_type_name) = constructor_fn; } } @@ -135,7 +111,7 @@ CFactoryRef Factory::configure( if (!architecture.empty()) { auto prefix = "arch." + architecture; utils::List> to_be_added; - for (const auto &pair : ref->pass_types) { + for (const auto &pair : ref->pass_types()) { const auto &type_name = pair.first; const auto &constructor_fn = pair.second; if (type_name.rfind(prefix, 0) == 0) { @@ -145,7 +121,7 @@ CFactoryRef Factory::configure( for (const auto &pair : to_be_added) { const auto &type_name = pair.first; const auto &constructor_fn = pair.second; - ref->pass_types.set(type_name) = constructor_fn; + ref->pass_types().set(type_name) = constructor_fn; } } @@ -162,11 +138,11 @@ PassRef Factory::build_pass( ) { if (type_name.empty()) { PassRef ref; - ref.emplace(pass_factory, instance_name); + ref.emplace(pass_factory, instance_name); return ref; } - auto it = pass_factory->pass_types.find(type_name); - if (it == pass_factory->pass_types.end()) { + auto it = pass_factory->pass_types().find(type_name); + if (it == pass_factory->pass_types().end()) { throw utils::Exception("unknown pass type \"" + type_name + "\""); } return (*it->second)(pass_factory, instance_name); @@ -184,7 +160,7 @@ void Factory::dump_pass_types( // Gather all aliases for each particular pass type. utils::Map> aliases; - for (const auto &pair : pass_factory->pass_types) { + for (const auto &pair : pass_factory->pass_types()) { const auto &type_name = pair.first; const auto &constructor_fn = pair.second; aliases.set(constructor_fn.unwrap().get()).push_back(type_name); diff --git a/src/ql/pmgr/include/ql/config.h b/src/ql/pmgr/include/ql/config.h new file mode 100644 index 000000000..47f069c0d --- /dev/null +++ b/src/ql/pmgr/include/ql/config.h @@ -0,0 +1,26 @@ +/** \file + * Configuration file for things that have to be configured via header file + * versus being compile-time only. + */ + +#pragma once + +// Whether ql::utils::Vec should guard against undefined behavior in iterators. +/* #undef QL_CHECKED_VEC */ + +// Whether ql::utils::List should guard against undefined behavior in +// iterators. +/* #undef QL_CHECKED_LIST */ + +// Whether ql::utils::Map should guard against undefined behavior in iterators. +/* #undef QL_CHECKED_MAP */ + +// Whether OpenQL was built as a static or dynamic library. +/* #undef QL_SHARED_LIB */ + +// Whether (experimental) pass group/hierarchy support is enabled in the API. +#undef QL_HIERARCHICAL_PASS_MANAGEMENT + +// Enable hacks to allow wait/barrier gates to appear in decompositions for the +// old IR. +#define OPT_DECOMPOSE_WAIT_BARRIER diff --git a/include/ql/pmgr/condition.h b/src/ql/pmgr/include/ql/pmgr/condition.h similarity index 100% rename from include/ql/pmgr/condition.h rename to src/ql/pmgr/include/ql/pmgr/condition.h diff --git a/include/ql/pmgr/declarations.h b/src/ql/pmgr/include/ql/pmgr/declarations.h similarity index 100% rename from include/ql/pmgr/declarations.h rename to src/ql/pmgr/include/ql/pmgr/declarations.h diff --git a/include/ql/pmgr/factory.h b/src/ql/pmgr/include/ql/pmgr/factory.h similarity index 90% rename from include/ql/pmgr/factory.h rename to src/ql/pmgr/include/ql/pmgr/factory.h index ed52c5d20..afe65ed7f 100644 --- a/include/ql/pmgr/factory.h +++ b/src/ql/pmgr/include/ql/pmgr/factory.h @@ -52,7 +52,12 @@ class Factory { * Map from (desugared) pass type name to a constructor function for that * particular pass type. */ - utils::Map pass_types; + + static utils::Map& pass_types() { + static utils::Map pass_types{}; + + return pass_types; + } public: @@ -65,7 +70,7 @@ class Factory { * Registers a pass class with the given type name. */ template - void register_pass(const utils::Str &type_name) { + static bool register_pass(const utils::Str &type_name) { ConstructorFn fn; fn.emplace([type_name]( const CFactoryRef &pass_factory, @@ -75,7 +80,9 @@ class Factory { pass.emplace(pass_factory, type_name, instance_name); return pass; }); - pass_types.set(type_name) = fn; + pass_types().set(type_name) = fn; + + return true; } /** diff --git a/include/ql/pmgr/group.h b/src/ql/pmgr/include/ql/pmgr/group.h similarity index 100% rename from include/ql/pmgr/group.h rename to src/ql/pmgr/include/ql/pmgr/group.h diff --git a/include/ql/pmgr/manager.h b/src/ql/pmgr/include/ql/pmgr/manager.h similarity index 100% rename from include/ql/pmgr/manager.h rename to src/ql/pmgr/include/ql/pmgr/manager.h diff --git a/include/ql/pmgr/pass_types/base.h b/src/ql/pmgr/include/ql/pmgr/pass_types/base.h similarity index 100% rename from include/ql/pmgr/pass_types/base.h rename to src/ql/pmgr/include/ql/pmgr/pass_types/base.h diff --git a/include/ql/pmgr/pass_types/specializations.h b/src/ql/pmgr/include/ql/pmgr/pass_types/specializations.h similarity index 100% rename from include/ql/pmgr/pass_types/specializations.h rename to src/ql/pmgr/include/ql/pmgr/pass_types/specializations.h diff --git a/src/ql/pmgr/pass_types/base.cc b/src/ql/pmgr/pass_types/base.cc index d079a373b..13f2981de 100644 --- a/src/ql/pmgr/pass_types/base.cc +++ b/src/ql/pmgr/pass_types/base.cc @@ -8,8 +8,8 @@ #include #include "ql/utils/filesystem.h" #include "ql/ir/cqasm/write.h" -#include "ql/pmgr/manager.h" -#include "ql/pass/ana/statistics/report.h" +#include "ql/ir/dump.h" +#include "ql/pmgr/factory.h" namespace ql { namespace pmgr { @@ -1012,7 +1012,7 @@ void Base::handle_debugging( ); } if (debug_opt == "stats" || debug_opt == "both") { - pass::ana::statistics::report::dump_all( + ir::dump_all( ir, utils::OutFile(context.output_prefix + "_" + in_or_out + ".report").unwrap() ); diff --git a/src/ql/resource/CMakeLists.txt b/src/ql/resource/CMakeLists.txt new file mode 100644 index 000000000..5204555bf --- /dev/null +++ b/src/ql/resource/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(resource_ + "qubit.cc" + "instrument.cc" + "inter_core_channel.cc" +) + +target_include_directories(resource_ PUBLIC include) +target_link_libraries(resource_ PUBLIC utils) +target_link_libraries(resource_ PUBLIC rmgr_resource_types) \ No newline at end of file diff --git a/include/ql/resource/instrument.h b/src/ql/resource/include/ql/resource/instrument.h similarity index 100% rename from include/ql/resource/instrument.h rename to src/ql/resource/include/ql/resource/instrument.h diff --git a/include/ql/resource/inter_core_channel.h b/src/ql/resource/include/ql/resource/inter_core_channel.h similarity index 100% rename from include/ql/resource/inter_core_channel.h rename to src/ql/resource/include/ql/resource/inter_core_channel.h diff --git a/include/ql/resource/qubit.h b/src/ql/resource/include/ql/resource/qubit.h similarity index 100% rename from include/ql/resource/qubit.h rename to src/ql/resource/include/ql/resource/qubit.h diff --git a/src/ql/rmgr/CMakeLists.txt b/src/ql/rmgr/CMakeLists.txt new file mode 100644 index 000000000..e0961c6c2 --- /dev/null +++ b/src/ql/rmgr/CMakeLists.txt @@ -0,0 +1,15 @@ +add_subdirectory(resource_types) + +add_library(rmgr + "types.cc" + "factory.cc" + "state.cc" + "manager.cc" +) + +target_include_directories(rmgr PUBLIC include) +target_link_libraries(rmgr PUBLIC utils) +target_link_libraries(rmgr PUBLIC ir_compat) +target_link_libraries(rmgr PUBLIC ir) +target_link_libraries(rmgr PUBLIC rmgr_resource_types) +target_link_libraries(rmgr PRIVATE resource_) \ No newline at end of file diff --git a/include/ql/rmgr/declarations.h b/src/ql/rmgr/include/ql/rmgr/declarations.h similarity index 100% rename from include/ql/rmgr/declarations.h rename to src/ql/rmgr/include/ql/rmgr/declarations.h diff --git a/include/ql/rmgr/factory.h b/src/ql/rmgr/include/ql/rmgr/factory.h similarity index 100% rename from include/ql/rmgr/factory.h rename to src/ql/rmgr/include/ql/rmgr/factory.h diff --git a/include/ql/rmgr/manager.h b/src/ql/rmgr/include/ql/rmgr/manager.h similarity index 100% rename from include/ql/rmgr/manager.h rename to src/ql/rmgr/include/ql/rmgr/manager.h diff --git a/include/ql/rmgr/state.h b/src/ql/rmgr/include/ql/rmgr/state.h similarity index 100% rename from include/ql/rmgr/state.h rename to src/ql/rmgr/include/ql/rmgr/state.h diff --git a/include/ql/rmgr/types.h b/src/ql/rmgr/include/ql/rmgr/types.h similarity index 100% rename from include/ql/rmgr/types.h rename to src/ql/rmgr/include/ql/rmgr/types.h diff --git a/src/ql/rmgr/resource_types/CMakeLists.txt b/src/ql/rmgr/resource_types/CMakeLists.txt new file mode 100644 index 000000000..03481da2f --- /dev/null +++ b/src/ql/rmgr/resource_types/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(rmgr_resource_types + "base.cc" +) + +target_include_directories(rmgr_resource_types PUBLIC include) +target_link_libraries(rmgr_resource_types PUBLIC utils) +target_link_libraries(rmgr_resource_types PUBLIC ir) +target_link_libraries(rmgr_resource_types PUBLIC ir_compat) \ No newline at end of file diff --git a/include/ql/rmgr/resource_types/base.h b/src/ql/rmgr/resource_types/include/ql/rmgr/resource_types/base.h similarity index 100% rename from include/ql/rmgr/resource_types/base.h rename to src/ql/rmgr/resource_types/include/ql/rmgr/resource_types/base.h diff --git a/src/ql/utils/CMakeLists.txt b/src/ql/utils/CMakeLists.txt new file mode 100644 index 000000000..69cd35e68 --- /dev/null +++ b/src/ql/utils/CMakeLists.txt @@ -0,0 +1,31 @@ +if(OPENQL_BUILD_TESTS) + add_subdirectory(tests) +endif() + +add_library(utils + "num.cc" + "str.cc" + "rangemap.cc" + "exception.cc" + "logger.cc" + "filesystem.cc" + "json.cc" + "tree.cc" + "vcd.cc" + "options.cc" + "progress.cc" +) + +target_include_directories(utils PUBLIC include) + +target_link_libraries(utils PUBLIC config) +target_link_libraries(utils PUBLIC nlohmann_json::nlohmann_json) +target_link_libraries(utils PUBLIC cqasm) + +# Stack trace helper library, nothing functional here. +add_backward(utils) + +# add_backward doesn't set INTERFACE_LINK_LIBRARIES, only LINK_LIBRARIES. That +# goes wrong when we're compiling statically, because said libraries are shared +# and need to be included in the final link. +set_property(TARGET utils APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${BACKWARD_LIBRARIES}) \ No newline at end of file diff --git a/include/ql/utils/compat.h b/src/ql/utils/include/ql/utils/compat.h similarity index 100% rename from include/ql/utils/compat.h rename to src/ql/utils/include/ql/utils/compat.h diff --git a/include/ql/utils/container_base.h b/src/ql/utils/include/ql/utils/container_base.h similarity index 100% rename from include/ql/utils/container_base.h rename to src/ql/utils/include/ql/utils/container_base.h diff --git a/include/ql/utils/exception.h b/src/ql/utils/include/ql/utils/exception.h similarity index 100% rename from include/ql/utils/exception.h rename to src/ql/utils/include/ql/utils/exception.h diff --git a/include/ql/utils/filesystem.h b/src/ql/utils/include/ql/utils/filesystem.h similarity index 100% rename from include/ql/utils/filesystem.h rename to src/ql/utils/include/ql/utils/filesystem.h diff --git a/include/ql/utils/json.h b/src/ql/utils/include/ql/utils/json.h similarity index 100% rename from include/ql/utils/json.h rename to src/ql/utils/include/ql/utils/json.h diff --git a/include/ql/utils/list.h b/src/ql/utils/include/ql/utils/list.h similarity index 100% rename from include/ql/utils/list.h rename to src/ql/utils/include/ql/utils/list.h diff --git a/include/ql/utils/logger.h b/src/ql/utils/include/ql/utils/logger.h similarity index 100% rename from include/ql/utils/logger.h rename to src/ql/utils/include/ql/utils/logger.h diff --git a/include/ql/utils/map.h b/src/ql/utils/include/ql/utils/map.h similarity index 100% rename from include/ql/utils/map.h rename to src/ql/utils/include/ql/utils/map.h diff --git a/include/ql/utils/misc.h b/src/ql/utils/include/ql/utils/misc.h similarity index 100% rename from include/ql/utils/misc.h rename to src/ql/utils/include/ql/utils/misc.h diff --git a/include/ql/utils/num.h b/src/ql/utils/include/ql/utils/num.h similarity index 100% rename from include/ql/utils/num.h rename to src/ql/utils/include/ql/utils/num.h diff --git a/include/ql/utils/opt.h b/src/ql/utils/include/ql/utils/opt.h similarity index 100% rename from include/ql/utils/opt.h rename to src/ql/utils/include/ql/utils/opt.h diff --git a/include/ql/utils/options.h b/src/ql/utils/include/ql/utils/options.h similarity index 100% rename from include/ql/utils/options.h rename to src/ql/utils/include/ql/utils/options.h diff --git a/include/ql/utils/pair.h b/src/ql/utils/include/ql/utils/pair.h similarity index 100% rename from include/ql/utils/pair.h rename to src/ql/utils/include/ql/utils/pair.h diff --git a/include/ql/utils/progress.h b/src/ql/utils/include/ql/utils/progress.h similarity index 100% rename from include/ql/utils/progress.h rename to src/ql/utils/include/ql/utils/progress.h diff --git a/include/ql/utils/ptr.h b/src/ql/utils/include/ql/utils/ptr.h similarity index 100% rename from include/ql/utils/ptr.h rename to src/ql/utils/include/ql/utils/ptr.h diff --git a/include/ql/utils/rangemap.h b/src/ql/utils/include/ql/utils/rangemap.h similarity index 100% rename from include/ql/utils/rangemap.h rename to src/ql/utils/include/ql/utils/rangemap.h diff --git a/include/ql/utils/set.h b/src/ql/utils/include/ql/utils/set.h similarity index 100% rename from include/ql/utils/set.h rename to src/ql/utils/include/ql/utils/set.h diff --git a/include/ql/utils/str.h b/src/ql/utils/include/ql/utils/str.h similarity index 100% rename from include/ql/utils/str.h rename to src/ql/utils/include/ql/utils/str.h diff --git a/include/ql/utils/tree-config.inc b/src/ql/utils/include/ql/utils/tree-config.inc similarity index 100% rename from include/ql/utils/tree-config.inc rename to src/ql/utils/include/ql/utils/tree-config.inc diff --git a/include/ql/utils/tree.h b/src/ql/utils/include/ql/utils/tree.h similarity index 100% rename from include/ql/utils/tree.h rename to src/ql/utils/include/ql/utils/tree.h diff --git a/include/ql/utils/vcd.h b/src/ql/utils/include/ql/utils/vcd.h similarity index 100% rename from include/ql/utils/vcd.h rename to src/ql/utils/include/ql/utils/vcd.h diff --git a/include/ql/utils/vec.h b/src/ql/utils/include/ql/utils/vec.h similarity index 100% rename from include/ql/utils/vec.h rename to src/ql/utils/include/ql/utils/vec.h diff --git a/src/ql/utils/tests/CMakeLists.txt b/src/ql/utils/tests/CMakeLists.txt new file mode 100644 index 000000000..ac897d26d --- /dev/null +++ b/src/ql/utils/tests/CMakeLists.txt @@ -0,0 +1,3 @@ +add_openql_unit_test(rangemap_test rangemap.cc) + +target_link_libraries(rangemap_test PRIVATE utils) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5489c21cd..28cd16fec 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -add_openql_test(test_cc cc/test_cc.cc cc) -add_openql_test(test_mapper test_mapper.cc .) -add_openql_test(test_multi_core test_multi_core.cc .) -add_openql_test(program_test program_test.cc .) -add_openql_test(test_179 test_179.cc .) +add_subdirectory(cc) + +add_openql_test(test_mapper test_mapper.cc) +add_openql_test(test_multi_core test_multi_core.cc) +add_openql_test(program_test program_test.cc) +add_openql_test(test_179 test_179.cc) diff --git a/tests/cc/CMakeLists.txt b/tests/cc/CMakeLists.txt new file mode 100644 index 000000000..005cdc5d4 --- /dev/null +++ b/tests/cc/CMakeLists.txt @@ -0,0 +1,3 @@ +add_openql_unit_test(test_cc test_cc.cc) +target_link_libraries(test_cc PRIVATE ql_bare) +target_link_libraries(test_cc PRIVATE arch_cc pass_io_cqasm pass_sch_list_schedule) \ No newline at end of file diff --git a/tests/cc/test_cc.cc b/tests/cc/test_cc.cc index 7799051e7..f89e406bb 100644 --- a/tests/cc/test_cc.cc +++ b/tests/cc/test_cc.cc @@ -6,7 +6,7 @@ - ../test_hybrid.py */ -#include +#include "openql.h" #include #include @@ -15,7 +15,6 @@ using namespace ql::utils; #define CFG_FILE_JSON "test_cfg_cc.json" - // based on tests/test_hybrid.py void test_classical() { const int num_qubits = 17; diff --git a/tests/program_test.cc b/tests/program_test.cc index 1321e7241..eda23dbfb 100644 --- a/tests/program_test.cc +++ b/tests/program_test.cc @@ -8,7 +8,7 @@ #include -#include +#include "openql.h" int main(int argc, char **argv) { size_t nqubits = 5; diff --git a/tests/test_179.cc b/tests/test_179.cc index 1d9259cfb..4c597d50d 100644 --- a/tests/test_179.cc +++ b/tests/test_179.cc @@ -8,9 +8,7 @@ #include -#include - - +#include "openql.h" // all cnots with operands that are neighbors in s7 // no or hardly any significant difference between pre179 and post179 scheduling diff --git a/tests/test_mapper.cc b/tests/test_mapper.cc index d6ad1929a..a371a29b8 100644 --- a/tests/test_mapper.cc +++ b/tests/test_mapper.cc @@ -1,4 +1,4 @@ -#include +#include "openql.h" void test_dpt( std::string v, diff --git a/tests/test_multi_core.cc b/tests/test_multi_core.cc index 2f53e684c..4136e8566 100644 --- a/tests/test_multi_core.cc +++ b/tests/test_multi_core.cc @@ -1,4 +1,4 @@ -#include +#include "openql.h" void test_mc(std::string v, std::string param1, std::string param2, std::string param3, std::string param4) { int n = 16;