Skip to content

Commit

Permalink
Generalize classify arguments function
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Feb 6, 2022
1 parent 6d8d62b commit 31636cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ function process_entry!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
if job.source.kernel
# pass all bitstypes by value; by default Julia passes aggregates by reference
# (this improves performance, and is mandated by certain back-ends like SPIR-V).
args = classify_arguments(job, eltype(llvmtype(entry)))
source_sig = Base.signature_type(job.source.f, job.source.tt)::Type
args = classify_arguments(source_sig, eltype(llvmtype(entry)))
for arg in args
if arg.cc == BITS_REF
attr = if LLVM.version() >= v"12"
Expand Down
4 changes: 1 addition & 3 deletions src/irgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,8 @@ end
GHOST # not passed
end

function classify_arguments(@nospecialize(job::CompilerJob), codegen_ft::LLVM.FunctionType)
source_sig = Base.signature_type(job.source.f, job.source.tt)::Type
function classify_arguments(source_sig::Type, codegen_ft::LLVM.FunctionType)
source_types = [source_sig.parameters...]

codegen_types = parameters(codegen_ft)

args = []
Expand Down
3 changes: 2 additions & 1 deletion src/spirv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ function wrap_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.F
else
ft
end
args = classify_arguments(job, orig_ft)
source_sig = Base.signature_type(job.source.f, job.source.tt)::Type
args = classify_arguments(source_sig, entry_f)
filter!(args) do arg
arg.cc != GHOST
end
Expand Down

0 comments on commit 31636cb

Please sign in to comment.