[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 11:02:39 PST 2024


================
@@ -8031,6 +8034,28 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr,
   CallingConv CCOld = fn->getCallConv();
   Attr *CCAttr = getCCTypeAttr(S.Context, attr);
 
+  if (attr.getKind() == ParsedAttr::AT_RISCVVLSCC) {
+    // If the riscv_abi_vlen doesn't have any argument, we set set it to 2 to
+    // differentiate from functions without attribute.
+    unsigned ABIVLen = 2;
+    if (attr.getNumArgs() &&
+        !S.checkUInt32Argument(attr, attr.getArgAsExpr(0), ABIVLen))
+      return false;
+    if (ABIVLen != 2 && (ABIVLen < 32 || ABIVLen > 65536)) {
----------------
topperc wrote:

Does this allow users to write 2?

https://github.com/llvm/llvm-project/pull/100346


More information about the cfe-commits mailing list