Skip to content

Commit 13ad9b5

Browse files
author
whitequark
committedAug 8, 2015
Allow to dump ARTIQ/LLVM IR for stitched code.
1 parent ee3f35c commit 13ad9b5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

Diff for: ‎artiq/coredevice/core.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,19 @@ def compile(self, function, args, kwargs, with_attr_writeback=True):
3232
stitcher = Stitcher(engine=engine)
3333
stitcher.stitch_call(function, args, kwargs)
3434

35-
module = Module(stitcher)
36-
library = OR1KTarget().compile_and_link([module])
35+
module = Module(stitcher)
36+
target = OR1KTarget()
3737

38-
return library, stitcher.rpc_map
38+
if os.getenv('ARTIQ_DUMP_IR'):
39+
print("====== ARTIQ IR DUMP ======", file=sys.stderr)
40+
for function in module.artiq_ir:
41+
print(function, file=sys.stderr)
42+
43+
if os.getenv('ARTIQ_DUMP_LLVM'):
44+
print("====== LLVM IR DUMP ======", file=sys.stderr)
45+
print(module.build_llvm_ir(target), file=sys.stderr)
46+
47+
return target.compile_and_link([module]), stitcher.rpc_map
3948
except diagnostic.Error as error:
4049
print("\n".join(error.diagnostic.render(colored=True)), file=sys.stderr)
4150
raise CompileError() from error

0 commit comments

Comments
 (0)
Please sign in to comment.