From b6c8c9f480938886d825b098e1ce81b84c9d8c12 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 9 Oct 2015 01:37:28 +0300 Subject: [PATCH] transforms.artiq_ir_generator: add tests for devirtualization. --- lit-test/test/devirtualization/ddb.pyon | 8 ++++++++ lit-test/test/devirtualization/function.py | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lit-test/test/devirtualization/ddb.pyon create mode 100644 lit-test/test/devirtualization/function.py diff --git a/lit-test/test/devirtualization/ddb.pyon b/lit-test/test/devirtualization/ddb.pyon new file mode 100644 index 000000000..7c1bb62ef --- /dev/null +++ b/lit-test/test/devirtualization/ddb.pyon @@ -0,0 +1,8 @@ +{ + "comm": { + "type": "local", + "module": "artiq.coredevice.comm_dummy", + "class": "Comm", + "arguments": {} + } +} diff --git a/lit-test/test/devirtualization/function.py b/lit-test/test/devirtualization/function.py new file mode 100644 index 000000000..5c24b492b --- /dev/null +++ b/lit-test/test/devirtualization/function.py @@ -0,0 +1,22 @@ +# RUN: env ARTIQ_DUMP_IR=1 %python -m artiq.compiler.testbench.embedding +compile %s 2>%t +# RUN: OutputCheck %s --file-to-check=%t + +from artiq.language.core import * +from artiq.language.types import * + +# CHECK-L: call ()->NoneType %local.testbench.entrypoint ; calls testbench.entrypoint + +@kernel +def baz(): + pass + +class foo: + @kernel + def bar(self): + # CHECK-L: call ()->NoneType %local.testbench.baz ; calls testbench.baz + baz() +x = foo() + +@kernel +def entrypoint(): + x.bar()