[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 19:04:44 PST 2025
================
@@ -5220,6 +5248,30 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
case ParsedAttr::AT_RISCVVectorCC:
CC = CC_RISCVVectorCall;
break;
+ case ParsedAttr::AT_RISCVVLSCC: {
+ // If the riscv_abi_vlen doesn't have any argument, we set set it to default
+ // value 128.
+ unsigned ABIVLen = 128;
+ if (Attrs.getNumArgs() &&
+ !checkUInt32Argument(Attrs, Attrs.getArgAsExpr(0), ABIVLen)) {
+ Attrs.setInvalid();
+ return true;
+ }
+ if (Attrs.getNumArgs() && (ABIVLen < 32 || ABIVLen > 65536)) {
+ Attrs.setInvalid();
+ Diag(Attrs.getLoc(), diag::err_argument_invalid_range)
+ << ABIVLen << 32 << 65536;
+ return true;
----------------
kito-cheng wrote:
```suggestion
if (Attrs.getNumArgs() && (ABIVLen < 32 || ABIVLen > 65536)) {
Attrs.setInvalid();
Diag(Attrs.getLoc(), diag::err_argument_invalid_range)
<< ABIVLen << 32 << 65536;
return true;
```
https://github.com/llvm/llvm-project/pull/100346
More information about the llvm-commits
mailing list