[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 04:15:32 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d36edf8146cfea9f0407e2fb26283297eb6a6ac4 dc4d11d0e9665f42b27de4bfb73c9756b007518d --extensions cpp,h,c -- clang/include/clang-c/Index.h clang/include/clang/AST/Type.h clang/include/clang/Basic/Specifiers.h clang/include/clang/CodeGen/CGFunctionInfo.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/Type.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Basic/Targets/RISCV.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/Targets/RISCV.cpp clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaType.cpp clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.c clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.cpp clang/test/CodeGen/RISCV/riscv-vector-callingconv.c clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp clang/tools/libclang/CXType.cpp llvm/include/llvm/AsmParser/LLToken.h llvm/include/llvm/IR/CallingConv.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVSubtarget.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 7e2ffb09e3..ea861fa9dd 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3510,7 +3510,8 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) {
// clang-format off
case CC_RISCVVectorCall: return "riscv_vector_cc";
// clang-format on
- case CC_RISCVVLSCall: return "riscv_vls_cc";
+ case CC_RISCVVLSCall:
+ return "riscv_vls_cc";
}
llvm_unreachable("Invalid calling convention.");
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e6e05ee92a..c4785676d2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -77,7 +77,8 @@ unsigned CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) {
// clang-format off
case CC_RISCVVectorCall: return llvm::CallingConv::RISCV_VectorCall;
// clang-format on
- case CC_RISCVVLSCall: return llvm::CallingConv::RISCV_VLSCall;
+ case CC_RISCVVLSCall:
+ return llvm::CallingConv::RISCV_VLSCall;
}
}
diff --git a/clang/lib/CodeGen/Targets/RISCV.cpp b/clang/lib/CodeGen/Targets/RISCV.cpp
index 4d16eaad78..f90eb0a11b 100644
--- a/clang/lib/CodeGen/Targets/RISCV.cpp
+++ b/clang/lib/CodeGen/Targets/RISCV.cpp
@@ -105,8 +105,8 @@ void RISCVABIInfo::computeInfo(CGFunctionInfo &FI) const {
int ArgNum = 0;
for (auto &ArgInfo : FI.arguments()) {
bool IsFixed = ArgNum < NumFixedArgs;
- ArgInfo.info =
- classifyArgumentType(ArgInfo.type, IsFixed, ArgGPRsLeft, ArgFPRsLeft, ABIVLen);
+ ArgInfo.info = classifyArgumentType(ArgInfo.type, IsFixed, ArgGPRsLeft,
+ ArgFPRsLeft, ABIVLen);
ArgNum++;
}
}
@@ -335,7 +335,8 @@ ABIArgInfo RISCVABIInfo::coerceVLSVector(QualType Ty, unsigned ABIVLen) const {
unsigned NumElts = VT->getNumElements();
llvm::ScalableVectorType *ResType;
- llvm::Type *EltType = CGT.ConvertType(VT->getElementType());;
+ llvm::Type *EltType = CGT.ConvertType(VT->getElementType());
+ ;
if (ABIVLen == 0) {
// RVV fixed-length vector
@@ -498,7 +499,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
}
-ABIArgInfo RISCVABIInfo::classifyReturnType(QualType RetTy, unsigned ABIVLen) const {
+ABIArgInfo RISCVABIInfo::classifyReturnType(QualType RetTy,
+ unsigned ABIVLen) const {
if (RetTy->isVoidType())
return ABIArgInfo::getIgnore();
@@ -507,8 +509,8 @@ ABIArgInfo RISCVABIInfo::classifyReturnType(QualType RetTy, unsigned ABIVLen) co
// The rules for return and argument types are the same, so defer to
// classifyArgumentType.
- return classifyArgumentType(RetTy, /*IsFixed=*/true, ArgGPRsLeft,
- ArgFPRsLeft, ABIVLen);
+ return classifyArgumentType(RetTy, /*IsFixed=*/true, ArgGPRsLeft, ArgFPRsLeft,
+ ABIVLen);
}
RValue RISCVABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 895569e896..01660eb37f 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -7482,7 +7482,7 @@ static Attr *getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr) {
case ParsedAttr::AT_RISCVVectorCC:
return createSimpleAttr<RISCVVectorCCAttr>(Ctx, Attr);
case ParsedAttr::AT_RISCVVLSCC:
- return ::new (Ctx) RISCVVLSCCAttr(Ctx, Attr, /*dummy*/0);
+ return ::new (Ctx) RISCVVLSCCAttr(Ctx, Attr, /*dummy*/ 0);
}
llvm_unreachable("unexpected attribute kind!");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/100346
More information about the cfe-commits
mailing list