MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / RegState

Class RegState

src/analysis.cpp:13–54  ·  view source on GitHub ↗

If 64-bit addressing is ever implemented, these will need to be changed to 64-bit values

Source from the content-addressed store, hash-verified

11
12// If 64-bit addressing is ever implemented, these will need to be changed to 64-bit values
13struct RegState {
14 // For tracking a register that will be used to load from RAM
15 uint32_t prev_lui;
16 uint32_t prev_addiu_vram;
17 uint32_t prev_addu_vram;
18 uint8_t prev_addend_reg;
19 uint32_t prev_got_offset; // offset of lw rt,offset(gp)
20 bool valid_lui;
21 bool valid_addiu;
22 bool valid_addend;
23 bool valid_got_offset;
24 // For tracking a register that has been loaded from RAM
25 uint32_t loaded_lw_vram;
26 uint32_t loaded_addu_vram;
27 uint32_t loaded_address;
28 uint8_t loaded_addend_reg;
29 bool valid_loaded;
30 bool valid_got_loaded; // valid load through the GOT
31
32 RegState() = default;
33
34 void invalidate() {
35 prev_lui = 0;
36 prev_addiu_vram = 0;
37 prev_addu_vram = 0;
38 prev_addend_reg = 0;
39 prev_got_offset = 0;
40
41 valid_lui = false;
42 valid_addiu = false;
43 valid_addend = false;
44 valid_got_offset = false;
45
46 loaded_lw_vram = 0;
47 loaded_addu_vram = 0;
48 loaded_address = 0;
49 loaded_addend_reg = 0;
50
51 valid_loaded = false;
52 valid_got_loaded = false;
53 }
54};
55
56using InstrId = rabbitizer::InstrId::UniqueId;
57using RegId = rabbitizer::Registers::Cpu::GprO32;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected