Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize classify arguments function #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 3 additions & 4 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 Expand Up @@ -396,7 +394,8 @@ function lower_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.
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, orig_ft)
filter!(args) do arg
arg.cc != GHOST
end
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, orig_ft)
filter!(args) do arg
arg.cc != GHOST
end
Expand Down