forked from M-Labs/artiq
compiler: purge generated functions from backtraces.
This commit is contained in:
parent
a2f6e81c50
commit
89326fb189
|
@ -425,6 +425,8 @@ class Function:
|
|||
the module it is contained in
|
||||
:ivar is_cold:
|
||||
(bool) if True, the function should be considered rarely called
|
||||
:ivar is_generated:
|
||||
(bool) if True, the function will not appear in backtraces
|
||||
:ivar flags: (set of str) Code generation flags.
|
||||
Flag ``fast-math`` is the equivalent of gcc's ``-ffast-math``.
|
||||
"""
|
||||
|
@ -436,6 +438,7 @@ class Function:
|
|||
self.set_arguments(arguments)
|
||||
self.is_internal = False
|
||||
self.is_cold = False
|
||||
self.is_generated = False
|
||||
self.flags = {}
|
||||
|
||||
def _remove_name(self, name):
|
||||
|
|
|
@ -944,6 +944,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
|||
func = ir.Function(typ, ".".join(self.name + [name]), args, loc=loc)
|
||||
func.is_internal = True
|
||||
func.is_cold = True
|
||||
func.is_generated = True
|
||||
self.functions.append(func)
|
||||
old_func, self.current_function = self.current_function, func
|
||||
|
||||
|
|
|
@ -544,8 +544,9 @@ class LLVMIRGenerator:
|
|||
self.llbuilder = ll.IRBuilder()
|
||||
llblock_map = {}
|
||||
|
||||
disubprogram = self.debug_info_emitter.emit_subprogram(func, self.llfunction)
|
||||
self.llfunction.set_metadata('dbg', disubprogram)
|
||||
if not func.is_generated:
|
||||
lldisubprogram = self.debug_info_emitter.emit_subprogram(func, self.llfunction)
|
||||
self.llfunction.set_metadata('dbg', lldisubprogram)
|
||||
|
||||
# First, map arguments.
|
||||
if self.has_sret(func.type):
|
||||
|
@ -566,9 +567,9 @@ class LLVMIRGenerator:
|
|||
for block in func.basic_blocks:
|
||||
self.llbuilder.position_at_end(self.llmap[block])
|
||||
for insn in block.instructions:
|
||||
if insn.loc is not None:
|
||||
if insn.loc is not None and not func.is_generated:
|
||||
self.llbuilder.debug_metadata = \
|
||||
self.debug_info_emitter.emit_loc(insn.loc, disubprogram)
|
||||
self.debug_info_emitter.emit_loc(insn.loc, lldisubprogram)
|
||||
|
||||
llinsn = getattr(self, "process_" + type(insn).__name__)(insn)
|
||||
assert llinsn is not None
|
||||
|
|
Loading…
Reference in New Issue