29 if (BuiltinID == AArch64::BI__builtin_arm_irg) {
40 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
49 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_integer)
57 if (BuiltinID == AArch64::BI__builtin_arm_addg) {
67 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
78 if (BuiltinID == AArch64::BI__builtin_arm_gmi) {
89 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
94 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_integer)
96 TheCall->
setType(Context.IntTy);
100 if (BuiltinID == AArch64::BI__builtin_arm_ldg ||
101 BuiltinID == AArch64::BI__builtin_arm_stg) {
111 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
116 if (BuiltinID == AArch64::BI__builtin_arm_ldg)
117 TheCall->
setType(FirstArgType);
121 if (BuiltinID == AArch64::BI__builtin_arm_subp) {
134 auto isNull = [&](
Expr *
E) ->
bool {
135 return E->isNullPointerConstant(Context,
141 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
145 return Diag(TheCall->
getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
153 if (!Context.typesAreCompatible(
154 Context.getCanonicalType(pointeeA).getUnqualifiedType(),
155 Context.getCanonicalType(pointeeB).getUnqualifiedType())) {
157 diag::err_typecheck_sub_ptr_compatible)
178 TheCall->
setType(Context.LongLongTy);
181 assert(
false &&
"Unhandled ARM MTE intrinsic");
188 int ArgNum,
unsigned ExpectedFieldNum,
190 bool IsARMBuiltin = BuiltinID == ARM::BI__builtin_arm_rsr64 ||
191 BuiltinID == ARM::BI__builtin_arm_wsr64 ||
192 BuiltinID == ARM::BI__builtin_arm_rsr ||
193 BuiltinID == ARM::BI__builtin_arm_rsrp ||
194 BuiltinID == ARM::BI__builtin_arm_wsr ||
195 BuiltinID == ARM::BI__builtin_arm_wsrp;
196 bool IsAArch64Builtin = BuiltinID == AArch64::BI__builtin_arm_rsr64 ||
197 BuiltinID == AArch64::BI__builtin_arm_wsr64 ||
198 BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
199 BuiltinID == AArch64::BI__builtin_arm_wsr128 ||
200 BuiltinID == AArch64::BI__builtin_arm_rsr ||
201 BuiltinID == AArch64::BI__builtin_arm_rsrp ||
202 BuiltinID == AArch64::BI__builtin_arm_wsr ||
203 BuiltinID == AArch64::BI__builtin_arm_wsrp;
204 assert((IsARMBuiltin || IsAArch64Builtin) &&
"Unexpected ARM builtin.");
219 Reg.split(Fields,
":");
221 if (Fields.size() != ExpectedFieldNum && !(AllowName && Fields.size() == 1))
229 if (Fields.size() > 1) {
230 bool FiveFields = Fields.size() == 5;
232 bool ValidString =
true;
234 ValidString &= Fields[0].starts_with_insensitive(
"cp") ||
235 Fields[0].starts_with_insensitive(
"p");
237 Fields[0] = Fields[0].drop_front(
238 Fields[0].starts_with_insensitive(
"cp") ? 2 : 1);
240 ValidString &= Fields[2].starts_with_insensitive(
"c");
242 Fields[2] = Fields[2].drop_front(1);
245 ValidString &= Fields[3].starts_with_insensitive(
"c");
247 Fields[3] = Fields[3].drop_front(1);
253 Ranges.append({IsAArch64Builtin ? 1 : 15, 7, 15, 15, 7});
255 Ranges.append({15, 7, 15});
257 for (
unsigned i = 0; i < Fields.size(); ++i) {
259 ValidString &= !Fields[i].getAsInteger(10, IntField);
260 ValidString &= (IntField >= 0 && IntField <= Ranges[i]);
266 }
else if (IsAArch64Builtin && Fields.size() == 1) {
274 if (BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
275 BuiltinID == AArch64::BI__builtin_arm_wsr128)
280 auto MaxLimit = llvm::StringSwitch<std::optional<unsigned>>(Reg)
281 .CaseLower(
"spsel", 15)
282 .CaseLower(
"daifclr", 15)
283 .CaseLower(
"daifset", 15)
284 .CaseLower(
"pan", 15)
285 .CaseLower(
"uao", 15)
286 .CaseLower(
"dit", 15)
287 .CaseLower(
"ssbs", 15)
288 .CaseLower(
"tco", 15)
289 .CaseLower(
"allint", 1)
291 .Default(std::nullopt);
318static unsigned RFT(
unsigned t,
bool shift =
false,
bool ForceQuad =
false) {
320 int IsQuad = ForceQuad ?
true :
Type.isQuad();
321 switch (
Type.getEltType()) {
324 return shift ? 7 : (8 << IsQuad) - 1;
327 return shift ? 15 : (4 << IsQuad) - 1;
329 return shift ? 31 : (2 << IsQuad) - 1;
332 return shift ? 63 : (1 << IsQuad) - 1;
334 return shift ? 127 : (1 << IsQuad) - 1;
336 assert(!shift &&
"cannot shift float types!");
337 return (4 << IsQuad) - 1;
339 assert(!shift &&
"cannot shift float types!");
340 return (2 << IsQuad) - 1;
342 assert(!shift &&
"cannot shift float types!");
343 return (1 << IsQuad) - 1;
345 assert(!shift &&
"cannot shift float types!");
346 return (4 << IsQuad) - 1;
348 llvm_unreachable(
"Invalid NeonTypeFlag!");
355 bool IsPolyUnsigned,
bool IsInt64Long) {
389 llvm_unreachable(
"Invalid NeonTypeFlag!");
409 bool HasError =
false;
410 for (
auto &I : ImmChecks) {
411 int ArgNum, CheckTy, ElementSizeInBits;
412 std::tie(ArgNum, CheckTy, ElementSizeInBits) = I;
414 typedef bool (*OptionSetCheckFnTy)(int64_t
Value);
418 auto CheckImmediateInSet = [&](OptionSetCheckFnTy CheckImm,
419 int ErrDiag) ->
bool {
430 if (!CheckImm(Imm.getSExtValue()))
436 case SVETypeFlags::ImmCheck0_31:
440 case SVETypeFlags::ImmCheck0_13:
444 case SVETypeFlags::ImmCheck1_16:
448 case SVETypeFlags::ImmCheck0_7:
452 case SVETypeFlags::ImmCheck1_1:
456 case SVETypeFlags::ImmCheck1_3:
460 case SVETypeFlags::ImmCheck1_7:
464 case SVETypeFlags::ImmCheckExtract:
466 (2048 / ElementSizeInBits) - 1))
469 case SVETypeFlags::ImmCheckShiftRight:
474 case SVETypeFlags::ImmCheckShiftRightNarrow:
476 ElementSizeInBits / 2))
479 case SVETypeFlags::ImmCheckShiftLeft:
481 ElementSizeInBits - 1))
484 case SVETypeFlags::ImmCheckLaneIndex:
486 (128 / (1 * ElementSizeInBits)) - 1))
489 case SVETypeFlags::ImmCheckLaneIndexCompRotate:
491 (128 / (2 * ElementSizeInBits)) - 1))
494 case SVETypeFlags::ImmCheckLaneIndexDot:
496 (128 / (4 * ElementSizeInBits)) - 1))
499 case SVETypeFlags::ImmCheckComplexRot90_270:
500 if (CheckImmediateInSet([](int64_t
V) {
return V == 90 ||
V == 270; },
501 diag::err_rotation_argument_to_cadd))
504 case SVETypeFlags::ImmCheckComplexRotAll90:
505 if (CheckImmediateInSet(
507 return V == 0 ||
V == 90 ||
V == 180 ||
V == 270;
509 diag::err_rotation_argument_to_cmla))
512 case SVETypeFlags::ImmCheck0_1:
516 case SVETypeFlags::ImmCheck0_2:
520 case SVETypeFlags::ImmCheck0_3:
524 case SVETypeFlags::ImmCheck0_0:
528 case SVETypeFlags::ImmCheck0_15:
532 case SVETypeFlags::ImmCheck0_255:
536 case SVETypeFlags::ImmCheck2_4_Mul2:
548 if (FD->
hasAttr<ArmLocallyStreamingAttr>())
552 if (FPT->getAArch64SMEAttributes() &
555 if (FPT->getAArch64SMEAttributes() &
566 unsigned BuiltinID) {
574 auto DisableFeatures = [](llvm::StringMap<bool> &Map, StringRef S) {
575 for (StringRef K : Map.keys())
576 if (K.starts_with(S))
580 llvm::StringMap<bool> CallerFeatureMapWithoutSVE;
582 DisableFeatures(CallerFeatureMapWithoutSVE,
"sve");
588 llvm::StringMap<bool> CallerFeatureMapWithoutSME;
590 DisableFeatures(CallerFeatureMapWithoutSME,
"sme");
602 StringRef BuiltinTargetGuards(
605 BuiltinTargetGuards, CallerFeatureMapWithoutSME);
607 BuiltinTargetGuards, CallerFeatureMapWithoutSVE);
609 if ((SatisfiesSVE && SatisfiesSME) ||
612 else if (SatisfiesSVE)
614 else if (SatisfiesSME)
623 S.
Diag(TheCall->
getBeginLoc(), diag::err_attribute_arm_sm_incompat_builtin)
627 S.
Diag(TheCall->
getBeginLoc(), diag::err_attribute_arm_sm_incompat_builtin)
639 (FD->
hasAttr<ArmNewAttr>() && FD->
getAttr<ArmNewAttr>()->isNewZA());
646 (FD->
hasAttr<ArmNewAttr>() && FD->
getAttr<ArmNewAttr>()->isNewZT0());
653#define GET_SME_BUILTIN_GET_STATE
654#include "clang/Basic/arm_sme_builtins_za_state.inc"
655#undef GET_SME_BUILTIN_GET_STATE
665#define GET_SME_STREAMING_ATTRS
666#include "clang/Basic/arm_sme_streaming_attrs.inc"
667#undef GET_SME_STREAMING_ATTRS
676 diag::warn_attribute_arm_za_builtin_no_za_state)
681 diag::warn_attribute_arm_zt0_builtin_no_zt0_state)
691#define GET_SME_IMMEDIATE_CHECK
692#include "clang/Basic/arm_sme_sema_rangechecks.inc"
693#undef GET_SME_IMMEDIATE_CHECK
705#define GET_SVE_STREAMING_ATTRS
706#include "clang/Basic/arm_sve_streaming_attrs.inc"
707#undef GET_SVE_STREAMING_ATTRS
719#define GET_SVE_IMMEDIATE_CHECK
720#include "clang/Basic/arm_sve_sema_rangechecks.inc"
721#undef GET_SVE_IMMEDIATE_CHECK
735#define GET_NEON_BUILTINS
736#define TARGET_BUILTIN(id, ...) case NEON::BI##id:
737#define BUILTIN(id, ...) case NEON::BI##id:
738#include "clang/Basic/arm_neon.inc"
745#undef GET_NEON_BUILTINS
753 bool HasConstPtr =
false;
755#define GET_NEON_OVERLOAD_CHECK
756#include "clang/Basic/arm_fp16.inc"
757#include "clang/Basic/arm_neon.inc"
758#undef GET_NEON_OVERLOAD_CHECK
768 TV =
Result.getLimitedValue(64);
769 if ((TV > 63) || (mask & (1ULL << TV)) == 0)
774 if (PtrArgNum >= 0) {
778 Arg = ICE->getSubExpr();
782 llvm::Triple::ArchType Arch = TI.
getTriple().getArch();
783 bool IsPolyUnsigned = Arch == llvm::Triple::aarch64 ||
784 Arch == llvm::Triple::aarch64_32 ||
785 Arch == llvm::Triple::aarch64_be;
788 IsPolyUnsigned, IsInt64Long);
803 unsigned i = 0, l = 0, u = 0;
807#define GET_NEON_IMMEDIATE_CHECK
808#include "clang/Basic/arm_fp16.inc"
809#include "clang/Basic/arm_neon.inc"
810#undef GET_NEON_IMMEDIATE_CHECK
821#include "clang/Basic/arm_mve_builtin_sema.inc"
832#include "clang/Basic/arm_cde_builtin_sema.inc"
842 const Expr *CoprocArg,
853 int64_t CoprocNo = CoprocNoAP.getExtValue();
854 assert(CoprocNo >= 0 &&
"Coprocessor immediate must be non-negative");
857 bool IsCDECoproc = CoprocNo <= 7 && (CDECoprocMask & (1 << CoprocNo));
859 if (IsCDECoproc != WantCDE)
869 assert((BuiltinID == ARM::BI__builtin_arm_ldrex ||
870 BuiltinID == ARM::BI__builtin_arm_ldaex ||
871 BuiltinID == ARM::BI__builtin_arm_strex ||
872 BuiltinID == ARM::BI__builtin_arm_stlex ||
873 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
874 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
875 BuiltinID == AArch64::BI__builtin_arm_strex ||
876 BuiltinID == AArch64::BI__builtin_arm_stlex) &&
877 "unexpected ARM builtin");
878 bool IsLdrex = BuiltinID == ARM::BI__builtin_arm_ldrex ||
879 BuiltinID == ARM::BI__builtin_arm_ldaex ||
880 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
881 BuiltinID == AArch64::BI__builtin_arm_ldaex;
895 Expr *PointerArg = TheCall->
getArg(IsLdrex ? 0 : 1);
900 PointerArg = PointerArgRes.
get();
920 CastNeeded = CK_BitCast;
921 Diag(DRE->
getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers)
922 << PointerArg->
getType() << Context.getPointerType(AddrType)
927 AddrType = Context.getPointerType(AddrType);
931 PointerArg = PointerArgRes.
get();
933 TheCall->
setArg(IsLdrex ? 0 : 1, PointerArg);
938 Diag(DRE->
getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
944 if (Context.getTypeSize(ValType) > MaxWidth) {
945 assert(MaxWidth == 64 &&
"Diagnostic unexpectedly inaccurate");
946 Diag(DRE->
getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size)
973 Context, ValType,
false);
981 TheCall->
setType(Context.IntTy);
988 if (BuiltinID == ARM::BI__builtin_arm_ldrex ||
989 BuiltinID == ARM::BI__builtin_arm_ldaex ||
990 BuiltinID == ARM::BI__builtin_arm_strex ||
991 BuiltinID == ARM::BI__builtin_arm_stlex) {
995 if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
1000 if (BuiltinID == ARM::BI__builtin_arm_rsr64 ||
1001 BuiltinID == ARM::BI__builtin_arm_wsr64)
1004 if (BuiltinID == ARM::BI__builtin_arm_rsr ||
1005 BuiltinID == ARM::BI__builtin_arm_rsrp ||
1006 BuiltinID == ARM::BI__builtin_arm_wsr ||
1007 BuiltinID == ARM::BI__builtin_arm_wsrp)
1020 switch (BuiltinID) {
1023 case ARM::BI__builtin_arm_ssat:
1025 case ARM::BI__builtin_arm_usat:
1027 case ARM::BI__builtin_arm_ssat16:
1029 case ARM::BI__builtin_arm_usat16:
1031 case ARM::BI__builtin_arm_vcvtr_f:
1032 case ARM::BI__builtin_arm_vcvtr_d:
1034 case ARM::BI__builtin_arm_dmb:
1035 case ARM::BI__builtin_arm_dsb:
1036 case ARM::BI__builtin_arm_isb:
1037 case ARM::BI__builtin_arm_dbg:
1039 case ARM::BI__builtin_arm_cdp:
1040 case ARM::BI__builtin_arm_cdp2:
1041 case ARM::BI__builtin_arm_mcr:
1042 case ARM::BI__builtin_arm_mcr2:
1043 case ARM::BI__builtin_arm_mrc:
1044 case ARM::BI__builtin_arm_mrc2:
1045 case ARM::BI__builtin_arm_mcrr:
1046 case ARM::BI__builtin_arm_mcrr2:
1047 case ARM::BI__builtin_arm_mrrc:
1048 case ARM::BI__builtin_arm_mrrc2:
1049 case ARM::BI__builtin_arm_ldc:
1050 case ARM::BI__builtin_arm_ldcl:
1051 case ARM::BI__builtin_arm_ldc2:
1052 case ARM::BI__builtin_arm_ldc2l:
1053 case ARM::BI__builtin_arm_stc:
1054 case ARM::BI__builtin_arm_stcl:
1055 case ARM::BI__builtin_arm_stc2:
1056 case ARM::BI__builtin_arm_stc2l:
1066 if (BuiltinID == AArch64::BI__builtin_arm_ldrex ||
1067 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
1068 BuiltinID == AArch64::BI__builtin_arm_strex ||
1069 BuiltinID == AArch64::BI__builtin_arm_stlex) {
1073 if (BuiltinID == AArch64::BI__builtin_arm_prefetch) {
1080 if (BuiltinID == AArch64::BI__builtin_arm_rsr64 ||
1081 BuiltinID == AArch64::BI__builtin_arm_wsr64 ||
1082 BuiltinID == AArch64::BI__builtin_arm_rsr128 ||
1083 BuiltinID == AArch64::BI__builtin_arm_wsr128)
1087 if (BuiltinID == AArch64::BI__builtin_arm_irg ||
1088 BuiltinID == AArch64::BI__builtin_arm_addg ||
1089 BuiltinID == AArch64::BI__builtin_arm_gmi ||
1090 BuiltinID == AArch64::BI__builtin_arm_ldg ||
1091 BuiltinID == AArch64::BI__builtin_arm_stg ||
1092 BuiltinID == AArch64::BI__builtin_arm_subp) {
1096 if (BuiltinID == AArch64::BI__builtin_arm_rsr ||
1097 BuiltinID == AArch64::BI__builtin_arm_rsrp ||
1098 BuiltinID == AArch64::BI__builtin_arm_wsr ||
1099 BuiltinID == AArch64::BI__builtin_arm_wsrp)
1105 if (BuiltinID == AArch64::BI_ReadStatusReg ||
1106 BuiltinID == AArch64::BI_WriteStatusReg)
1109 if (BuiltinID == AArch64::BI__getReg)
1112 if (BuiltinID == AArch64::BI__break)
1115 if (BuiltinID == AArch64::BI__hlt)
1129 unsigned i = 0, l = 0, u = 0;
1130 switch (BuiltinID) {
1131 default:
return false;
1132 case AArch64::BI__builtin_arm_dmb:
1133 case AArch64::BI__builtin_arm_dsb:
1134 case AArch64::BI__builtin_arm_isb: l = 0; u = 15;
break;
1135 case AArch64::BI__builtin_arm_tcancel: l = 0; u = 65535;
break;
1142struct IntrinToName {
1151 const char *IntrinNames) {
1152 AliasName.consume_front(
"__arm_");
1153 const IntrinToName *It =
1154 llvm::lower_bound(Map, BuiltinID, [](
const IntrinToName &L,
unsigned Id) {
1157 if (It == Map.end() || It->Id != BuiltinID)
1159 StringRef
FullName(&IntrinNames[It->FullName]);
1162 if (It->ShortName == -1)
1164 StringRef
ShortName(&IntrinNames[It->ShortName]);
1169#include "clang/Basic/arm_mve_builtin_aliases.inc"
1177#include "clang/Basic/arm_cde_builtin_aliases.inc"
1198 Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
1205 StringRef AliasName = cast<FunctionDecl>(
D)->getIdentifier()->getName();
1207 bool IsAArch64 = Context.getTargetInfo().getTriple().isAArch64();
1212 Diag(AL.
getLoc(), diag::err_attribute_arm_builtin_alias);
1216 D->addAttr(::new (Context) ArmBuiltinAliasAttr(Context, AL, Ident));
1222 auto CheckForIncompatibleAttr =
1224 StringRef IncompatibleStateName) {
1225 if (CurrentState == IncompatibleState) {
1226 S.
Diag(AL.
getLoc(), diag::err_attributes_are_not_compatible)
1227 << (std::string(
"'__arm_new(\"") + StateName.str() +
"\")'")
1228 << (std::string(
"'") + IncompatibleStateName.str() +
"(\"" +
1229 StateName.str() +
"\")'")
1244 Diag(AL.
getLoc(), diag::err_missing_arm_state) << AL;
1249 std::vector<StringRef> NewState;
1250 if (
const auto *ExistingAttr =
D->getAttr<ArmNewAttr>()) {
1251 for (StringRef S : ExistingAttr->newArgs())
1252 NewState.push_back(S);
1256 bool HasZT0 =
false;
1257 for (
unsigned I = 0,
E = AL.
getNumArgs(); I !=
E; ++I) {
1258 StringRef StateName;
1263 if (StateName ==
"za")
1265 else if (StateName ==
"zt0")
1268 Diag(LiteralLoc, diag::err_unknown_arm_state) << StateName;
1273 if (!llvm::is_contained(NewState, StateName))
1274 NewState.push_back(StateName);
1277 if (
auto *FPT = dyn_cast<FunctionProtoType>(
D->getFunctionType())) {
1290 D->dropAttr<ArmNewAttr>();
1297 Diag(AL.
getLoc(), diag::err_attribute_not_clinkage) << AL;
1301 const auto *FD = cast<FunctionDecl>(
D);
1302 if (!FD->isExternallyVisible()) {
1303 Diag(AL.
getLoc(), diag::warn_attribute_cmse_entry_static);
1313 Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 1;
1325 ARMInterruptAttr::InterruptType
Kind;
1326 if (!ARMInterruptAttr::ConvertStrToInterruptType(Str,
Kind)) {
1327 Diag(AL.
getLoc(), diag::warn_attribute_type_not_supported)
1328 << AL << Str << ArgLoc;
1334 Diag(
D->getLocation(), diag::warn_arm_interrupt_vfp_clobber);
static constexpr Builtin::Info BuiltinInfo[]
enum clang::sema::@1658::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 MveAliasValid(unsigned BuiltinID, StringRef AliasName)
bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
bool CdeAliasValid(unsigned BuiltinID, StringRef AliasName)
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 CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall)
BuiltinARMMemoryTaggingCall - Handle calls of memory tagging extensions.
void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL)
bool SmeAliasValid(unsigned BuiltinID, StringRef AliasName)
bool SveAliasValid(unsigned BuiltinID, StringRef AliasName)
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...
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>'.
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)