2
0
mirror of https://github.com/m-labs/artiq.git synced 2025-02-13 11:03:20 +08:00
artiq/artiq/test/lit/constant_hoisting/invariant_load.py
2018-05-25 02:18:13 +00:00

26 lines
567 B
Python

# RUN: env ARTIQ_DUMP_IR=%t ARTIQ_IR_NO_LOC=1 %python -m artiq.compiler.testbench.embedding +compile %s
# RUN: OutputCheck %s --file-to-check=%t.txt
from artiq.language.core import *
from artiq.language.types import *
# CHECK-L: %LOC.self.FLD.foo = numpy.int32 getattr('foo') <instance testbench.c> %ARG.self
# CHECK-L: for.head:
class c:
kernel_invariants = {"foo"}
def __init__(self):
self.foo = 1
@kernel
def run(self):
for _ in range(10):
core_log(1.0 * self.foo)
i = c()
@kernel
def entrypoint():
i.run()