Debian Codegraph @

Source/Core/Common/Assembler/GekkoIRGen.h

raw symbols SCIP
1 // Copyright 2023 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <string_view>
7 #include <vector>
8
9 #include "Common/Assembler/AssemblerShared.h"
10 #include "Common/CommonTypes.h"
11
12 namespace Common::GekkoAssembler::detail
13 {
14 struct GekkoInstruction
15 {
16 // Combination of a mnemonic index and variant:
17 // (<GekkoMnemonic> << 2) | (<variant bits>)
18 size_t mnemonic_index = 0;
19 // Below refers to GekkoParseResult::operand_pool
20 Interval op_interval = Interval{0, 0};
21 // Literal text of this instruction
22 std::string_view raw_text;
23 size_t line_number = 0;
24 bool is_extended = false;
25 };
26
27 using InstChunk = std::vector<GekkoInstruction>;
28 using ByteChunk = std::vector<u8>;
29 using PadChunk = size_t;
30 using ChunkVariant = std::variant<InstChunk, ByteChunk, PadChunk>;
31
32 struct IRBlock
33 {
34 explicit IRBlock(u32 address) : block_address(address) {}
35
36 u32 BlockEndAddress() const;
37
38 std::vector<ChunkVariant> chunks;
39 u32 block_address;
40 };
41
42 struct GekkoIR
43 {
44 std::vector<IRBlock> blocks;
45 std::vector<Tagged<Interval, u32>> operand_pool;
46 };
47
48 FailureOr<GekkoIR> ParseToIR(std::string_view assembly, u32 base_virtual_address);
49 } // namespace Common::GekkoAssembler::detail