Skip to content

Commit 29558c0

Browse files
committed
Allow for nested targets
1 parent c3ba85b commit 29558c0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/driver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const __llvm_initialized = Ref(false)
222222
for dyn_job in keys(worklist)
223223
# cached compilation
224224
dyn_entry_fn = get!(jobs, dyn_job) do
225-
config = CompilerConfig(dyn_job.config; toplevel=false)
225+
config = CompilerConfig(dyn_job.config; toplevel=false, target = nest_target(dyn_job.target, job.target))
226226
dyn_ir, dyn_meta = codegen(:llvm, CompilerJob(dyn_job; config))
227227
dyn_entry_fn = LLVM.name(dyn_meta.entry)
228228
merge!(compiled, dyn_meta.compiled)

src/interface.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ have_fma(@nospecialize(target::AbstractCompilerTarget), T::Type) = false
4848

4949
dwarf_version(target::AbstractCompilerTarget) = Int32(4) # It seems every target supports v4 bar cuda
5050

51+
# If your target performs nested compilation, this function should reconstruct your target with a new inner target
52+
nest_target(target::AbstractCompilerTarget, parent::AbstractCompilerTarget) = target
53+
5154
## params
5255

5356
export AbstractCompilerParams

0 commit comments

Comments
 (0)