|
clang 24.0.0git
|
#include "ByteCode/State.h"#include "clang/Basic/BuiltinTraits.h"#include <cstdint>#include <optional>Go to the source code of this file.
Namespaces | |
| namespace | llvm |
| Diagnostic wrappers for TextAPI types for error reporting. | |
| namespace | clang |
| Top level wrappers for InstallAPI frontend operations. | |
Enumerations | |
| enum class | GCCTypeClass { None = -1 , Void = 0 , Integer = 1 , Enum = 3 , Bool = 4 , Pointer = 5 , PointerToDataMember = 7 , RealFloat = 8 , Complex = 9 , PointerToMemberFunction = 12 , ClassOrStruct = 12 , Union = 13 , BitInt = 18 , Vector = 19 } |
| Values returned by __builtin_classify_type, chosen to match the values produced by GCC's builtin. More... | |
Functions | |
| CharUnits | clang::GetAlignOfDynamicAlloc (const ASTContext &Ctx, QualType AllocType, DynAllocKind AllocKind) |
| GCCTypeClass | EvaluateBuiltinClassifyType (QualType T, const LangOptions &LangOpts) |
| EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC. | |
| void | HandleComplexComplexMul (llvm::APFloat A, llvm::APFloat B, llvm::APFloat C, llvm::APFloat D, llvm::APFloat &ResR, llvm::APFloat &ResI) |
| void | HandleComplexComplexDiv (llvm::APFloat A, llvm::APFloat B, llvm::APFloat C, llvm::APFloat D, llvm::APFloat &ResR, llvm::APFloat &ResI) |
| CharUnits | GetAlignOfExpr (const ASTContext &Ctx, const Expr *E, UnaryExprOrTypeTrait ExprKind) |
| unsigned | ConvertBuiltinIDToX86BuiltinID (const ASTContext &Ctx, unsigned BuiltinID) |
| Convert a builtin ID to the canonical x86 builtin ID the constant evaluators dispatch on in their x86 target-specific cases. | |
| unsigned | ConvertBuiltinIDToX86BuiltinID (const ASTContext &Ctx, const CallExpr *E) |
| uint8_t | GFNIMultiplicativeInverse (uint8_t Byte) |
| uint8_t | GFNIMul (uint8_t AByte, uint8_t BByte) |
| uint8_t | GFNIAffine (uint8_t XByte, const llvm::APInt &AQword, const llvm::APSInt &Imm, bool Inverse=false) |
| llvm::APSInt | NormalizeRotateAmount (const llvm::APSInt &Value, const llvm::APSInt &Amount) |
| std::optional< llvm::APFloat > | EvalScalarMinMaxFp (const llvm::APFloat &A, const llvm::APFloat &B, std::optional< llvm::APSInt > RoundingMode, bool IsMin) |
| const Expr * | ignorePointerCastsAndParens (const Expr *E) |
| A more selective version of E->IgnoreParenCasts for tryEvaluateBuiltinObjectSize. This ignores some casts/parens that serve only to change the type of E. Ex. For E = (short*)((char*)(&foo)), returns &foo | |
| bool | isReadByLvalueToRvalueConversion (const CXXRecordDecl *RD) |
| Determine whether a type would actually be read by an lvalue-to-rvalue conversion. | |
| bool | isReadByLvalueToRvalueConversion (QualType T) |
| bool | isForManglingOnly (ConstantExprKind Kind) |
| Determines whether the given kind of constant expression is only ever used for name mangling. | |
| bool | isTemplateArgument (ConstantExprKind Kind) |
| bool | isOpaqueConstantCall (const CallExpr *E) |
| Should this call expression be treated as forming an opaque constant? | |
| bool | isGlobalLValue (const ValueDecl *D, const Expr *E) |
| bool | FunctionDefinitionCanBeLazilyInstantiated (const FunctionDecl *FD) |
| Whether we can instantiate FD during constant evaluation. | |
|
strong |
Values returned by __builtin_classify_type, chosen to match the values produced by GCC's builtin.
| Enumerator | |
|---|---|
| None | |
| Void | |
| Integer | |
| Enum | |
| Bool | |
| Pointer | |
| PointerToDataMember | |
| RealFloat | |
| Complex | |
| PointerToMemberFunction | |
| ClassOrStruct | |
| Union | |
| BitInt | |
| Vector | |
Definition at line 43 of file ExprConstShared.h.
| unsigned ConvertBuiltinIDToX86BuiltinID | ( | const ASTContext & | Ctx, |
| const CallExpr * | E ) |
Definition at line 10663 of file ExprConstant.cpp.
References ConvertBuiltinIDToX86BuiltinID(), and clang::CallExpr::getBuiltinCallee().
| unsigned ConvertBuiltinIDToX86BuiltinID | ( | const ASTContext & | Ctx, |
| unsigned | BuiltinID ) |
Convert a builtin ID to the canonical x86 builtin ID the constant evaluators dispatch on in their x86 target-specific cases.
Target-independent builtins are returned unchanged. An x86 target builtin (including an auxiliary-target x86 builtin, whose ID is shifted past the primary target's builtins) is translated to its canonical X86::BI* value. Any other target's builtin returns 0: the constant evaluators only fold x86 target builtins, and target builtin IDs of different targets overlap (each numbers from Builtin::FirstTSBuiltin), so an unrelated target's ID must not be mistaken for an x86 one.
The ID-based overload performs no work beyond a single comparison for target-independent builtins, so it is suitable for hot paths (e.g. the bytecode interpreter's builtin dispatch) where re-deriving the ID from the call expression would be wasteful.
Definition at line 10629 of file ExprConstant.cpp.
References clang::ASTContext::BuiltinInfo, clang::Builtin::FirstTSBuiltin, clang::Builtin::Context::getAuxBuiltinID(), clang::ASTContext::getAuxTargetInfo(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), and clang::Builtin::Context::isAuxBuiltinID().
Referenced by ConvertBuiltinIDToX86BuiltinID(), and clang::interp::Compiler< Emitter >::VisitBuiltinCallExpr().
| std::optional< llvm::APFloat > EvalScalarMinMaxFp | ( | const llvm::APFloat & | A, |
| const llvm::APFloat & | B, | ||
| std::optional< llvm::APSInt > | RoundingMode, | ||
| bool | IsMin ) |
References clang::T.
| GCCTypeClass EvaluateBuiltinClassifyType | ( | QualType | T, |
| const LangOptions & | LangOpts ) |
EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way as GCC.
Definition at line 16518 of file ExprConstant.cpp.
References BitInt, Bool, clang::cast(), clang::Type::castAs(), ClassOrStruct, Complex, Enum, EvaluateBuiltinClassifyType(), getKind(), clang::Type::getTypeClass(), clang::AtomicType::getValueType(), Integer, clang::Type::isMemberDataPointerType(), clang::Type::isUnionType(), None, Pointer, PointerToDataMember, PointerToMemberFunction, clang::T, Union, Vector, and Void.
Referenced by EvaluateBuiltinClassifyType(), EvaluateBuiltinClassifyType(), and clang::interp::interp__builtin_classify_type().
| bool FunctionDefinitionCanBeLazilyInstantiated | ( | const FunctionDecl * | FD | ) |
Whether we can instantiate FD during constant evaluation.
Definition at line 7256 of file ExprConstant.cpp.
References clang::FunctionDecl::getMostRecentDecl(), clang::FunctionDecl::getTemplateInstantiationPattern(), clang::FunctionDecl::isConstexpr(), clang::FunctionDecl::isDefined(), and clang::FunctionDecl::isImplicitlyInstantiable().
Referenced by clang::interp::compileFunction(), and TryInstantiateFunctionBeforeCall().
| CharUnits GetAlignOfExpr | ( | const ASTContext & | Ctx, |
| const Expr * | E, | ||
| UnaryExprOrTypeTrait | ExprKind ) |
Definition at line 10668 of file ExprConstant.cpp.
References GetAlignOfType(), clang::ASTContext::getDeclAlign(), clang::Expr::getType(), and clang::Expr::IgnoreParens().
Referenced by clang::interp::getBaseAlignment(), and getBaseAlignment().
| uint8_t GFNIAffine | ( | uint8_t | XByte, |
| const llvm::APInt & | AQword, | ||
| const llvm::APSInt & | Imm, | ||
| bool | Inverse = false ) |
References uint8_t.
Definition at line 21509 of file ExprConstant.cpp.
References int32_t, uint16_t, and uint8_t.
Referenced by clang::interp::interp__builtin_ia32_gfni_mul().
| void HandleComplexComplexDiv | ( | llvm::APFloat | A, |
| llvm::APFloat | B, | ||
| llvm::APFloat | C, | ||
| llvm::APFloat | D, | ||
| llvm::APFloat & | ResR, | ||
| llvm::APFloat & | ResI ) |
| void HandleComplexComplexMul | ( | llvm::APFloat | A, |
| llvm::APFloat | B, | ||
| llvm::APFloat | C, | ||
| llvm::APFloat | D, | ||
| llvm::APFloat & | ResR, | ||
| llvm::APFloat & | ResI ) |
References clang::C.
A more selective version of E->IgnoreParenCasts for tryEvaluateBuiltinObjectSize. This ignores some casts/parens that serve only to change the type of E. Ex. For E = (short*)((char*)(&foo)), returns &foo
Always returns an RValue with a pointer representation.
Definition at line 16788 of file ExprConstant.cpp.
References clang::Expr::getType(), clang::Type::hasPointerRepresentation(), clang::Expr::IgnoreParens(), ignorePointerCastsAndParens(), and clang::Expr::isPRValue().
Referenced by ignorePointerCastsAndParens(), tryEvaluateBuiltinObjectSize(), and clang::interp::Compiler< Emitter >::VisitBuiltinCallExpr().
|
inline |
Determines whether the given kind of constant expression is only ever used for name mangling.
If so, it's permitted to reference things that we can't generate code for (in particular, dllimported functions).
Definition at line 126 of file ExprConstShared.h.
Referenced by clang::interp::checkFunctionPtr(), CheckLValueConstantExpression(), clang::interp::EvaluationResult::checkMemberPointer(), CheckMemberPointerConstantExpression(), and clang::interp::lval().
Definition at line 2020 of file ExprConstant.cpp.
References clang::cast(), clang::Stmt::getStmtClass(), clang::isa(), clang::CompoundLiteralExpr::isFileScope(), clang::Expr::isLValue(), isOpaqueConstantCall(), and clang::SD_Static.
Referenced by IsGlobalLValue().
Should this call expression be treated as forming an opaque constant?
Definition at line 157 of file ExprConstShared.h.
References clang::CallExpr::getBuiltinCallee().
Referenced by clang::interp::CmpHelperEQ< Pointer >(), isGlobalLValue(), and IsOpaqueConstantCall().
| bool isReadByLvalueToRvalueConversion | ( | const CXXRecordDecl * | RD | ) |
Determine whether a type would actually be read by an lvalue-to-rvalue conversion.
If it's of class type, we may assume that the copy operation is trivial. Note that this is never true for a union type with fields (because the copy always "reads" the active member) and always true for a non-class type.
Definition at line 3780 of file ExprConstant.cpp.
References clang::CXXRecordDecl::bases(), clang::RecordDecl::field_empty(), clang::RecordDecl::fields(), clang::CXXRecordDecl::isEmpty(), isReadByLvalueToRvalueConversion(), and clang::TagDecl::isUnion().
Referenced by diagnoseMutableFields(), HandleConstructorCall(), HandleFunctionCall(), isReadByLvalueToRvalueConversion(), isReadByLvalueToRvalueConversion(), and isTrivialMemoryOperation().
Definition at line 3776 of file ExprConstant.cpp.
References isReadByLvalueToRvalueConversion(), and clang::T.
|
inline |
Definition at line 142 of file ExprConstShared.h.
Referenced by clang::interp::EvaluationResult::checkLValue(), and CheckLValueConstantExpression().
| llvm::APSInt NormalizeRotateAmount | ( | const llvm::APSInt & | Value, |
| const llvm::APSInt & | Amount ) |
Definition at line 21631 of file ExprConstant.cpp.
Referenced by clang::interp::InterpretBuiltin().