#pragma once #include "psprecomp/elf32.hpp" #include #include #include #include #include namespace psprecomp { struct ExecutableRange { std::uint32_t start{}; std::uint32_t end{}; }; struct FunctionAnalysis { std::uint32_t entry{}; std::set labels; // all decoded instruction addresses (delay slots excluded) std::set entry_labels; // function entry and basic-block/return continuations std::set direct_calls; std::set indirect_call_sites; std::size_t basic_block_count{}; std::size_t unsupported_instruction_count{}; bool truncated{}; }; struct ProgramAnalysis { std::vector executable_ranges; std::map seeds; std::vector functions; std::set covered_labels; std::set covered_entry_labels; std::size_t overlapping_label_count{}; }; [[nodiscard]] bool is_executable_address(const std::vector &ranges, std::uint32_t address) noexcept; [[nodiscard]] ProgramAnalysis analyze_program(const Elf32Image &elf, const GuestMemory &memory, std::uint32_t load_base, std::size_t max_instructions_per_function = 131072u); } // namespace psprecomp