#!/usr/bin/env python3

# SPDX-FileCopyrightText: © 2022-2024 Decompollaborate
# SPDX-License-Identifier: MIT

from __future__ import annotations

from .rabbitizer import Instruction
from .LoPairingInfo import LoPairingInfo
from .JrRegData import JrRegData


class RegistersTracker:
    def __init__(self, other: RegistersTracker|None=None): ...

    def moveRegisters(self, instr: Instruction) -> bool: ...
    def overwriteRegisters(self, instr: Instruction, instructionOffset: int) -> None: ...
    def unsetRegistersAfterFuncCall(self, instr: Instruction, prevInstr: Instruction) -> None: ...
    def getAddressIfCanSetType(self, instr: Instruction, instrOffset: int) -> int|None: ...
    #! deprecated: use `getJrRegData` instead
    def getJrInfo(self, instr: Instruction) -> tuple[int, int]|None: ...
    def getJrRegData(self, instr: Instruction) -> JrRegData: ...

    def processLui(self, instr: Instruction, instrOffset: int, prevInstr: Instruction|None=None) -> None: ...
    def processGpLoad(self, instr: Instruction, instrOffset: int) -> None: ...
    def getLuiOffsetForConstant(self, instr: Instruction) -> int|None: ...
    def processConstant(self, instr: Instruction, value: int, offset: int) -> None: ...
    def getLuiOffsetForLo(self, instr: Instruction, instrOffset: int) -> tuple[int, bool, bool]: #! deprecated
        """Use `.preprocessLoAndGetInfo()` instead"""
    def preprocessLoAndGetInfo(self, instr: Instruction, instrOffset: int) -> LoPairingInfo: ...
    def processLo(self, instr: Instruction, value: int, offset: int) -> None: ...
    def processBranch(self, instr: Instruction, instrOffset: int) -> None: ...
    def hasLoButNoHi(self, instr: Instruction) -> bool: ...
