def GetLocalReg(fun: ir.Fun, no: int) -> ir.Reg: reg_name = f"$loc_{no}" reg = fun.MaybeGetReg(reg_name) assert reg, f"unknown reg {reg_name}" return reg
def GetOpReg(fun: ir.Fun, dk: o.DK, pos: int) -> ir.Reg: reg_name = f"$op_{pos}_{dk.name}" reg = fun.MaybeGetReg(reg_name) return reg if reg else fun.AddReg(ir.Reg(reg_name, dk))