hvdijk wrote:

The calling convention doesn't just apply at the LLVM level though. For that, 
you're right it wouldn't make a difference for RVV intrinsics, but it also 
applies at the Clang level to determine whether Clang passes arguments by value 
or by reference, and whether it promotes arguments. Would it not still be 
important for that for RVV intrinsics?

For OpenCL builtins, this definitely does makes a difference. The OpenCL 
builtins aren't like LLVM intrinsics, they're library functions provided by 
libclc or equivalent and the same argument as for libc functions applies: 
libclc would be expected to be compiled without calling convention-affecting 
options, and if a user's kernel is compiled with calling convention-affecting 
options, things again break if the caller and callee side don't agree on which 
ABI to use for built-ins.

I do think the effect of IsBuiltin is exactly what we want in all places it's 
currently used.

>  I guess if we have that comment, it doesn't matter that much whether we call 
> getDefaultCallingConvention with IsBuiltin=false, or bypass it to use 
> getTargetInfo().getDefaultCallingConv(), but going through 
> getDefaultCallingConvention() with the flag makes it more obvious we're doing 
> something unusual.

If we want this for all built-in functions, 
getTargetInfo().getDefaultCallingConv() becomes the normal thing to call there, 
it wouldn't be unusual and wouldn't need to be called out specifically.

If we only want this for some built-in functions, we have a bigger mismatch 
between documentation and implementation. If the parameter is called 
`IsBuiltin`, I wouldn't know how to document that we should set that to `true` 
for some built-ins, and to `false` for other built-ins. We'd need to make some 
other changes there to clean up that inconsistency, which I'd be happy to 
submit a PR for except I don't actually know what that would need to look like 
yet :)

https://github.com/llvm/llvm-project/pull/145904
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to