hvdijk wrote:

> > Would it not still be important for that for RVV intrinsics?
> 
> Pretty sure we bypass all the normal calling convention lowering, in this 
> context.

Ah, this is confusing. There's two types of RVV intrinsics that use this code. 
Many use `ManualCodegen` which indeed bypasses the normal calling convention 
lowering. But not all: for e.g. `vzext`, this results in a call to 
`@llvm.riscv.vzext.*` LLVM intrinsics and does use the calling convention. But 
then, the RISC-V calling convention attributes cannot be specified by 
command-line options to be the default calling convention, so it still doesn't 
actually make a difference at the moment.

So, I think `IsBuiltin=true` is currently set in all the right places, we 
should not change behavior.

> Really what I don't want happening is someone copy-pastes 
> getTargetInfo().getDefaultCallingConv() because it looks right, and doesn't 
> realize there another whole method they're supposed to use for things that 
> aren't actually "builtins".

That makes sense. I amended `ASTContext::getDefaultCallingConvention`'s 
documentation to point out `getTargetInfo().getDefaultCallingConv()` in this 
PR, would it be acceptable if I likewise point out in the 
`TargetInfo::getDefaultCallingConv()` documentation when *not* to use it? At 
the moment, that documentation looks wrong anyway: it is documented as

```
  /// Gets the default calling convention for the given target and
  /// declaration context.
  virtual CallingConv getDefaultCallingConv() const {
    // Not all targets will specify an explicit calling convention that we can
    // express.  This will always do the right thing, even though it's not
    // an explicit calling convention.
    return CC_C;
  }
```

but there is no declaration context for it to take into account.

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