예제 #1
0
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
예제 #2
0
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))