diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index ff3ac44..1b9d2ed 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,7 +1,5 @@ project(common) -add_subdirectory(registers) - add_executable(common_insertion_operators insertion_operators.cpp) target_link_libraries(common_insertion_operators PRIVATE Dyninst::common) diff --git a/common/registers/CMakeLists.txt b/common/registers/CMakeLists.txt deleted file mode 100644 index 8e7cba6..0000000 --- a/common/registers/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -project(common_registers) - -add_executable(uniqueness uniqueness.cpp) -target_link_libraries(uniqueness PRIVATE Dyninst::symtabAPI) -add_test(NAME common_registers_uniqueness COMMAND uniqueness) diff --git a/common/registers/uniqueness.cpp b/common/registers/uniqueness.cpp deleted file mode 100644 index e183d6c..0000000 --- a/common/registers/uniqueness.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "registers/MachRegister.h" -#include "Architecture.h" -#include -#include -#include -#include -#include -#include -#include - -/* - * Ensure all registers for an architecture have unique representations - */ - -// Some architectures have known aliases, so exclude them. -using dup_map = std::map>; -dup_map known_dups = { - {Dyninst::Arch_aarch64, - { - "aarch64::x29", "aarch64::fp", - "aarch64::x30", "aarch64::lr", - "aarch64::Ip0", "aarch64::x16", - "aarch64::Ip1", "aarch64::x17", - } - }, - {Dyninst::Arch_x86, {}}, - {Dyninst::Arch_x86_64, {}}, - {Dyninst::Arch_amdgpu_gfx908, {}}, - {Dyninst::Arch_amdgpu_gfx90a, {}}, - {Dyninst::Arch_amdgpu_gfx940, {}}, -}; - -bool check(Dyninst::Architecture arch) { - auto const& regs = Dyninst::MachRegister::getAllRegistersForArch(arch); - - auto known_dup = [arch](std::string const& name) { - auto const& regs = known_dups[arch]; - return std::find(regs.begin(), regs.end(), name) != regs.end(); - }; - - auto success = true; - - std::unordered_map vals; - for(auto r : regs) { - auto [itr, inserted] = vals.insert({r.val(), r.name()}); - if(!inserted && !known_dup(r.name())) { - auto [val, name] = *itr; - std::cerr << "Duplicate: 0x" << std::hex << val - << " " << r.name() << ", " << name << "\n"; - success = false; - } - } - - return success; -} - - -int main() { - auto status = EXIT_SUCCESS; - - if(!check(Dyninst::Arch_aarch64)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_x86)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_x86_64)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_ppc64)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_amdgpu_gfx908)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_amdgpu_gfx90a)) { - status = EXIT_FAILURE; - } - if(!check(Dyninst::Arch_amdgpu_gfx940)) { - status = EXIT_FAILURE; - } - - return status; -}