30 if (BuiltinID == AArch64::BI__builtin_arm_irg) {
41 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
50 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_integer)
58 if (BuiltinID == AArch64::BI__builtin_arm_addg) {
68 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
79 if (BuiltinID == AArch64::BI__builtin_arm_gmi) {
90 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
95 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_integer)
97 TheCall->
setType(Context.IntTy);
101 if (BuiltinID == AArch64::BI__builtin_arm_ldg ||
102 BuiltinID == AArch64::BI__builtin_arm_stg) {
112 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
117 if (BuiltinID == AArch64::BI__builtin_arm_ldg)
118 TheCall->
setType(FirstArgType);
122 if (BuiltinID == AArch64::BI__builtin_arm_subp) {
135 auto isNull = [&](
Expr *
E) ->
bool {
136 return E->isNullPointerConstant(Context,
142 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
146 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
154 if (!Context.typesAreCompatible(
155 Context.getCanonicalType(pointeeA).getUnqualifiedType(),
156 Context.getCanonicalType(pointeeB).getUnqualifiedType())) {
158 diag::err_typecheck_sub_ptr_compatible)
179 TheCall->
setType(Context.LongLongTy);
182 assert(
false &&
"Unhandled ARM MTE intrinsic");
189 int ArgNum,
unsigned ExpectedFieldNum,
191 bool IsARMBuiltin = BuiltinID == ARM::BI__builtin_arm_rsr64 ||
192 BuiltinID == ARM::BI__builtin_arm_wsr64 ||
193 BuiltinID == ARM::BI__builtin_arm_rsr ||
194 BuiltinID == ARM::BI__builtin_arm_rsrp ||
195 BuiltinID == ARM::BI__builtin_arm_wsr ||
196 BuiltinID == ARM::BI__builtin_arm_wsrp;
197 bool IsAArch64Builtin = BuiltinID == AArch64::BI__builtin_arm_rsr64 ||
198 BuiltinID == AArch64::BI__builtin_arm_wsr64 ||
199 BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
200 BuiltinID == AArch64::BI__builtin_arm_wsr128 ||
201 BuiltinID == AArch64::BI__builtin_arm_rsr ||
202 BuiltinID == AArch64::BI__builtin_arm_rsrp ||
203 BuiltinID == AArch64::BI__builtin_arm_wsr ||
204 BuiltinID == AArch64::BI__builtin_arm_wsrp;
205 assert((IsARMBuiltin || IsAArch64Builtin) &&
"Unexpected ARM builtin.");
220 Reg.split(Fields,
":");
222 if (Fields.size() != ExpectedFieldNum && !(AllowName && Fields.size() == 1))
230 if (Fields.size() > 1) {
231 bool FiveFields = Fields.size() == 5;
233 bool ValidString =
true;
235 ValidString &= Fields[0].starts_with_insensitive(
"cp") ||
236 Fields[0].starts_with_insensitive(
"p");
238 Fields[0] = Fields[0].drop_front(
239 Fields[0].starts_with_insensitive(
"cp") ? 2 : 1);
241 ValidString &= Fields[2].starts_with_insensitive(
"c");
243 Fields[2] = Fields[2].drop_front(1);
246 ValidString &= Fields[3].starts_with_insensitive(
"c");
248 Fields[3] = Fields[3].drop_front(1);
254 Ranges.append({IsAArch64Builtin ? 1 : 15, 7, 15, 15, 7});
256 Ranges.append({15, 7, 15});
258 for (
unsigned i = 0; i < Fields.size(); ++i) {
260 ValidString &= !Fields[i].getAsInteger(10, IntField);
261 ValidString &= (IntField >= 0 && IntField <= Ranges[i]);
267 }
else if (IsAArch64Builtin && Fields.size() == 1) {
275 if (BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
276 BuiltinID == AArch64::BI__builtin_arm_wsr128)
281 auto MaxLimit = llvm::StringSwitch<std::optional<unsigned>>(Reg)
282 .CaseLower(
"spsel", 15)
283 .CaseLower(
"daifclr", 15)
284 .CaseLower(
"daifset", 15)
285 .CaseLower(
"pan", 15)
286 .CaseLower(
"uao", 15)
287 .CaseLower(
"dit", 15)
288 .CaseLower(
"ssbs", 15)
289 .CaseLower(
"tco", 15)
290 .CaseLower(
"allint", 1)
292 .Default(std::nullopt);
319static unsigned RFT(
unsigned t,
bool shift =
false,
bool ForceQuad =
false) {
321 int IsQuad = ForceQuad ?
true :
Type.isQuad();
322 switch (
Type.getEltType()) {
325 return shift ? 7 : (8 << IsQuad) - 1;
328 return shift ? 15 : (4 << IsQuad) - 1;
330 return shift ? 31 : (2 << IsQuad) - 1;
333 return shift ? 63 : (1 << IsQuad) - 1;
335 return shift ? 127 : (1 << IsQuad) - 1;
337 assert(!shift &&
"cannot shift float types!");
338 return (4 << IsQuad) - 1;
340 assert(!shift &&
"cannot shift float types!");
341 return (2 << IsQuad) - 1;
343 assert(!shift &&
"cannot shift float types!");
344 return (1 << IsQuad) - 1;
346 assert(!shift &&
"cannot shift float types!");
347 return (4 << IsQuad) - 1;
349 llvm_unreachable(
"Invalid NeonTypeFlag!");
356 bool IsPolyUnsigned,
bool IsInt64Long) {
390 llvm_unreachable(
"Invalid NeonTypeFlag!");
410 bool HasError =
false;
411 for (
auto &I : ImmChecks) {
412 int ArgNum, CheckTy, ElementSizeInBits;
413 std::tie(ArgNum, CheckTy, ElementSizeInBits) = I;
415 typedef bool (*OptionSetCheckFnTy)(int64_t
Value);
419 auto CheckImmediateInSet = [&](OptionSetCheckFnTy CheckImm,
420 int ErrDiag) ->
bool {
431 if (!CheckImm(Imm.getSExtValue()))
437 case SVETypeFlags::ImmCheck0_31:
441 case SVETypeFlags::ImmCheck0_13:
445 case SVETypeFlags::ImmCheck1_16:
449 case SVETypeFlags::ImmCheck0_7:
453 case SVETypeFlags::ImmCheck1_1:
457 case SVETypeFlags::ImmCheck1_3:
461 case SVETypeFlags::ImmCheck1_7:
465 case SVETypeFlags::ImmCheckExtract:
467 (2048 / ElementSizeInBits) - 1))
470 case SVETypeFlags::ImmCheckShiftRight:
475 case SVETypeFlags::ImmCheckShiftRightNarrow:
477 ElementSizeInBits / 2))
480 case SVETypeFlags::ImmCheckShiftLeft:
482 ElementSizeInBits - 1))
485 case SVETypeFlags::ImmCheckLaneIndex:
487 (128 / (1 * ElementSizeInBits)) - 1))
490 case SVETypeFlags::ImmCheckLaneIndexCompRotate:
492 (128 / (2 * ElementSizeInBits)) - 1))
495 case SVETypeFlags::ImmCheckLaneIndexDot:
497 (128 / (4 * ElementSizeInBits)) - 1))
500 case SVETypeFlags::ImmCheckComplexRot90_270:
501 if (CheckImmediateInSet([](int64_t
V) {
return V == 90 ||
V == 270; },
502 diag::err_rotation_argument_to_cadd))
505 case SVETypeFlags::ImmCheckComplexRotAll90:
506 if (CheckImmediateInSet(
508 return V == 0 ||
V == 90 ||
V == 180 ||
V == 270;
510 diag::err_rotation_argument_to_cmla))
513 case SVETypeFlags::ImmCheck0_1:
517 case SVETypeFlags::ImmCheck0_2:
521 case SVETypeFlags::ImmCheck0_3:
525 case SVETypeFlags::ImmCheck0_0:
529 case SVETypeFlags::ImmCheck0_15:
533 case SVETypeFlags::ImmCheck0_255:
537 case SVETypeFlags::ImmCheck2_4_Mul2:
549 if (FD->
hasAttr<ArmLocallyStreamingAttr>())
553 if (FPT->getAArch64SMEAttributes() &
556 if (FPT->getAArch64SMEAttributes() &
567 unsigned BuiltinID) {
575 auto DisableFeatures = [](llvm::StringMap<bool> &Map, StringRef S) {
576 for (StringRef K : Map.keys())
577 if (K.starts_with(S))
581 llvm::StringMap<bool> CallerFeatureMapWithoutSVE;
583 DisableFeatures(CallerFeatureMapWithoutSVE,
"sve");
589 llvm::StringMap<bool> CallerFeatureMapWithoutSME;
591 DisableFeatures(CallerFeatureMapWithoutSME,
"sme");
603 StringRef BuiltinTargetGuards(
606 BuiltinTargetGuards, CallerFeatureMapWithoutSME);
608 BuiltinTargetGuards, CallerFeatureMapWithoutSVE);
610 if ((SatisfiesSVE && SatisfiesSME) ||
613 else if (SatisfiesSVE)
615 else if (SatisfiesSME)
624 S.
Diag(TheCall->
getBeginLoc(), diag::err_attribute_arm_sm_incompat_builtin)
628 S.
Diag(TheCall->
getBeginLoc(), diag::err_attribute_arm_sm_incompat_builtin)
640 (FD->
hasAttr<ArmNewAttr>() && FD->
getAttr<ArmNewAttr>()->isNewZA());
647 (FD->
hasAttr<ArmNewAttr>() && FD->
getAttr<ArmNewAttr>()->isNewZT0());
654#define GET_SME_BUILTIN_GET_STATE
655#include "clang/Basic/arm_sme_builtins_za_state.inc"
656#undef GET_SME_BUILTIN_GET_STATE
666#define GET_SME_STREAMING_ATTRS
667#include "clang/Basic/arm_sme_streaming_attrs.inc"
668#undef GET_SME_STREAMING_ATTRS
677 diag::warn_attribute_arm_za_builtin_no_za_state)
682 diag::warn_attribute_arm_zt0_builtin_no_zt0_state)
692#define GET_SME_IMMEDIATE_CHECK
693#include "clang/Basic/arm_sme_sema_rangechecks.inc"
694#undef GET_SME_IMMEDIATE_CHECK
706#define GET_SVE_STREAMING_ATTRS
707#include "clang/Basic/arm_sve_streaming_attrs.inc"
708#undef GET_SVE_STREAMING_ATTRS
720#define GET_SVE_IMMEDIATE_CHECK
721#include "clang/Basic/arm_sve_sema_rangechecks.inc"
722#undef GET_SVE_IMMEDIATE_CHECK
736#define GET_NEON_BUILTINS
737#define TARGET_BUILTIN(id, ...) case NEON::BI##id:
738#define BUILTIN(id, ...) case NEON::BI##id:
739#include "clang/Basic/arm_neon.inc"
746#undef GET_NEON_BUILTINS
754 bool HasConstPtr =
false;
756#define GET_NEON_OVERLOAD_CHECK
757#include "clang/Basic/arm_fp16.inc"
758#include "clang/Basic/arm_neon.inc"
759#undef GET_NEON_OVERLOAD_CHECK
769 TV =
Result.getLimitedValue(64);
770 if ((TV > 63) || (mask & (1ULL << TV)) == 0)
775 if (PtrArgNum >= 0) {
779 Arg = ICE->getSubExpr();
783 llvm::Triple::ArchType Arch = TI.
getTriple().getArch();
784 bool IsPolyUnsigned = Arch == llvm::Triple::aarch64 ||
785 Arch == llvm::Triple::aarch64_32 ||
786 Arch == llvm::Triple::aarch64_be;
789 IsPolyUnsigned, IsInt64Long);
804 unsigned i = 0, l = 0, u = 0;
808#define GET_NEON_IMMEDIATE_CHECK
809#include "clang/Basic/arm_fp16.inc"
810#include "clang/Basic/arm_neon.inc"
811#undef GET_NEON_IMMEDIATE_CHECK
822#include "clang/Basic/arm_mve_builtin_sema.inc"
833#include "clang/Basic/arm_cde_builtin_sema.inc"
843 const Expr *CoprocArg,
854 int64_t CoprocNo = CoprocNoAP.getExtValue();
855 assert(CoprocNo >= 0 &&
"Coprocessor immediate must be non-negative");
858 bool IsCDECoproc = CoprocNo <= 7 && (CDECoprocMask & (1 << CoprocNo));
860 if (IsCDECoproc != WantCDE)
870 assert((BuiltinID == ARM::BI__builtin_arm_ldrex ||
871 BuiltinID == ARM::BI__builtin_arm_ldaex ||
872 BuiltinID == ARM::BI__builtin_arm_strex ||
873 BuiltinID == ARM::BI__builtin_arm_stlex ||
874 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
875 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
876 BuiltinID == AArch64::BI__builtin_arm_strex ||
877 BuiltinID == AArch64::BI__builtin_arm_stlex) &&
878 "unexpected ARM builtin");
879 bool IsLdrex = BuiltinID == ARM::BI__builtin_arm_ldrex ||
880 BuiltinID == ARM::BI__builtin_arm_ldaex ||
881 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
882 BuiltinID == AArch64::BI__builtin_arm_ldaex;
896 Expr *PointerArg = TheCall->
getArg(IsLdrex ? 0 : 1);
901 PointerArg = PointerArgRes.
get();
921 CastNeeded = CK_BitCast;
922 Diag(DRE->
getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers)
923 << PointerArg->
getType() << Context.getPointerType(AddrType)
928 AddrType = Context.getPointerType(AddrType);
932 PointerArg = PointerArgRes.
get();
934 TheCall->
setArg(IsLdrex ? 0 : 1, PointerArg);
939 Diag(DRE->
getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
945 if (Context.getTypeSize(ValType) > MaxWidth) {
946 assert(MaxWidth == 64 &&
"Diagnostic unexpectedly inaccurate");
947 Diag(DRE->
getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size)
974 Context, ValType,
false);
982 TheCall->
setType(Context.IntTy);
989 if (BuiltinID == ARM::BI__builtin_arm_ldrex ||
990 BuiltinID == ARM::BI__builtin_arm_ldaex ||
991 BuiltinID == ARM::BI__builtin_arm_strex ||
992 BuiltinID == ARM::BI__builtin_arm_stlex) {
996 if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
1001 if (BuiltinID == ARM::BI__builtin_arm_rsr64 ||
1002 BuiltinID == ARM::BI__builtin_arm_wsr64)
1005 if (BuiltinID == ARM::BI__builtin_arm_rsr ||
1006 BuiltinID == ARM::BI__builtin_arm_rsrp ||
1007 BuiltinID == ARM::BI__builtin_arm_wsr ||
1008 BuiltinID == ARM::BI__builtin_arm_wsrp)
1021 switch (BuiltinID) {
1024 case ARM::BI__builtin_arm_ssat:
1026 case ARM::BI__builtin_arm_usat:
1028 case ARM::BI__builtin_arm_ssat16:
1030 case ARM::BI__builtin_arm_usat16:
1032 case ARM::BI__builtin_arm_vcvtr_f:
1033 case ARM::BI__builtin_arm_vcvtr_d:
1035 case ARM::BI__builtin_arm_dmb:
1036 case ARM::BI__builtin_arm_dsb:
1037 case ARM::BI__builtin_arm_isb:
1038 case ARM::BI__builtin_arm_dbg:
1040 case ARM::BI__builtin_arm_cdp:
1041 case ARM::BI__builtin_arm_cdp2:
1042 case ARM::BI__builtin_arm_mcr:
1043 case ARM::BI__builtin_arm_mcr2:
1044 case ARM::BI__builtin_arm_mrc:
1045 case ARM::BI__builtin_arm_mrc2:
1046 case ARM::BI__builtin_arm_mcrr:
1047 case ARM::BI__builtin_arm_mcrr2:
1048 case ARM::BI__builtin_arm_mrrc:
1049 case ARM::BI__builtin_arm_mrrc2:
1050 case ARM::BI__builtin_arm_ldc:
1051 case ARM::BI__builtin_arm_ldcl:
1052 case ARM::BI__builtin_arm_ldc2:
1053 case ARM::BI__builtin_arm_ldc2l:
1054 case ARM::BI__builtin_arm_stc:
1055 case ARM::BI__builtin_arm_stcl:
1056 case ARM::BI__builtin_arm_stc2:
1057 case ARM::BI__builtin_arm_stc2l:
1067 if (BuiltinID == AArch64::BI__builtin_arm_ldrex ||
1068 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
1069 BuiltinID == AArch64::BI__builtin_arm_strex ||
1070 BuiltinID == AArch64::BI__builtin_arm_stlex) {
1074 if (BuiltinID == AArch64::BI__builtin_arm_prefetch) {
1081 if (BuiltinID == AArch64::BI__builtin_arm_rsr64 ||
1082 BuiltinID == AArch64::BI__builtin_arm_wsr64 ||
1083 BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
1084 BuiltinID == AArch64::BI__builtin_arm_wsr128)
1088 if (BuiltinID == AArch64::BI__builtin_arm_irg ||
1089 BuiltinID == AArch64::BI__builtin_arm_addg ||
1090 BuiltinID == AArch64::BI__builtin_arm_gmi ||
1091 BuiltinID == AArch64::BI__builtin_arm_ldg ||
1092 BuiltinID == AArch64::BI__builtin_arm_stg ||
1093 BuiltinID == AArch64::BI__builtin_arm_subp) {
1097 if (BuiltinID == AArch64::BI__builtin_arm_rsr ||
1098 BuiltinID == AArch64::BI__builtin_arm_rsrp ||
1099 BuiltinID == AArch64::BI__builtin_arm_wsr ||
1100 BuiltinID == AArch64::BI__builtin_arm_wsrp)
1106 if (BuiltinID == AArch64::BI_ReadStatusReg ||
1107 BuiltinID == AArch64::BI_WriteStatusReg)
1110 if (BuiltinID == AArch64::BI__getReg)
1113 if (BuiltinID == AArch64::BI__break)
1116 if (BuiltinID == AArch64::BI__hlt)
1130 unsigned i = 0, l = 0, u = 0;
1131 switch (BuiltinID) {
1132 default:
return false;
1133 case AArch64::BI__builtin_arm_dmb:
1134 case AArch64::BI__builtin_arm_dsb:
1135 case AArch64::BI__builtin_arm_isb: l = 0; u = 15;
break;
1136 case AArch64::BI__builtin_arm_tcancel: l = 0; u = 65535;
break;
1143struct IntrinToName {
1152 const char *IntrinNames) {
1153 AliasName.consume_front(
"__arm_");
1154 const IntrinToName *It =
1155 llvm::lower_bound(Map, BuiltinID, [](
const IntrinToName &L,
unsigned Id) {
1158 if (It == Map.end() || It->Id != BuiltinID)
1160 StringRef
FullName(&IntrinNames[It->FullName]);
1163 if (It->ShortName == -1)
1165 StringRef
ShortName(&IntrinNames[It->ShortName]);
1170#include "clang/Basic/arm_mve_builtin_aliases.inc"
1178#include "clang/Basic/arm_cde_builtin_aliases.inc"
1199 Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
1206 StringRef AliasName = cast<FunctionDecl>(
D)->getIdentifier()->getName();
1208 bool IsAArch64 = Context.getTargetInfo().getTriple().isAArch64();
1213 Diag(AL.
getLoc(), diag::err_attribute_arm_builtin_alias);
1217 D->addAttr(::new (Context) ArmBuiltinAliasAttr(Context, AL, Ident));
1223 auto CheckForIncompatibleAttr =
1225 StringRef IncompatibleStateName) {
1226 if (CurrentState == IncompatibleState) {
1227 S.
Diag(AL.
getLoc(), diag::err_attributes_are_not_compatible)
1228 << (std::string(
"'__arm_new(\"") + StateName.str() +
"\")'")
1229 << (std::string(
"'") + IncompatibleStateName.str() +
"(\"" +
1230 StateName.str() +
"\")'")
1245 Diag(AL.
getLoc(), diag::err_missing_arm_state) << AL;
1250 std::vector<StringRef> NewState;
1251 if (
const auto *ExistingAttr =
D->getAttr<ArmNewAttr>()) {
1252 for (StringRef S : ExistingAttr->newArgs())
1253 NewState.push_back(S);
1257 bool HasZT0 =
false;
1258 for (
unsigned I = 0,
E = AL.
getNumArgs(); I !=
E; ++I) {
1259 StringRef StateName;
1264 if (StateName ==
"za")
1266 else if (StateName ==
"zt0")
1269 Diag(LiteralLoc, diag::err_unknown_arm_state) << StateName;
1274 if (!llvm::is_contained(NewState, StateName))
1275 NewState.push_back(StateName);
1278 if (
auto *FPT = dyn_cast<FunctionProtoType>(
D->getFunctionType())) {
1291 D->dropAttr<ArmNewAttr>();
1298 Diag(AL.
getLoc(), diag::err_attribute_not_clinkage) << AL;
1302 const auto *FD = cast<FunctionDecl>(
D);
1303 if (!FD->isExternallyVisible()) {
1304 Diag(AL.
getLoc(), diag::warn_attribute_cmse_entry_static);
1314 Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 1;
1326 ARMInterruptAttr::InterruptType
Kind;
1327 if (!ARMInterruptAttr::ConvertStrToInterruptType(Str,
Kind)) {
1328 Diag(AL.
getLoc(), diag::warn_attribute_type_not_supported)
1329 << AL << Str << ArgLoc;
1335 Diag(
D->getLocation(), diag::warn_arm_interrupt_vfp_clobber);
static constexpr Builtin::Info BuiltinInfo[]
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
This file declares semantic analysis functions specific to ARM.
Enumerates target-specific builtins in their own namespaces within namespace clang.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Builtin::Context & BuiltinInfo
CanQualType UnsignedLongTy
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
const TargetInfo & getTargetInfo() const
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
SourceLocation getLoc() const
This class is used for builtin types like 'int'.
unsigned getAuxBuiltinID(unsigned ID) const
Return real builtin ID (i.e.
const char * getRequiredFeatures(unsigned ID) const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
SourceLocation getBeginLoc() const LLVM_READONLY
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
A reference to a declared variable, function, enum, etc.
SourceLocation getBeginLoc() const LLVM_READONLY
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
unsigned getAArch64SMEAttributes() const
Return a bitmask describing the SME attributes on the function type, see AArch64SMETypeAttributes for...
static ArmStateValue getArmZT0State(unsigned AttrBits)
static ArmStateValue getArmZAState(unsigned AttrBits)
@ SME_PStateSMEnabledMask
@ SME_PStateSMCompatibleMask
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Describes an entity that is being initialized.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
Flags to identify the types for overloaded Neon builtins.
EltType getEltType() const
ParsedAttr - Represents a syntactic attribute.
IdentifierLoc * getArgAsIdent(unsigned Arg) const
void setInvalid(bool b=true) const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
bool isArgIdent(unsigned Arg) const
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
QualType withConst() const
void addConst()
Add the const type qualifier to this QualType.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
QualType withVolatile() const
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
const Type * getTypePtrOrNull() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
bool ParseSVEImmChecks(CallExpr *TheCall, llvm::SmallVector< std::tuple< int, int, int >, 3 > &ImmChecks)
bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg, bool WantCDE)
bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL)
@ ArmStreaming
Intrinsic is only available in normal mode.
@ VerifyRuntimeMode
Intrinsic is available both in normal and Streaming-SVE mode.
@ ArmStreamingCompatible
Intrinsic is only available in Streaming-SVE mode.
void handleNewAttr(Decl *D, const ParsedAttr &AL)
bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall, unsigned MaxWidth)
bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall)
BuiltinARMMemoryTaggingCall - Handle calls of memory tagging extensions.
void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL)
bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum, unsigned ExpectedFieldNum, bool AllowName)
BuiltinARMSpecialReg - Handle a check if argument ArgNum of CallExpr TheCall is an ARM/AArch64 specia...
bool SmeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
Sema - This implements semantic analysis and AST building for C.
bool BuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum, unsigned Multiple)
BuiltinConstantArgMultiple - Handle a check if argument ArgNum of CallExpr TheCall is a constant expr...
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
ExprResult DefaultLvalueConversion(Expr *E)
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
bool BuiltinConstantArg(CallExpr *TheCall, int ArgNum, llvm::APSInt &Result)
BuiltinConstantArg - Handle a check if argument ArgNum of CallExpr TheCall is a constant expression.
bool isConstantEvaluatedContext() const
bool checkArgCount(CallExpr *Call, unsigned DesiredArgCount)
Checks that a call expression's argument count is the desired number.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
bool BuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low, int High, bool RangeIsError=true)
BuiltinConstantArgRange - Handle a check if argument ArgNum of CallExpr TheCall is a constant express...
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
Encodes a location in the source.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
Exposes information about the current target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
IntType getInt64Type() const
uint32_t getARMCDECoprocMask() const
For ARM targets returns a mask defining which coprocessors are configured as Custom Datapath.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isFloatingType() const
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Defines the clang::TargetInfo interface.
bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)
Returns true if the required target features of a builtin function are enabled.
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
The JSON file list parser is used to communicate input to InstallAPI.
static bool hasArmZAState(const FunctionDecl *FD)
static bool BuiltinAliasValid(unsigned BuiltinID, StringRef AliasName, ArrayRef< IntrinToName > Map, const char *IntrinNames)
static unsigned RFT(unsigned t, bool shift=false, bool ForceQuad=false)
static ArmSMEState getSMEState(unsigned BuiltinID)
static bool checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall, const FunctionDecl *FD, SemaARM::ArmStreamingType BuiltinType, unsigned BuiltinID)
SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD)
@ AANT_ArgumentIdentifier
@ Result
The result type of a method or function.
static bool hasArmZT0State(const FunctionDecl *FD)
CastKind
CastKind - The kind of operation required for a conversion.
const FunctionProtoType * T
static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context, bool IsPolyUnsigned, bool IsInt64Long)
getNeonEltType - Return the QualType corresponding to the elements of the vector type specified by th...
static bool checkNewAttrMutualExclusion(Sema &S, const ParsedAttr &AL, const FunctionProtoType *FPT, FunctionType::ArmStateValue CurrentState, StringRef StateName)