def testBrDeclaration(self): self.setUp() with self.module.function_context("foo", [], []) as fun: blk = E.BlockContext() E.br(blk.handle()) with blk: E.ret() printWithCurrentFunctionName(str(fun))
def testBrArgs(self): self.setUp() with self.module.function_context("foo", [], []) as fun: # Create an infinite loop. with E.BlockContext([self.indexType, self.indexType]) as b: E.br(b, [b.arg(1), b.arg(0)]) E.br(b, [E.constant_index(0), E.constant_index(1)]) printWithCurrentFunctionName(str(fun))
def testBr(self): self.setUp() with self.module.function_context("foo", [], []) as fun: with E.BlockContext() as b: blk = b E.ret() E.br(blk) printWithCurrentFunctionName(str(fun))
def testBrDeclaration(self): with self.module.function_context("foo", [], []) as fun: blk = E.BlockContext() E.br(blk.handle()) with blk: E.ret() code = str(fun) self.assertIn(" br ^bb1", code) self.assertIn("^bb1:", code) self.assertIn(" return", code)
def testBr(self): with self.module.function_context("foo", [], []) as fun: with E.BlockContext() as b: blk = b E.ret() E.br(blk) code = str(fun) self.assertIn(" br ^bb1", code) self.assertIn("^bb1:", code) self.assertIn(" return", code)
def testBrArgs(self): with self.module.function_context("foo", [], []) as fun: # Create an infinite loop. with E.BlockContext([self.indexType, self.indexType]) as b: E.br(b, [b.arg(1), b.arg(0)]) E.br(b, [E.constant_index(0), E.constant_index(1)]) code = str(fun) self.assertIn(" %c0 = constant 0 : index", code) self.assertIn(" %c1 = constant 1 : index", code) self.assertIn(" br ^bb1(%c0, %c1 : index, index)", code) self.assertIn("^bb1(%0: index, %1: index):", code) self.assertIn(" br ^bb1(%1, %0 : index, index)", code)