Skip to content

Commit

Permalink
Allow to dump ARTIQ/LLVM IR for stitched code.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Aug 8, 2015
1 parent ee3f35c commit 13ad9b5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions artiq/coredevice/core.py
Expand Up @@ -32,10 +32,19 @@ def compile(self, function, args, kwargs, with_attr_writeback=True):
stitcher = Stitcher(engine=engine)
stitcher.stitch_call(function, args, kwargs)

module = Module(stitcher)
library = OR1KTarget().compile_and_link([module])
module = Module(stitcher)
target = OR1KTarget()

return library, stitcher.rpc_map
if os.getenv('ARTIQ_DUMP_IR'):
print("====== ARTIQ IR DUMP ======", file=sys.stderr)
for function in module.artiq_ir:
print(function, file=sys.stderr)

if os.getenv('ARTIQ_DUMP_LLVM'):
print("====== LLVM IR DUMP ======", file=sys.stderr)
print(module.build_llvm_ir(target), file=sys.stderr)

return target.compile_and_link([module]), stitcher.rpc_map
except diagnostic.Error as error:
print("\n".join(error.diagnostic.render(colored=True)), file=sys.stderr)
raise CompileError() from error
Expand Down

0 comments on commit 13ad9b5

Please sign in to comment.