コード例 #1
0
def FunSpillRegs(fun: ir.Fun, offset_kind: o.DK, regs: List[ir.Reg]) -> int:
    reg_to_stk: Dict[ir.Reg, ir.Stk] = {}
    for reg in regs:
        size = ir.OffsetConst(reg.kind.bitwidth() // 8)
        stk = ir.Stk(f"$spill_{reg.name}", size, size)
        reg_to_stk[reg] = stk
        fun.AddStk(stk)
    return ir.FunGenericRewrite(fun, InsSpillRegs, zero_const=ir.Const(offset_kind, 0),
                                reg_to_stk=reg_to_stk)
コード例 #2
0
ファイル: reg_alloc.py プロジェクト: robertmuth/Cwerg
def BblSpillRegs(bbl: ir.Bbl, fun: ir.Fun, regs: List[ir.Reg],
                 offset_kind: o.DK, prefix) -> int:
    reg_to_stk: Dict[ir.Reg, ir.Stk] = {}
    for reg in regs:
        size = reg.kind.bitwidth() // 8
        stk = ir.Stk(f"{prefix}_{reg.name}", size, size)
        reg_to_stk[reg] = stk
        fun.AddStk(stk)
    ir.BblGenericRewrite(bbl,
                         fun,
                         InsSpillRegs,
                         zero_const=ir.Const(offset_kind, 0),
                         reg_to_stk=reg_to_stk)