diff --git a/artiq/compiler/ir.py b/artiq/compiler/ir.py index 6ae9bdf76..3184a4a61 100644 --- a/artiq/compiler/ir.py +++ b/artiq/compiler/ir.py @@ -303,6 +303,7 @@ class BasicBlock(NamedValue): :ivar instructions: (list of :class:`Instruction`) """ + _dump_loc = True def __init__(self, instructions, name=""): super().__init__(TBasicBlock(), name) @@ -383,7 +384,7 @@ class BasicBlock(NamedValue): # Annotated instructions loc = None for insn in self.instructions: - if loc != insn.loc: + if self._dump_loc and loc != insn.loc: loc = insn.loc if loc is None: diff --git a/artiq/compiler/targets.py b/artiq/compiler/targets.py index ffdb7d994..853d6c3eb 100644 --- a/artiq/compiler/targets.py +++ b/artiq/compiler/targets.py @@ -1,5 +1,5 @@ import os, sys, tempfile, subprocess, io -from artiq.compiler import types +from artiq.compiler import types, ir from llvmlite_artiq import ir as ll, binding as llvm llvm.initialize() @@ -131,6 +131,9 @@ class Target: print("====== MODULE_SIGNATURE DUMP ======", file=sys.stderr) print(module, file=sys.stderr) + if os.getenv("ARTIQ_IR_NO_LOC") is not None: + ir.BasicBlock._dump_loc = False + type_printer = types.TypePrinter() _dump(os.getenv("ARTIQ_DUMP_IR"), "ARTIQ IR", ".txt", lambda: "\n".join(fn.as_entity(type_printer) for fn in module.artiq_ir)) diff --git a/artiq/compiler/testbench/irgen.py b/artiq/compiler/testbench/irgen.py index fa1608e12..275f11c94 100644 --- a/artiq/compiler/testbench/irgen.py +++ b/artiq/compiler/testbench/irgen.py @@ -1,8 +1,12 @@ -import sys, fileinput +import sys, os, fileinput from pythonparser import diagnostic +from .. import ir from ..module import Module, Source def main(): + if os.getenv("ARTIQ_IR_NO_LOC") is not None: + ir.BasicBlock._dump_loc = False + def process_diagnostic(diag): print("\n".join(diag.render())) if diag.level in ("fatal", "error"):