@@ -3000,58 +3000,15 @@ static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context,
3000
3000
3001
3001
enum ArmStreamingType { ArmNonStreaming, ArmStreaming, ArmStreamingCompatible };
3002
3002
3003
- static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) {
3004
- if (FD->hasAttr<ArmLocallyStreamingAttr>())
3005
- return ArmStreaming;
3006
- if (const auto *T = FD->getType()->getAs<FunctionProtoType>()) {
3007
- if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
3008
- return ArmStreaming;
3009
- if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask)
3010
- return ArmStreamingCompatible;
3011
- }
3012
- return ArmNonStreaming;
3013
- }
3014
-
3015
- static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
3016
- const FunctionDecl *FD,
3017
- ArmStreamingType BuiltinType) {
3018
- ArmStreamingType FnType = getArmStreamingFnType(FD);
3019
-
3020
- if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) {
3021
- S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
3022
- << TheCall->getSourceRange() << "streaming";
3023
- }
3024
-
3025
- if (FnType == ArmStreamingCompatible &&
3026
- BuiltinType != ArmStreamingCompatible) {
3027
- S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
3028
- << TheCall->getSourceRange() << "streaming compatible";
3029
- return;
3030
- }
3031
- }
3032
-
3033
- bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
3034
- // Range check SVE intrinsics that take immediate values.
3035
- SmallVector<std::tuple<int,int,int>, 3> ImmChecks;
3036
-
3037
- switch (BuiltinID) {
3038
- default:
3039
- return false;
3040
- #define GET_SVE_IMMEDIATE_CHECK
3041
- #include "clang/Basic/arm_sve_sema_rangechecks.inc"
3042
- #undef GET_SVE_IMMEDIATE_CHECK
3043
- #define GET_SME_IMMEDIATE_CHECK
3044
- #include "clang/Basic/arm_sme_sema_rangechecks.inc"
3045
- #undef GET_SME_IMMEDIATE_CHECK
3046
- }
3047
-
3003
+ bool Sema::ParseSVEImmChecks(
3004
+ CallExpr *TheCall, SmallVector<std::tuple<int, int, int>, 3> &ImmChecks) {
3048
3005
// Perform all the immediate checks for this builtin call.
3049
3006
bool HasError = false;
3050
3007
for (auto &I : ImmChecks) {
3051
3008
int ArgNum, CheckTy, ElementSizeInBits;
3052
3009
std::tie(ArgNum, CheckTy, ElementSizeInBits) = I;
3053
3010
3054
- typedef bool(*OptionSetCheckFnTy)(int64_t Value);
3011
+ typedef bool (*OptionSetCheckFnTy)(int64_t Value);
3055
3012
3056
3013
// Function that checks whether the operand (ArgNum) is an immediate
3057
3014
// that is one of the predefined values.
@@ -3183,6 +3140,54 @@ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
3183
3140
return HasError;
3184
3141
}
3185
3142
3143
+ static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) {
3144
+ if (FD->hasAttr<ArmLocallyStreamingAttr>())
3145
+ return ArmStreaming;
3146
+ if (const auto *T = FD->getType()->getAs<FunctionProtoType>()) {
3147
+ if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
3148
+ return ArmStreaming;
3149
+ if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask)
3150
+ return ArmStreamingCompatible;
3151
+ }
3152
+ return ArmNonStreaming;
3153
+ }
3154
+
3155
+ static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
3156
+ const FunctionDecl *FD,
3157
+ ArmStreamingType BuiltinType) {
3158
+ ArmStreamingType FnType = getArmStreamingFnType(FD);
3159
+
3160
+ if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) {
3161
+ S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
3162
+ << TheCall->getSourceRange() << "streaming";
3163
+ }
3164
+
3165
+ if (FnType == ArmStreamingCompatible &&
3166
+ BuiltinType != ArmStreamingCompatible) {
3167
+ S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin)
3168
+ << TheCall->getSourceRange() << "streaming compatible";
3169
+ return;
3170
+ }
3171
+ }
3172
+
3173
+ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
3174
+ // Range check SVE intrinsics that take immediate values.
3175
+ SmallVector<std::tuple<int, int, int>, 3> ImmChecks;
3176
+
3177
+ switch (BuiltinID) {
3178
+ default:
3179
+ return false;
3180
+ #define GET_SVE_IMMEDIATE_CHECK
3181
+ #include "clang/Basic/arm_sve_sema_rangechecks.inc"
3182
+ #undef GET_SVE_IMMEDIATE_CHECK
3183
+ #define GET_SME_IMMEDIATE_CHECK
3184
+ #include "clang/Basic/arm_sme_sema_rangechecks.inc"
3185
+ #undef GET_SME_IMMEDIATE_CHECK
3186
+ }
3187
+
3188
+ return ParseSVEImmChecks(TheCall, ImmChecks);
3189
+ }
3190
+
3186
3191
bool Sema::CheckNeonBuiltinFunctionCall(const TargetInfo &TI,
3187
3192
unsigned BuiltinID, CallExpr *TheCall) {
3188
3193
if (const FunctionDecl *FD = getCurFunctionDecl()) {
0 commit comments