Skip to content

Commit e3b0756

Browse files
committed
move mirgen tracing to mirgen
This means that `mirgen` invoked from `vmjit` also shows up in the trace.
1 parent 0163d6d commit e3b0756

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/backend/backends.nim

+1-2
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ proc translate*(id: ProcedureId, body: PNode, graph: ModuleGraph,
393393
computeCursors(prc, body, graph)
394394

395395
echoInput(graph.config, prc, body)
396-
graph.config.timeTracer.traceSym(tikMirgen, prc):
397-
result = generateCode(graph, env, prc, config.tconfig, body)
396+
result = generateCode(graph, env, prc, config.tconfig, body)
398397
echoMir(graph.config, prc, result, env)
399398

400399
# now apply the passes:

compiler/mir/mirgen.nim

+4-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ import
9393
],
9494
compiler/utils/[
9595
containers,
96-
idioms
96+
idioms,
97+
tracer
9798
]
9899

99100
import std/options as std_options
@@ -2439,6 +2440,7 @@ proc generateCode*(graph: ModuleGraph, env: var MirEnv, owner: PSym,
24392440
# XXX: this assertion can currently not be used, as the ``nfTransf`` flag
24402441
# might no longer be present after the lambdalifting pass
24412442
#assert nfTransf in body.flags, "transformed AST is expected as input"
2443+
graph.config.timeTracer.traceSym(tikMirgen, owner)
24422444

24432445
var c = initCtx(graph, config, owner, move env)
24442446
c.sp.active = (body, c.sp.map.add(body))
@@ -2530,6 +2532,7 @@ proc exprToMir*(graph: ModuleGraph, env: var MirEnv,
25302532
## Only meant to be used by `vmjit <#vmjit>`_. Produces a MIR body for a
25312533
## standalone expression. The result of the expression is assigned to the
25322534
## special local with ID 0.
2535+
graph.config.timeTracer.traceLoc(tikMirgen, e.info)
25332536
var c = initCtx(graph, config, nil, move env)
25342537
c.sp.active = (e, c.sp.map.add(e))
25352538

0 commit comments

Comments
 (0)