Exemple #1
0
    def makeRandomBlock(self, ctx):
        super(LoopRBlock, self).makeRandomBlock(ctx)
        nest = ctx['nest'] - 1
        l1 = ctx['getRBlock'](self.label+'_l1', nest)
        ctx['nest'] = nest
        sub1 = l1.makeRandomBlock(ctx)
        b_l1 = ig.genLoop(ctx[CTX.ISA], ctx, l1.label)

        self.code.append((CT.BLOCK, l1))
        self.code.append((CT.INST, b_l1))
        ctx['nest'] = nest + 1
        return sub1
Exemple #2
0
    def makeRandomBlock(self, ctx):
        super(IrreducibleLoopRBlock, self).makeRandomBlock(ctx)
        nest = ctx['nest'] - 1
        ir1 = ctx['getRBlock'](self.label+'_ir1', nest)
        ir2 = ctx['getRBlock'](self.label+'_ir2', nest)
        ir3 = ctx['getRBlock'](self.label+'_ir3', nest)
        ctx['nest'] = nest
        sub1 = ir1.makeRandomBlock(ctx)
        sub2 = ir2.makeRandomBlock(ctx)
        sub3 = ir3.makeRandomBlock(ctx)
        b_ir2 = ig.genLoop(ctx[CTX.ISA], ctx, ir2.label)
        b_ir3 = ig.genBranch(ctx[CTX.ISA], ctx, ir3.label, True, off_block=ir2)

        self.code.append((CT.BLOCK, ir1))
        self.code.append((CT.INST, b_ir3))
        self.code.append((CT.BLOCK, ir2))
        self.code.append((CT.BLOCK, ir3))
        self.code.append((CT.INST, b_ir2))
        ctx['nest'] = nest + 1
        return sub1 + sub2 + sub3