|
LLVM 24.0.0git
|
#include "llvm/IR/Intrinsics.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/StringTable.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Function.h"#include "llvm/IR/IntrinsicsAArch64.h"#include "llvm/IR/IntrinsicsAMDGPU.h"#include "llvm/IR/IntrinsicsARM.h"#include "llvm/IR/IntrinsicsBPF.h"#include "llvm/IR/IntrinsicsHexagon.h"#include "llvm/IR/IntrinsicsLoongArch.h"#include "llvm/IR/IntrinsicsMips.h"#include "llvm/IR/IntrinsicsPowerPC.h"#include "llvm/IR/IntrinsicsR600.h"#include "llvm/IR/IntrinsicsRISCV.h"#include "llvm/IR/IntrinsicsS390.h"#include "llvm/IR/IntrinsicsSPIRV.h"#include "llvm/IR/IntrinsicsVE.h"#include "llvm/IR/IntrinsicsX86.h"#include "llvm/IR/IntrinsicsXCore.h"#include "llvm/IR/Module.h"#include "llvm/IR/NVVMIntrinsicUtils.h"#include "llvm/IR/Type.h"#include "llvm/Support/FormatVariadic.h"#include "llvm/Support/MathExtras.h"#include "llvm/IR/IntrinsicImpl.inc"#include "llvm/IR/ConstrainedOps.def"Go to the source code of this file.
Classes | |
| struct | InterleaveIntrinsic |
Macros | |
| #define | GET_INTRINSIC_NAME_TABLE |
| Table of string intrinsic names indexed by enum value. | |
| #define | GET_INTRINSIC_TARGET_FEATURES_TABLE |
| Table of required target features indexed by enum value. | |
| #define | GET_INTRINSIC_IITINFO |
| #define | GET_INTRINSIC_GENERATOR_GLOBAL |
| #define | GET_INTRINSIC_OVERLOAD_TABLE |
| #define | GET_INTRINSIC_SCALARIZABLE_TABLE |
| #define | GET_INTRINSIC_PRETTY_PRINT_TABLE |
| #define | GET_INTRINSIC_TARGET_DATA |
| Table of per-target intrinsic name tables. | |
| #define | GET_INTRINSIC_ATTRIBUTES |
| This defines the "Intrinsic::getAttributes(ID id)" method. | |
| #define | GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN |
| #define | GET_LLVM_INTRINSIC_FOR_MS_BUILTIN |
| #define | INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) |
| #define | INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) |
| #define | GET_INTRINSIC_IMMARG_RANGE_SET_CHECKS |
| #define | GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS |
| #define | GET_INTRINSIC_DEFAULT_ARG_VALUES |
Typedefs | |
| using | DeferredIntrinsicMatchInfo |
Enumerations | |
| enum | IIT_Info |
| IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntries function. More... | |
Functions | |
| static bool | isSignatureValid (FunctionType *FTy, ArrayRef< Intrinsic::IITDescriptor > &Infos, unsigned NumArgs, bool IsVarArg, SmallVectorImpl< Type * > &OverloadTys, raw_ostream &OS, unsigned NumMissingTrailingParams) |
Return true if the function type FTy is a valid type signature for the type constraints specified in the .td file, represented by Infos and IsVarArg. | |
| static std::string | getMangledTypeStr (Type *Ty, bool &HasUnnamedType) |
| Returns a stable mangling for the type specified for use in the name mangling scheme used by 'any' types in intrinsic signatures. | |
| static std::string | getIntrinsicNameImpl (Intrinsic::ID Id, ArrayRef< Type * > OverloadTys, Module *M, FunctionType *FT, bool EarlyModuleCheck) |
| static void | DecodeIITType (unsigned &NextElt, ArrayRef< unsigned char > Infos, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable) |
| static Type * | DecodeFixedType (ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > OverloadTys, LLVMContext &Context) |
| static int | lookupLLVMIntrinsicByName (ArrayRef< unsigned > NameOffsetTable, StringRef Name, StringRef Target="") |
| Looks up Name in NameTable via binary search. | |
| static std::pair< ArrayRef< unsigned >, StringRef > | findTargetSubtable (StringRef Name) |
Find the segment of IntrinsicNameOffsetTable for intrinsics with the same target as Name, or the generic table if Name is not target specific. | |
| static Function * | getOrInsertIntrinsicDeclarationImpl (Module *M, Intrinsic::ID id, ArrayRef< Type * > OverloadTys, FunctionType *FT) |
| static raw_ostream & | operator<< (raw_ostream &OS, const MatchPosition &Pos) |
| static std::pair< bool, StringRef > | checkElementConstraint (Type *Ty, Intrinsic::IITDescriptor::AnyKindElementConstraint EC) |
Check whether Ty satisfies the given element constraint EC and return a description of the expected element kind for error messages. | |
| static bool | matchIntrinsicType (Type *Ty, ArrayRef< Intrinsic::IITDescriptor > &Infos, MatchPosition Position, SmallVectorImpl< Type * > &OverloadTys, SmallVectorImpl< DeferredIntrinsicMatchInfo > &DeferredChecks, bool IsDeferredCheck, raw_ostream &OS) |
Variables | |
| static InterleaveIntrinsic | InterleaveIntrinsics [] |
| #define GET_INTRINSIC_ATTRIBUTES |
This defines the "Intrinsic::getAttributes(ID id)" method.
Definition at line 782 of file Intrinsics.cpp.
| #define GET_INTRINSIC_DEFAULT_ARG_VALUES |
Definition at line 1532 of file Intrinsics.cpp.
| #define GET_INTRINSIC_GENERATOR_GLOBAL |
Definition at line 474 of file Intrinsics.cpp.
| #define GET_INTRINSIC_IITINFO |
Definition at line 219 of file Intrinsics.cpp.
| #define GET_INTRINSIC_IMMARG_RANGE_SET_CHECKS |
Definition at line 1524 of file Intrinsics.cpp.
| #define GET_INTRINSIC_NAME_TABLE |
Table of string intrinsic names indexed by enum value.
Definition at line 50 of file Intrinsics.cpp.
| #define GET_INTRINSIC_OVERLOAD_TABLE |
| #define GET_INTRINSIC_PRETTY_PRINT_ARGUMENTS |
Definition at line 1527 of file Intrinsics.cpp.
| #define GET_INTRINSIC_PRETTY_PRINT_TABLE |
| #define GET_INTRINSIC_SCALARIZABLE_TABLE |
| #define GET_INTRINSIC_TARGET_DATA |
Table of per-target intrinsic name tables.
Definition at line 669 of file Intrinsics.cpp.
| #define GET_INTRINSIC_TARGET_FEATURES_TABLE |
Table of required target features indexed by enum value.
Definition at line 54 of file Intrinsics.cpp.
| #define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN |
Definition at line 843 of file Intrinsics.cpp.
| #define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN |
Definition at line 847 of file Intrinsics.cpp.
| #define INSTRUCTION | ( | NAME, | |
| NARG, | |||
| ROUND_MODE, | |||
| INTRINSIC ) |
| #define INSTRUCTION | ( | NAME, | |
| NARG, | |||
| ROUND_MODE, | |||
| INTRINSIC ) |
Definition at line 943 of file Intrinsics.cpp.
| enum IIT_Info |
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntries function.
Defined in Intrinsics.td.
Definition at line 218 of file Intrinsics.cpp.
|
static |
Check whether Ty satisfies the given element constraint EC and return a description of the expected element kind for error messages.
Definition at line 949 of file Intrinsics.cpp.
References llvm::Type::getScalarType(), llvm::Type::isFloatingPointTy(), llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), and llvm_unreachable.
Referenced by matchIntrinsicType().
|
static |
Definition at line 541 of file Intrinsics.cpp.
References assert(), llvm::cast(), llvm::ArrayRef< T >::consume_front(), D(), DecodeFixedType(), llvm::dyn_cast(), llvm::FixedVectorType::get(), llvm::IntegerType::get(), llvm::PointerType::get(), llvm::StructType::get(), llvm::TargetExtType::get(), llvm::VectorType::get(), llvm::Type::getBFloatTy(), llvm::Type::getDoubleTy(), llvm::Type::getFloatTy(), llvm::Type::getFP128Ty(), llvm::Type::getHalfTy(), llvm::VectorType::getInteger(), llvm::Type::getMetadataTy(), llvm::VectorType::getOneNthElementsVectorType(), llvm::Type::getPPC_FP128Ty(), llvm::VectorType::getSubdividedVectorType(), llvm::Type::getTokenTy(), llvm::Type::getVoidTy(), llvm::Type::getX86_AMXTy(), llvm_unreachable, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by DecodeFixedType(), and llvm::Intrinsic::getType().
|
static |
Definition at line 226 of file Intrinsics.cpp.
References DecodeIITType(), llvm_unreachable, N, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by DecodeIITType(), and llvm::Intrinsic::getIntrinsicInfoTableEntries().
Find the segment of IntrinsicNameOffsetTable for intrinsics with the same target as Name, or the generic table if Name is not target specific.
Returns the relevant slice of IntrinsicNameOffsetTable and the target name.
Definition at line 743 of file Intrinsics.cpp.
References llvm::ArrayRef(), assert(), llvm::ArrayRef< T >::end(), and llvm::partition_point().
Referenced by llvm::Intrinsic::lookupIntrinsicID().
|
static |
Definition at line 175 of file Intrinsics.cpp.
References llvm::any_of(), assert(), llvm::ArrayRef< T >::empty(), llvm::Intrinsic::getBaseName(), getMangledTypeStr(), llvm::Intrinsic::getType(), llvm::IsaPred, and llvm::Intrinsic::isOverloaded().
Referenced by llvm::Intrinsic::getName(), and llvm::Intrinsic::getNameNoUnnamedTypes().
|
static |
Returns a stable mangling for the type specified for use in the name mangling scheme used by 'any' types in intrinsic signatures.
The mangling of named types is simply their name. Manglings for unnamed types consist of a prefix ('p' for pointers, 'a' for arrays, 'f_' for functions) combined with the mangling of their component types. A vararg function type will have a suffix of 'vararg'. Since function types can contain other function types, we close a function type mangling with suffix 'f' which can't be confused with it's prefix. This ensures we don't have collisions between two unrelated function types. Otherwise, you might parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.) The HasUnnamedType boolean is set if an unnamed type was encountered, indicating that extra care must be taken to ensure a unique name.
Definition at line 86 of file Intrinsics.cpp.
References llvm::Type::BFloatTyID, llvm::Type::ByteTyID, llvm::cast(), llvm::Type::DoubleTyID, llvm::dyn_cast(), llvm::Type::FloatTyID, llvm::Type::FP128TyID, getBitWidth(), getMangledTypeStr(), llvm::Type::HalfTyID, llvm::Type::IntegerTyID, llvm_unreachable, llvm::Type::MetadataTyID, llvm::Type::PPC_FP128TyID, llvm::utostr(), llvm::Type::VoidTyID, llvm::Type::X86_AMXTyID, and llvm::Type::X86_FP80TyID.
Referenced by getIntrinsicNameImpl(), and getMangledTypeStr().
|
static |
Definition at line 786 of file Intrinsics.cpp.
References llvm::cast(), llvm::ArrayRef< T >::empty(), F, llvm::Intrinsic::getName(), and llvm::StringRef::str().
Referenced by llvm::Intrinsic::getOrInsertDeclaration(), and llvm::Intrinsic::getOrInsertDeclaration().
|
static |
Return true if the function type FTy is a valid type signature for the type constraints specified in the .td file, represented by Infos and IsVarArg.
The overloaded types for the intrinsic are pushed to the OverloadTys vector.
If NumMissingTrailingParams is non-zero, FTy may omit exactly that many trailing parameters. Omitted parameters must have concrete integer types and therefore cannot contribute an unresolved overload type.
If the type is not valid, returns false and prints an error message to OS.
Definition at line 1358 of file Intrinsics.cpp.
References llvm::any_of(), assert(), D(), llvm::ArrayRef< T >::drop_front(), E(), llvm::ArrayRef< T >::empty(), llvm::enumerate(), I, matchIntrinsicType(), llvm::ArrayRef< T >::size(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::Intrinsic::getOrInsertDeclaration(), llvm::Intrinsic::isSignatureValid(), llvm::Intrinsic::isSignatureValid(), and llvm::Intrinsic::remangleIntrinsicFunction().
|
static |
Looks up Name in NameTable via binary search.
NameTable must be sorted and all entries must start with "llvm.". If NameTable contains an exact match for Name or a prefix of Name followed by a dot, its index in NameTable is returned. Otherwise, -1 is returned.
Definition at line 680 of file Intrinsics.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), High, LHS, llvm::Low, llvm::StringRef::npos, RHS, and llvm::StringRef::size().
Referenced by llvm::Intrinsic::lookupIntrinsicID().
|
static |
Definition at line 968 of file Intrinsics.cpp.
References llvm::ArrayRef(), assert(), llvm::cast(), checkElementConstraint(), llvm::ArrayRef< T >::consume_front(), D(), llvm::dyn_cast(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::ArrayRef< T >::empty(), llvm::enumerate(), llvm::formatv(), llvm::VectorType::getElementType(), llvm::Type::getExtendedType(), llvm::VectorType::getInteger(), getName(), llvm::FixedVectorType::getNumElements(), llvm::VectorType::getOneNthElementsVectorType(), llvm::VectorType::getSubdividedVectorType(), llvm::Type::getTruncatedType(), llvm::isa(), llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), llvm_unreachable, matchIntrinsicType(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and T.
Referenced by isSignatureValid(), and matchIntrinsicType().
|
static |
Definition at line 925 of file Intrinsics.cpp.
References llvm::ArrayRef().
Referenced by llvm::raw_ostream::operator<<().
|
static |
Definition at line 1498 of file Intrinsics.cpp.
Referenced by llvm::Intrinsic::getDeinterleaveIntrinsicID(), and llvm::Intrinsic::getInterleaveIntrinsicID().