Skip to content

Commit a7847c4

Browse files
committed
Save the entry point function in metadata.
That way, we can write passes that need to know about the entry point.
1 parent 6a1de5c commit a7847c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/driver.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ const __llvm_initialized = Ref(false)
317317
end
318318

319319
@timeit_debug to "IR post-processing" begin
320+
# mark the entry-point function (optimization may need it)
321+
if deferred_codegen
322+
# IDEA: save other parts of the CompileJob (so that we can reconstruct it
323+
# instead of setting it globally, which is incompatible with threading)?
324+
push!(metadata(ir)["julia.entry"], MDNode([entry]; ctx))
325+
end
326+
320327
if optimize
321328
@timeit_debug to "optimization" begin
322329
optimize!(job, ir)

0 commit comments

Comments
 (0)