Beispiel #1
0
 def test_arg(self):
     a = ir.Arg('foo', 0, self.loc1)
     b = ir.Arg('foo', 0, self.loc1)
     c = ir.Arg('foo', 0, self.loc2)
     d = ir.Arg('bar', 0, self.loc1)
     e = ir.Arg('foo', 1, self.loc1)
     self.check(a, same=[b, c], different=[d, e])
Beispiel #2
0
    def make_prologue():
        """
        Make a new block that unwraps the argument and jump to the loop entry.
        This block is the entry block of the function.
        """
        entry_block = blocks[loopinfo.callfrom]
        scope = entry_block.scope
        loc = entry_block.loc

        block = ir.Block(scope=scope, loc=loc)
        # load args
        args = [ir.Arg(name=k, index=i, loc=loc)
                for i, k in enumerate(loopinfo.inputs)]
        for aname, aval in zip(loopinfo.inputs, args):
            tmp = ir.Var(scope=scope, name=aname, loc=loc)
            block.append(ir.Assign(target=tmp, value=aval, loc=loc))
        # jump to loop entry
        block.append(ir.Jump(target=loopinfo.callfrom, loc=loc))
        return block
Beispiel #3
0
 def init_first_block(self):
     # Define variables receiving the function arguments
     for index, name in enumerate(self.arg_names):
         val = ir.Arg(index=index, name=name, loc=self.loc)
         self.store(val, name)