clang 20.0.0git
Macros | Enumerations | Functions | Variables
CGBuiltin.cpp File Reference
#include "ABIInfo.h"
#include "CGCUDARuntime.h"
#include "CGCXXABI.h"
#include "CGHLSLRuntime.h"
#include "CGObjCRuntime.h"
#include "CGOpenCLRuntime.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "ConstantEmitter.h"
#include "PatternInit.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/OSLog.h"
#include "clang/AST/OperationKinds.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/IntrinsicsBPF.h"
#include "llvm/IR/IntrinsicsDirectX.h"
#include "llvm/IR/IntrinsicsHexagon.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/IntrinsicsPowerPC.h"
#include "llvm/IR/IntrinsicsR600.h"
#include "llvm/IR/IntrinsicsRISCV.h"
#include "llvm/IR/IntrinsicsS390.h"
#include "llvm/IR/IntrinsicsVE.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/IntrinsicsX86.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/MatrixBuilder.h"
#include "llvm/IR/MemoryModelRelaxationAnnotations.h"
#include "llvm/Support/AMDGPUAddrSpace.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/TargetParser/AArch64TargetParser.h"
#include "llvm/TargetParser/RISCVISAInfo.h"
#include "llvm/TargetParser/X86TargetParser.h"
#include <optional>
#include <sstream>
#include "clang/Basic/arm_sve_builtin_cg.inc"
#include "clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def"
#include "clang/Basic/arm_sme_builtin_cg.inc"
#include "clang/Basic/arm_mve_builtin_cg.inc"
#include "clang/Basic/arm_cde_builtin_cg.inc"
#include "llvm/TargetParser/X86TargetParser.def"
#include "llvm/TargetParser/PPCTargetParser.def"
#include "clang/Basic/BuiltinsPPC.def"
#include "clang/Basic/BuiltinsHexagonMapCustomDep.def"
#include "clang/Basic/riscv_vector_builtin_cg.inc"
#include "clang/Basic/riscv_sifive_vector_builtin_cg.inc"

Go to the source code of this file.

Macros

#define MUTATE_LDBL(func)
 
#define NEONMAP0(NameBase)    { #NameBase, NEON::BI__builtin_neon_ ## NameBase, 0, 0, 0 }
 
#define NEONMAP1(NameBase, LLVMIntrinsic, TypeModifier)
 
#define NEONMAP2(NameBase, LLVMIntrinsic, AltLLVMIntrinsic, TypeModifier)
 
#define SVEMAP1(NameBase, LLVMIntrinsic, TypeModifier)
 
#define SVEMAP2(NameBase, TypeModifier)    { #NameBase, SVE::BI__builtin_sve_##NameBase, 0, 0, TypeModifier }
 
#define GET_SVE_LLVM_INTRINSIC_MAP
 
#define SMEMAP1(NameBase, LLVMIntrinsic, TypeModifier)
 
#define SMEMAP2(NameBase, TypeModifier)    { #NameBase, SME::BI__builtin_sme_##NameBase, 0, 0, TypeModifier }
 
#define GET_SME_LLVM_INTRINSIC_MAP
 
#define X86_VENDOR(ENUM, STRING)    .Case(STRING, {0u, static_cast<unsigned>(llvm::X86::ENUM)})
 
#define X86_CPU_TYPE_ALIAS(ENUM, ALIAS)    .Case(ALIAS, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
 
#define X86_CPU_TYPE(ENUM, STR)    .Case(STR, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
 
#define X86_CPU_SUBTYPE_ALIAS(ENUM, ALIAS)    .Case(ALIAS, {2u, static_cast<unsigned>(llvm::X86::ENUM)})
 
#define X86_CPU_SUBTYPE(ENUM, STR)    .Case(STR, {2u, static_cast<unsigned>(llvm::X86::ENUM)})
 
#define INTRINSIC_X86_XSAVE_ID(NAME)
 
#define PPC_CPU(NAME, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID)    .Case(NAME, {Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID})
 
#define PPC_AIX_FEATURE(NAME, DESC, SUPPORT_METHOD, INDEX, MASK, COMP_OP, VALUE)    .Case(NAME, {SUPPORT_METHOD, INDEX, MASK, COMP_OP, VALUE})
 
#define PPC_LNX_FEATURE(Name, Description, EnumName, Bitmask, FA_WORD)    .Case(Name, {FA_WORD, Bitmask})
 
#define CUSTOM_BUILTIN(Name, Intr, Types, Accumulate, Feature)    case PPC::BI__builtin_##Name:
 
#define CUSTOM_BUILTIN(Name, Intr, Types, Acc, Feature)
 
#define INTRINSIC_WITH_CC(NAME)
 
#define MMA_INTR(geom_op_type, layout)    Intrinsic::nvvm_wmma_##geom_op_type##_##layout##_stride
 
#define MMA_LDST(n, geom_op_type)    { n, MMA_INTR(geom_op_type, col), MMA_INTR(geom_op_type, row) }
 
#define MMA_VARIANTS(geom, type)
 
#define MMA_SATF_VARIANTS(geom, type)
 
#define MMA_VARIANTS_I4(geom, type)
 
#define MMA_VARIANTS_B1_XOR(geom, type)
 
#define MMA_VARIANTS_B1_AND(geom, type)
 
#define CUSTOM_BUILTIN_MAPPING(x, s)    { Hexagon::BI__builtin_HEXAGON_##x, Intrinsic::hexagon_##x, s },
 

Enumerations

enum class  CodeGenFunction::MSVCIntrin {
  _BitScanForward , _BitScanReverse , _InterlockedAnd , _InterlockedDecrement ,
  _InterlockedExchange , _InterlockedExchangeAdd , _InterlockedExchangeSub , _InterlockedIncrement ,
  _InterlockedOr , _InterlockedXor , _InterlockedExchangeAdd_acq , _InterlockedExchangeAdd_rel ,
  _InterlockedExchangeAdd_nf , _InterlockedExchange_acq , _InterlockedExchange_rel , _InterlockedExchange_nf ,
  _InterlockedCompareExchange_acq , _InterlockedCompareExchange_rel , _InterlockedCompareExchange_nf , _InterlockedCompareExchange128 ,
  _InterlockedCompareExchange128_acq , _InterlockedCompareExchange128_rel , _InterlockedCompareExchange128_nf , _InterlockedOr_acq ,
  _InterlockedOr_rel , _InterlockedOr_nf , _InterlockedXor_acq , _InterlockedXor_rel ,
  _InterlockedXor_nf , _InterlockedAnd_acq , _InterlockedAnd_rel , _InterlockedAnd_nf ,
  _InterlockedIncrement_acq , _InterlockedIncrement_rel , _InterlockedIncrement_nf , _InterlockedDecrement_acq ,
  _InterlockedDecrement_rel , _InterlockedDecrement_nf , __fastfail
}
 
enum  {
  AddRetType = (1 << 0) , Add1ArgType = (1 << 1) , Add2ArgTypes = (1 << 2) , VectorizeRetType = (1 << 3) ,
  VectorizeArgTypes = (1 << 4) , InventFloatType = (1 << 5) , UnsignedAlts = (1 << 6) , Use64BitVectors = (1 << 7) ,
  Use128BitVectors = (1 << 8) , Vectorize1ArgType = Add1ArgType | VectorizeArgTypes , VectorRet = AddRetType | VectorizeRetType , VectorRetGetArgs01 ,
  FpCmpzModifiers
}
 
enum  SpecialRegisterAccessKind { NormalRead , VolatileRead , Write }
 

Functions

static void initializeAlloca (CodeGenFunction &CGF, AllocaInst *AI, Value *Size, Align AlignmentInBytes)
 
static ValueEmitToInt (CodeGenFunction &CGF, llvm::Value *V, QualType T, llvm::IntegerType *IntType)
 Emit the conversions required to turn the given value into an integer of the given size.
 
static ValueEmitFromInt (CodeGenFunction &CGF, llvm::Value *V, QualType T, llvm::Type *ResultType)
 
static Address CheckAtomicAlignment (CodeGenFunction &CGF, const CallExpr *E)
 
static ValueMakeBinaryAtomicValue (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E, AtomicOrdering Ordering=AtomicOrdering::SequentiallyConsistent)
 Utility to insert an atomic instruction based on Intrinsic::ID and the expression node.
 
static ValueEmitNontemporalStore (CodeGenFunction &CGF, const CallExpr *E)
 
static ValueEmitNontemporalLoad (CodeGenFunction &CGF, const CallExpr *E)
 
static RValue EmitBinaryAtomic (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E)
 
static RValue EmitBinaryAtomicPost (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E, Instruction::BinaryOps Op, bool Invert=false)
 Utility to insert an atomic instruction based Intrinsic::ID and the expression node, where the return value is the result of the operation.
 
static ValueMakeAtomicCmpXchgValue (CodeGenFunction &CGF, const CallExpr *E, bool ReturnBool)
 Utility to insert an atomic cmpxchg instruction.
 
static ValueEmitAtomicCmpXchgForMSIntrin (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering SuccessOrdering=AtomicOrdering::SequentiallyConsistent)
 This function should be invoked to emit atomic cmpxchg for Microsoft's _InterlockedCompareExchange* intrinsics which have the following signature: T _InterlockedCompareExchange(T volatile *Destination, T Exchange, T Comparand);.
 
static ValueEmitAtomicCmpXchg128ForMSIntrin (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering SuccessOrdering)
 
static ValueEmitAtomicIncrementValue (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering Ordering=AtomicOrdering::SequentiallyConsistent)
 
static ValueEmitAtomicDecrementValue (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering Ordering=AtomicOrdering::SequentiallyConsistent)
 
static ValueEmitISOVolatileLoad (CodeGenFunction &CGF, const CallExpr *E)
 
static ValueEmitISOVolatileStore (CodeGenFunction &CGF, const CallExpr *E)
 
static ValueemitUnaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID)
 
static ValueemitBinaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID)
 
static ValueemitBinaryExpMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, llvm::Intrinsic::ID IntrinsicID, llvm::Intrinsic::ID ConstrainedIntrinsicID)
 
static ValueemitTernaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID)
 
static ValueemitCallMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID, llvm::Type *Ty, ArrayRef< Value * > Args)
 
template<unsigned N>
ValueemitBuiltinWithOneOverloadedType (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, llvm::StringRef Name="")
 
static ValueemitFPIntBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID)
 
static ValueemitMaybeConstrainedFPToIntRoundBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID)
 
static ValueemitFrexpBuiltin (CodeGenFunction &CGF, const CallExpr *E, llvm::Intrinsic::ID IntrinsicID)
 
static ValueEmitFAbs (CodeGenFunction &CGF, Value *V)
 EmitFAbs - Emit a call to @llvm.fabs().
 
static ValueEmitSignBit (CodeGenFunction &CGF, Value *V)
 Emit the computation of the sign bit for a floating point value.
 
static RValue emitLibraryCall (CodeGenFunction &CGF, const FunctionDecl *FD, const CallExpr *E, llvm::Constant *calleeValue)
 
static llvm::ValueEmitOverflowIntrinsic (CodeGenFunction &CGF, const llvm::Intrinsic::ID IntrinsicID, llvm::Value *X, llvm::Value *Y, llvm::Value *&Carry)
 Emit a call to llvm.
 
static ValueemitRangedBuiltin (CodeGenFunction &CGF, unsigned IntrinsicID, int low, int high)
 
static WidthAndSignedness getIntegerWidthAndSignedness (const clang::ASTContext &context, const clang::QualType Type)
 
static struct WidthAndSignedness EncompassingIntegerType (ArrayRef< struct WidthAndSignedness > Types)
 
static bool areBOSTypesCompatible (int From, int To)
 Checks if using the result of __builtin_object_size(p, From) in place of __builtin_object_size(p, To) is correct.
 
static llvm::ValuegetDefaultBuiltinObjectSizeResult (unsigned Type, llvm::IntegerType *ResType)
 
static unsigned CountCountedByAttrs (const RecordDecl *RD)
 
static char bitActionToX86BTCode (BitTest::ActionKind A)
 
static llvm::ValueEmitX86BitTestIntrinsic (CodeGenFunction &CGF, BitTest BT, const CallExpr *E, Value *BitBase, Value *BitPos)
 
static llvm::AtomicOrdering getBitTestAtomicOrdering (BitTest::InterlockingKind I)
 
static llvm::ValueEmitBitTestIntrinsic (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E)
 Emit a _bittest* intrinsic.
 
static llvm::ValueemitPPCLoadReserveIntrinsic (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E)
 
static RValue EmitMSVCRTSetJmp (CodeGenFunction &CGF, MSVCSetJmpKind SJKind, const CallExpr *E)
 MSVC handles setjmp a bit differently on different platforms.
 
static std::optional< CodeGenFunction::MSVCIntrintranslateArmToMsvcIntrin (unsigned BuiltinID)
 
static std::optional< CodeGenFunction::MSVCIntrintranslateAarch64ToMsvcIntrin (unsigned BuiltinID)
 
static std::optional< CodeGenFunction::MSVCIntrintranslateX86ToMsvcIntrin (unsigned BuiltinID)
 
static ValueEmitAbs (CodeGenFunction &CGF, Value *ArgValue, bool HasNSW)
 
static ValueEmitOverflowCheckedAbs (CodeGenFunction &CGF, const CallExpr *E, bool SanitizeOverflow)
 
static CanQualType getOSLogArgType (ASTContext &C, int Size)
 Get the argument type for arguments to os_log_helper.
 
static bool isSpecialUnsignedMultiplySignedResult (unsigned BuiltinID, WidthAndSignedness Op1Info, WidthAndSignedness Op2Info, WidthAndSignedness ResultInfo)
 
static RValue EmitCheckedUnsignedMultiplySignedResult (CodeGenFunction &CGF, const clang::Expr *Op1, WidthAndSignedness Op1Info, const clang::Expr *Op2, WidthAndSignedness Op2Info, const clang::Expr *ResultArg, QualType ResultQTy, WidthAndSignedness ResultInfo)
 
static bool isSpecialMixedSignMultiply (unsigned BuiltinID, WidthAndSignedness Op1Info, WidthAndSignedness Op2Info, WidthAndSignedness ResultInfo)
 Determine if a binop is a checked mixed-sign multiply we can specialize.
 
static RValue EmitCheckedMixedSignMultiply (CodeGenFunction &CGF, const clang::Expr *Op1, WidthAndSignedness Op1Info, const clang::Expr *Op2, WidthAndSignedness Op2Info, const clang::Expr *ResultArg, QualType ResultQTy, WidthAndSignedness ResultInfo)
 Emit a checked mixed-sign multiply.
 
static bool TypeRequiresBuiltinLaunderImp (const ASTContext &Ctx, QualType Ty, llvm::SmallPtrSetImpl< const Decl * > &Seen)
 
static bool TypeRequiresBuiltinLaunder (CodeGenModule &CGM, QualType Ty)
 Determine if the specified type requires laundering by checking if it is a dynamic class type or contains a subobject which is a dynamic class type.
 
static unsigned mutateLongDoubleBuiltin (unsigned BuiltinID)
 
static ValuetryUseTestFPKind (CodeGenFunction &CGF, unsigned BuiltinID, Value *V)
 
static RValue EmitHipStdParUnsupportedBuiltin (CodeGenFunction *CGF, const FunctionDecl *FD)
 
static ValueEmitTargetArchBuiltinExpr (CodeGenFunction *CGF, unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Triple::ArchType Arch)
 
static llvm::FixedVectorType * GetNeonType (CodeGenFunction *CGF, NeonTypeFlags TypeFlags, bool HasLegalHalfType=true, bool V1Ty=false, bool AllowBFloatArgsAndRet=true)
 
static llvm::VectorType * GetFloatNeonType (CodeGenFunction *CGF, NeonTypeFlags IntTypeFlags)
 
static const ARMVectorIntrinsicInfo * findARMVectorIntrinsicInMap (ArrayRef< ARMVectorIntrinsicInfo > IntrinsicMap, unsigned BuiltinID, bool &MapProvenSorted)
 
static ValueEmitCommonNeonSISDBuiltinExpr (CodeGenFunction &CGF, const ARMVectorIntrinsicInfo &SISDInfo, SmallVectorImpl< Value * > &Ops, const CallExpr *E)
 
static ValuepackTBLDVectorList (CodeGenFunction &CGF, ArrayRef< Value * > Ops, Value *ExtOp, Value *IndexOp, llvm::Type *ResTy, unsigned IntID, const char *Name)
 
static ValueEmitAMDGCNBallotForExec (CodeGenFunction &CGF, const CallExpr *E, llvm::Type *RegisterType, llvm::Type *ValueType, bool isExecHi)
 
static ValueEmitSpecialRegisterBuiltin (CodeGenFunction &CGF, const CallExpr *E, llvm::Type *RegisterType, llvm::Type *ValueType, SpecialRegisterAccessKind AccessKind, StringRef SysReg="")
 
static bool HasExtraNeonArgument (unsigned BuiltinID)
 Return true if BuiltinID is an overloaded Neon intrinsic with an extra argument that specifies the vector type.
 
template<typename Integer >
static Integer GetIntegerConstantValue (const Expr *E, ASTContext &Context)
 
static llvm::ValueSignOrZeroExtend (CGBuilderTy &Builder, llvm::Value *V, llvm::Type *T, bool Unsigned)
 
static llvm::ValueMVEImmediateShr (CGBuilderTy &Builder, llvm::Value *V, uint32_t Shift, bool Unsigned)
 
static llvm::ValueARMMVEVectorSplat (CGBuilderTy &Builder, llvm::Value *V)
 
static llvm::ValueARMMVEVectorReinterpret (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *DestType)
 
static llvm::ValueVectorUnzip (CGBuilderTy &Builder, llvm::Value *V, bool Odd)
 
static llvm::ValueVectorZip (CGBuilderTy &Builder, llvm::Value *V0, llvm::Value *V1)
 
template<unsigned HighBit, unsigned OtherBits>
static llvm::ValueARMMVEConstantSplat (CGBuilderTy &Builder, llvm::Type *VT)
 
static llvm::ValueARMMVEVectorElementReverse (CGBuilderTy &Builder, llvm::Value *V, unsigned ReverseWidth)
 
static ValueEmitAArch64TblBuiltinExpr (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E, SmallVectorImpl< Value * > &Ops, llvm::Triple::ArchType Arch)
 
static llvm::ScalableVectorType * getSVEVectorForElementType (llvm::Type *EltTy)
 
static void InsertExplicitZeroOperand (CGBuilderTy &Builder, llvm::Type *Ty, SmallVectorImpl< Value * > &Ops)
 
static void InsertExplicitUndefOperand (CGBuilderTy &Builder, llvm::Type *Ty, SmallVectorImpl< Value * > &Ops)
 
static void swapCommutativeSMEOperands (unsigned BuiltinID, SmallVectorImpl< Value * > &Ops)
 
static ValuegetMaskVecValue (CodeGenFunction &CGF, Value *Mask, unsigned NumElts)
 
static ValueEmitX86MaskedStore (CodeGenFunction &CGF, ArrayRef< Value * > Ops, Align Alignment)
 
static ValueEmitX86MaskedLoad (CodeGenFunction &CGF, ArrayRef< Value * > Ops, Align Alignment)
 
static ValueEmitX86ExpandLoad (CodeGenFunction &CGF, ArrayRef< Value * > Ops)
 
static ValueEmitX86CompressExpand (CodeGenFunction &CGF, ArrayRef< Value * > Ops, bool IsCompress)
 
static ValueEmitX86CompressStore (CodeGenFunction &CGF, ArrayRef< Value * > Ops)
 
static ValueEmitX86MaskLogic (CodeGenFunction &CGF, Instruction::BinaryOps Opc, ArrayRef< Value * > Ops, bool InvertLHS=false)
 
static ValueEmitX86FunnelShift (CodeGenFunction &CGF, Value *Op0, Value *Op1, Value *Amt, bool IsRight)
 
static ValueEmitX86vpcom (CodeGenFunction &CGF, ArrayRef< Value * > Ops, bool IsSigned)
 
static ValueEmitX86Select (CodeGenFunction &CGF, Value *Mask, Value *Op0, Value *Op1)
 
static ValueEmitX86ScalarSelect (CodeGenFunction &CGF, Value *Mask, Value *Op0, Value *Op1)
 
static ValueEmitX86MaskedCompareResult (CodeGenFunction &CGF, Value *Cmp, unsigned NumElts, Value *MaskIn)
 
static ValueEmitX86MaskedCompare (CodeGenFunction &CGF, unsigned CC, bool Signed, ArrayRef< Value * > Ops)
 
static ValueEmitX86ConvertToMask (CodeGenFunction &CGF, Value *In)
 
static ValueEmitX86ConvertIntToFp (CodeGenFunction &CGF, const CallExpr *E, ArrayRef< Value * > Ops, bool IsSigned)
 
static ValueEmitX86FMAExpr (CodeGenFunction &CGF, const CallExpr *E, ArrayRef< Value * > Ops, unsigned BuiltinID, bool IsAddSub)
 
static ValueEmitScalarFMAExpr (CodeGenFunction &CGF, const CallExpr *E, MutableArrayRef< Value * > Ops, Value *Upper, bool ZeroMask=false, unsigned PTIdx=0, bool NegAcc=false)
 
static ValueEmitX86Muldq (CodeGenFunction &CGF, bool IsSigned, ArrayRef< Value * > Ops)
 
static ValueEmitX86Ternlog (CodeGenFunction &CGF, bool ZeroMask, ArrayRef< Value * > Ops)
 
static ValueEmitX86SExtMask (CodeGenFunction &CGF, Value *Op, llvm::Type *DstTy)
 
static ValueEmitX86CvtF16ToFloatExpr (CodeGenFunction &CGF, ArrayRef< Value * > Ops, llvm::Type *DstTy)
 
static ValueloadRISCVFeatureBits (unsigned Index, CGBuilderTy &Builder, CodeGenModule &CGM)
 
Intrinsic::ID getDotProductIntrinsic (QualType QT, int elementCount)
 
static ValueEmitSystemZIntrinsicWithCC (CodeGenFunction &CGF, unsigned IntrinsicID, const CallExpr *E)
 Handle a SystemZ function in which the final argument is a pointer to an int that receives the post-instruction CC value.
 
static std::pair< Intrinsic::ID, unsignedgetIntrinsicForHexagonNonClangBuiltin (unsigned BuiltinID)
 

Variables

static const ARMVectorIntrinsicInfo ARMSIMDIntrinsicMap []
 
static const ARMVectorIntrinsicInfo AArch64SIMDIntrinsicMap []
 
static const ARMVectorIntrinsicInfo AArch64SISDIntrinsicMap []
 
static const std::pair< unsigned, unsignedNEONEquivalentIntrinsicMap []
 
static const ARMVectorIntrinsicInfo AArch64SVEIntrinsicMap []
 
static const ARMVectorIntrinsicInfo AArch64SMEIntrinsicMap []
 
static bool NEONSIMDIntrinsicsProvenSorted = false
 
static bool AArch64SIMDIntrinsicsProvenSorted = false
 
static bool AArch64SISDIntrinsicsProvenSorted = false
 
static bool AArch64SVEIntrinsicsProvenSorted = false
 
static bool AArch64SMEIntrinsicsProvenSorted = false
 
constexpr unsigned SVEBitsPerBlock = 128
 

Macro Definition Documentation

◆ CUSTOM_BUILTIN [1/2]

#define CUSTOM_BUILTIN (   Name,
  Intr,
  Types,
  Acc,
  Feature 
)
Value:
case PPC::BI__builtin_##Name: \
ID = Intrinsic::ppc_##Intr; \
Accumulate = Acc; \
break;
static void Accumulate(SMap &SM, CFGBlock *B)
Definition: CFGStmtMap.cpp:49

◆ CUSTOM_BUILTIN [2/2]

#define CUSTOM_BUILTIN (   Name,
  Intr,
  Types,
  Accumulate,
  Feature 
)     case PPC::BI__builtin_##Name:

◆ CUSTOM_BUILTIN_MAPPING

#define CUSTOM_BUILTIN_MAPPING (   x,
  s 
)     { Hexagon::BI__builtin_HEXAGON_##x, Intrinsic::hexagon_##x, s },

◆ GET_SME_LLVM_INTRINSIC_MAP

#define GET_SME_LLVM_INTRINSIC_MAP

◆ GET_SVE_LLVM_INTRINSIC_MAP

#define GET_SVE_LLVM_INTRINSIC_MAP

◆ INTRINSIC_WITH_CC

#define INTRINSIC_WITH_CC (   NAME)
Value:
case SystemZ::BI__builtin_##NAME: \
return EmitSystemZIntrinsicWithCC(*this, Intrinsic::NAME, E)
static Value * EmitSystemZIntrinsicWithCC(CodeGenFunction &CGF, unsigned IntrinsicID, const CallExpr *E)
Handle a SystemZ function in which the final argument is a pointer to an int that receives the post-i...
Expr * E

◆ INTRINSIC_X86_XSAVE_ID

#define INTRINSIC_X86_XSAVE_ID (   NAME)
Value:
case X86::BI__builtin_ia32_##NAME: \
ID = Intrinsic::x86_##NAME; \
break

◆ MMA_INTR

#define MMA_INTR (   geom_op_type,
  layout 
)     Intrinsic::nvvm_wmma_##geom_op_type##_##layout##_stride

Definition at line 19934 of file CGBuiltin.cpp.

◆ MMA_LDST

#define MMA_LDST (   n,
  geom_op_type 
)     { n, MMA_INTR(geom_op_type, col), MMA_INTR(geom_op_type, row) }

Definition at line 19936 of file CGBuiltin.cpp.

◆ MMA_SATF_VARIANTS

#define MMA_SATF_VARIANTS (   geom,
  type 
)
Value:
MMA_VARIANTS(geom, type), \
Intrinsic::nvvm_wmma_##geom##_mma_row_row_##type##_satfinite, \
Intrinsic::nvvm_wmma_##geom##_mma_row_col_##type##_satfinite, \
Intrinsic::nvvm_wmma_##geom##_mma_col_row_##type##_satfinite, \
Intrinsic::nvvm_wmma_##geom##_mma_col_col_##type##_satfinite
#define MMA_VARIANTS(geom, type)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.

◆ MMA_VARIANTS

#define MMA_VARIANTS (   geom,
  type 
)
Value:
Intrinsic::nvvm_wmma_##geom##_mma_row_row_##type, \
Intrinsic::nvvm_wmma_##geom##_mma_row_col_##type, \
Intrinsic::nvvm_wmma_##geom##_mma_col_row_##type, \
Intrinsic::nvvm_wmma_##geom##_mma_col_col_##type

◆ MMA_VARIANTS_B1_AND

#define MMA_VARIANTS_B1_AND (   geom,
  type 
)
Value:
0, \
Intrinsic::nvvm_wmma_##geom##_mma_and_popc_row_col_##type, \
0, \
0, \
0, \
0, \
0, \
0

◆ MMA_VARIANTS_B1_XOR

#define MMA_VARIANTS_B1_XOR (   geom,
  type 
)
Value:
0, \
Intrinsic::nvvm_wmma_##geom##_mma_xor_popc_row_col_##type, \
0, \
0, \
0, \
0, \
0, \
0

◆ MMA_VARIANTS_I4

#define MMA_VARIANTS_I4 (   geom,
  type 
)
Value:
0, \
Intrinsic::nvvm_wmma_##geom##_mma_row_col_##type, \
0, \
0, \
0, \
Intrinsic::nvvm_wmma_##geom##_mma_row_col_##type##_satfinite, \
0, \
0

◆ MUTATE_LDBL

#define MUTATE_LDBL (   func)
Value:
case Builtin::BI__builtin_##func##l: \
return Builtin::BI__builtin_##func##f128;

◆ NEONMAP0

#define NEONMAP0 (   NameBase)     { #NameBase, NEON::BI__builtin_neon_ ## NameBase, 0, 0, 0 }

Definition at line 6495 of file CGBuiltin.cpp.

◆ NEONMAP1

#define NEONMAP1 (   NameBase,
  LLVMIntrinsic,
  TypeModifier 
)
Value:
{ #NameBase, NEON:: BI__builtin_neon_ ## NameBase, \
Intrinsic::LLVMIntrinsic, 0, TypeModifier }

Definition at line 6498 of file CGBuiltin.cpp.

◆ NEONMAP2

#define NEONMAP2 (   NameBase,
  LLVMIntrinsic,
  AltLLVMIntrinsic,
  TypeModifier 
)
Value:
{ #NameBase, NEON:: BI__builtin_neon_ ## NameBase, \
Intrinsic::LLVMIntrinsic, Intrinsic::AltLLVMIntrinsic, \
TypeModifier }

Definition at line 6502 of file CGBuiltin.cpp.

◆ PPC_AIX_FEATURE

#define PPC_AIX_FEATURE (   NAME,
  DESC,
  SUPPORT_METHOD,
  INDEX,
  MASK,
  COMP_OP,
  VALUE 
)     .Case(NAME, {SUPPORT_METHOD, INDEX, MASK, COMP_OP, VALUE})

◆ PPC_CPU

#define PPC_CPU (   NAME,
  Linux_SUPPORT_METHOD,
  LinuxID,
  AIX_SUPPORT_METHOD,
  AIXID 
)     .Case(NAME, {Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID})

◆ PPC_LNX_FEATURE

#define PPC_LNX_FEATURE (   Name,
  Description,
  EnumName,
  Bitmask,
  FA_WORD 
)     .Case(Name, {FA_WORD, Bitmask})

◆ SMEMAP1

#define SMEMAP1 (   NameBase,
  LLVMIntrinsic,
  TypeModifier 
)
Value:
{ \
#NameBase, SME::BI__builtin_sme_##NameBase, Intrinsic::LLVMIntrinsic, 0, \
TypeModifier \
}

Definition at line 7509 of file CGBuiltin.cpp.

◆ SMEMAP2

#define SMEMAP2 (   NameBase,
  TypeModifier 
)     { #NameBase, SME::BI__builtin_sme_##NameBase, 0, 0, TypeModifier }

Definition at line 7515 of file CGBuiltin.cpp.

◆ SVEMAP1

#define SVEMAP1 (   NameBase,
  LLVMIntrinsic,
  TypeModifier 
)
Value:
{ \
#NameBase, SVE::BI__builtin_sve_##NameBase, Intrinsic::LLVMIntrinsic, 0, \
TypeModifier \
}

Definition at line 7491 of file CGBuiltin.cpp.

◆ SVEMAP2

#define SVEMAP2 (   NameBase,
  TypeModifier 
)     { #NameBase, SVE::BI__builtin_sve_##NameBase, 0, 0, TypeModifier }

Definition at line 7497 of file CGBuiltin.cpp.

◆ X86_CPU_SUBTYPE

#define X86_CPU_SUBTYPE (   ENUM,
  STR 
)     .Case(STR, {2u, static_cast<unsigned>(llvm::X86::ENUM)})

◆ X86_CPU_SUBTYPE_ALIAS

#define X86_CPU_SUBTYPE_ALIAS (   ENUM,
  ALIAS 
)     .Case(ALIAS, {2u, static_cast<unsigned>(llvm::X86::ENUM)})

◆ X86_CPU_TYPE

#define X86_CPU_TYPE (   ENUM,
  STR 
)     .Case(STR, {1u, static_cast<unsigned>(llvm::X86::ENUM)})

◆ X86_CPU_TYPE_ALIAS

#define X86_CPU_TYPE_ALIAS (   ENUM,
  ALIAS 
)     .Case(ALIAS, {1u, static_cast<unsigned>(llvm::X86::ENUM)})

◆ X86_VENDOR

#define X86_VENDOR (   ENUM,
  STRING 
)     .Case(STRING, {0u, static_cast<unsigned>(llvm::X86::ENUM)})

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AddRetType 
Add1ArgType 
Add2ArgTypes 
VectorizeRetType 
VectorizeArgTypes 
InventFloatType 
UnsignedAlts 
Use64BitVectors 
Use128BitVectors 
Vectorize1ArgType 
VectorRet 
VectorRetGetArgs01 
FpCmpzModifiers 

Definition at line 6456 of file CGBuiltin.cpp.

◆ MSVCIntrin

enum class CodeGenFunction::MSVCIntrin
strong
Enumerator
_BitScanForward 
_BitScanReverse 
_InterlockedAnd 
_InterlockedDecrement 
_InterlockedExchange 
_InterlockedExchangeAdd 
_InterlockedExchangeSub 
_InterlockedIncrement 
_InterlockedOr 
_InterlockedXor 
_InterlockedExchangeAdd_acq 
_InterlockedExchangeAdd_rel 
_InterlockedExchangeAdd_nf 
_InterlockedExchange_acq 
_InterlockedExchange_rel 
_InterlockedExchange_nf 
_InterlockedCompareExchange_acq 
_InterlockedCompareExchange_rel 
_InterlockedCompareExchange_nf 
_InterlockedCompareExchange128 
_InterlockedCompareExchange128_acq 
_InterlockedCompareExchange128_rel 
_InterlockedCompareExchange128_nf 
_InterlockedOr_acq 
_InterlockedOr_rel 
_InterlockedOr_nf 
_InterlockedXor_acq 
_InterlockedXor_rel 
_InterlockedXor_nf 
_InterlockedAnd_acq 
_InterlockedAnd_rel 
_InterlockedAnd_nf 
_InterlockedIncrement_acq 
_InterlockedIncrement_rel 
_InterlockedIncrement_nf 
_InterlockedDecrement_acq 
_InterlockedDecrement_rel 
_InterlockedDecrement_nf 
__fastfail 

Definition at line 1431 of file CGBuiltin.cpp.

◆ SpecialRegisterAccessKind

Enumerator
NormalRead 
VolatileRead 
Write 

Definition at line 8447 of file CGBuiltin.cpp.

Function Documentation

◆ areBOSTypesCompatible()

static bool areBOSTypesCompatible ( int  From,
int  To 
)
static

Checks if using the result of __builtin_object_size(p, From) in place of __builtin_object_size(p, To) is correct.

Definition at line 801 of file CGBuiltin.cpp.

◆ ARMMVEConstantSplat()

template<unsigned HighBit, unsigned OtherBits>
static llvm::Value * ARMMVEConstantSplat ( CGBuilderTy Builder,
llvm::Type VT 
)
static

Definition at line 9364 of file CGBuiltin.cpp.

References ARMMVEVectorSplat(), and clang::T.

◆ ARMMVEVectorElementReverse()

static llvm::Value * ARMMVEVectorElementReverse ( CGBuilderTy Builder,
llvm::Value V,
unsigned  ReverseWidth 
)
static

Definition at line 9376 of file CGBuiltin.cpp.

References V.

◆ ARMMVEVectorReinterpret()

static llvm::Value * ARMMVEVectorReinterpret ( CGBuilderTy Builder,
CodeGenFunction CGF,
llvm::Value V,
llvm::Type DestType 
)
static

◆ ARMMVEVectorSplat()

static llvm::Value * ARMMVEVectorSplat ( CGBuilderTy Builder,
llvm::Value V 
)
static

Definition at line 9304 of file CGBuiltin.cpp.

References V.

Referenced by ARMMVEConstantSplat().

◆ bitActionToX86BTCode()

static char bitActionToX86BTCode ( BitTest::ActionKind  A)
static

Definition at line 1191 of file CGBuiltin.cpp.

Referenced by EmitX86BitTestIntrinsic().

◆ CheckAtomicAlignment()

static Address CheckAtomicAlignment ( CodeGenFunction CGF,
const CallExpr E 
)
static

◆ CountCountedByAttrs()

static unsigned CountCountedByAttrs ( const RecordDecl RD)
static

◆ EmitAArch64TblBuiltinExpr()

static Value * EmitAArch64TblBuiltinExpr ( CodeGenFunction CGF,
unsigned  BuiltinID,
const CallExpr E,
SmallVectorImpl< Value * > &  Ops,
llvm::Triple::ArchType  Arch 
)
static

◆ EmitAbs()

static Value * EmitAbs ( CodeGenFunction CGF,
Value ArgValue,
bool  HasNSW 
)
static

Definition at line 2017 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder.

Referenced by EmitOverflowCheckedAbs().

◆ EmitAMDGCNBallotForExec()

static Value * EmitAMDGCNBallotForExec ( CodeGenFunction CGF,
const CallExpr E,
llvm::Type RegisterType,
llvm::Type ValueType,
bool  isExecHi 
)
static

◆ EmitAtomicCmpXchg128ForMSIntrin()

static Value * EmitAtomicCmpXchg128ForMSIntrin ( CodeGenFunction CGF,
const CallExpr E,
AtomicOrdering  SuccessOrdering 
)
static

◆ EmitAtomicCmpXchgForMSIntrin()

static Value * EmitAtomicCmpXchgForMSIntrin ( CodeGenFunction CGF,
const CallExpr E,
AtomicOrdering  SuccessOrdering = AtomicOrdering::SequentiallyConsistent 
)
static

This function should be invoked to emit atomic cmpxchg for Microsoft's _InterlockedCompareExchange* intrinsics which have the following signature: T _InterlockedCompareExchange(T volatile *Destination, T Exchange, T Comparand);.

Whereas the llvm 'cmpxchg' instruction has the following syntax: cmpxchg *Destination, Comparand, Exchange. So we need to swap Comparand and Exchange when invoking CreateAtomicCmpXchg. That is the reason we could not use the above utility function MakeAtomicCmpXchgValue since it expects the arguments to be already swapped.

Definition at line 351 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), E, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::getContext(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isPointerType(), and clang::Result.

◆ EmitAtomicDecrementValue()

static Value * EmitAtomicDecrementValue ( CodeGenFunction CGF,
const CallExpr E,
AtomicOrdering  Ordering = AtomicOrdering::SequentiallyConsistent 
)
static

◆ EmitAtomicIncrementValue()

static Value * EmitAtomicIncrementValue ( CodeGenFunction CGF,
const CallExpr E,
AtomicOrdering  Ordering = AtomicOrdering::SequentiallyConsistent 
)
static

◆ EmitBinaryAtomic()

static RValue EmitBinaryAtomic ( CodeGenFunction CGF,
llvm::AtomicRMWInst::BinOp  Kind,
const CallExpr E 
)
static

Definition at line 257 of file CGBuiltin.cpp.

References E, clang::CodeGen::RValue::get(), and MakeBinaryAtomicValue().

◆ EmitBinaryAtomicPost()

static RValue EmitBinaryAtomicPost ( CodeGenFunction CGF,
llvm::AtomicRMWInst::BinOp  Kind,
const CallExpr E,
Instruction::BinaryOps  Op,
bool  Invert = false 
)
static

◆ emitBinaryExpMaybeConstrainedFPBuiltin()

static Value * emitBinaryExpMaybeConstrainedFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
llvm::Intrinsic::ID  IntrinsicID,
llvm::Intrinsic::ID  ConstrainedIntrinsicID 
)
static

◆ emitBinaryMaybeConstrainedFPBuiltin()

static Value * emitBinaryMaybeConstrainedFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID,
unsigned  ConstrainedIntrinsicID 
)
static

◆ EmitBitTestIntrinsic()

static llvm::Value * EmitBitTestIntrinsic ( CodeGenFunction CGF,
unsigned  BuiltinID,
const CallExpr E 
)
static

Emit a _bittest* intrinsic.

These intrinsics take a pointer to an array of bits and a bit position and read and optionally modify the bit at that position. The position index can be arbitrarily large, i.e. it can be larger than 31 or 63, so we need an indexed load in the general case.

Definition at line 1252 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), clang::CodeGen::CGBuilderTy::CreateInBoundsGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), E, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitX86BitTestIntrinsic(), getBitTestAtomicOrdering(), clang::CodeGen::CodeGenFunction::getTarget(), clang::TargetInfo::getTriple(), clang::Value::getType(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::CharUnits::One().

◆ emitBuiltinWithOneOverloadedType()

template<unsigned N>
Value * emitBuiltinWithOneOverloadedType ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID,
llvm::StringRef  Name = "" 
)

◆ emitCallMaybeConstrainedFPBuiltin()

static Value * emitCallMaybeConstrainedFPBuiltin ( CodeGenFunction CGF,
unsigned  IntrinsicID,
unsigned  ConstrainedIntrinsicID,
llvm::Type Ty,
ArrayRef< Value * >  Args 
)
static

◆ EmitCheckedMixedSignMultiply()

static RValue EmitCheckedMixedSignMultiply ( CodeGenFunction CGF,
const clang::Expr Op1,
WidthAndSignedness  Op1Info,
const clang::Expr Op2,
WidthAndSignedness  Op2Info,
const clang::Expr ResultArg,
QualType  ResultQTy,
WidthAndSignedness  ResultInfo 
)
static

◆ EmitCheckedUnsignedMultiplySignedResult()

static RValue EmitCheckedUnsignedMultiplySignedResult ( CodeGenFunction CGF,
const clang::Expr Op1,
WidthAndSignedness  Op1Info,
const clang::Expr Op2,
WidthAndSignedness  Op2Info,
const clang::Expr ResultArg,
QualType  ResultQTy,
WidthAndSignedness  ResultInfo 
)
static

◆ EmitCommonNeonSISDBuiltinExpr()

static Value * EmitCommonNeonSISDBuiltinExpr ( CodeGenFunction CGF,
const ARMVectorIntrinsicInfo &  SISDInfo,
SmallVectorImpl< Value * > &  Ops,
const CallExpr E 
)
static

◆ EmitFAbs()

static Value * EmitFAbs ( CodeGenFunction CGF,
Value V 
)
static

◆ emitFPIntBuiltin()

static Value * emitFPIntBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID 
)
static

◆ emitFrexpBuiltin()

static Value * emitFrexpBuiltin ( CodeGenFunction CGF,
const CallExpr E,
llvm::Intrinsic::ID  IntrinsicID 
)
static

◆ EmitFromInt()

static Value * EmitFromInt ( CodeGenFunction CGF,
llvm::Value V,
QualType  T,
llvm::Type ResultType 
)
static

◆ EmitHipStdParUnsupportedBuiltin()

static RValue EmitHipStdParUnsupportedBuiltin ( CodeGenFunction CGF,
const FunctionDecl FD 
)
static

◆ EmitISOVolatileLoad()

static Value * EmitISOVolatileLoad ( CodeGenFunction CGF,
const CallExpr E 
)
static

◆ EmitISOVolatileStore()

static Value * EmitISOVolatileStore ( CodeGenFunction CGF,
const CallExpr E 
)
static

◆ emitLibraryCall()

static RValue emitLibraryCall ( CodeGenFunction CGF,
const FunctionDecl FD,
const CallExpr E,
llvm::Constant *  calleeValue 
)
static

◆ emitMaybeConstrainedFPToIntRoundBuiltin()

static Value * emitMaybeConstrainedFPToIntRoundBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID,
unsigned  ConstrainedIntrinsicID 
)
static

◆ EmitMSVCRTSetJmp()

static RValue EmitMSVCRTSetJmp ( CodeGenFunction CGF,
MSVCSetJmpKind  SJKind,
const CallExpr E 
)
static

◆ EmitNontemporalLoad()

static Value * EmitNontemporalLoad ( CodeGenFunction CGF,
const CallExpr E 
)
static

◆ EmitNontemporalStore()

static Value * EmitNontemporalStore ( CodeGenFunction CGF,
const CallExpr E 
)
static

◆ EmitOverflowCheckedAbs()

static Value * EmitOverflowCheckedAbs ( CodeGenFunction CGF,
const CallExpr E,
bool  SanitizeOverflow 
)
static

◆ EmitOverflowIntrinsic()

static llvm::Value * EmitOverflowIntrinsic ( CodeGenFunction CGF,
const llvm::Intrinsic::ID  IntrinsicID,
llvm::Value X,
llvm::Value Y,
llvm::Value *&  Carry 
)
static

Emit a call to llvm.

{sadd,uadd,ssub,usub,smul,umul}.with.overflow.* depending on IntrinsicID.

  • CGF The current codegen function.
  • IntrinsicID The ID for the Intrinsic we wish to generate.
  • X The first argument to the llvm.*.with.overflow.*.
  • Y The second argument to the llvm.*.with.overflow.*.
  • Carry The carry returned by the llvm.*.with.overflow.*.
    Returns
    The result (i.e. sum/product) returned by the intrinsic.

Definition at line 724 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::Function, clang::CodeGen::CodeGenModule::getIntrinsic(), and X.

Referenced by EmitCheckedMixedSignMultiply(), and EmitCheckedUnsignedMultiplySignedResult().

◆ emitPPCLoadReserveIntrinsic()

static llvm::Value * emitPPCLoadReserveIntrinsic ( CodeGenFunction CGF,
unsigned  BuiltinID,
const CallExpr E 
)
static

◆ emitRangedBuiltin()

static Value * emitRangedBuiltin ( CodeGenFunction CGF,
unsigned  IntrinsicID,
int  low,
int  high 
)
static

◆ EmitScalarFMAExpr()

static Value * EmitScalarFMAExpr ( CodeGenFunction CGF,
const CallExpr E,
MutableArrayRef< Value * >  Ops,
Value Upper,
bool  ZeroMask = false,
unsigned  PTIdx = 0,
bool  NegAcc = false 
)
static

◆ EmitSignBit()

static Value * EmitSignBit ( CodeGenFunction CGF,
Value V 
)
static

Emit the computation of the sign bit for a floating point value.

Returns the i1 sign bit value.

Definition at line 660 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenFunction::getTarget(), clang::TargetInfo::isBigEndian(), and V.

◆ EmitSpecialRegisterBuiltin()

static Value * EmitSpecialRegisterBuiltin ( CodeGenFunction CGF,
const CallExpr E,
llvm::Type RegisterType,
llvm::Type ValueType,
SpecialRegisterAccessKind  AccessKind,
StringRef  SysReg = "" 
)
static

◆ EmitSystemZIntrinsicWithCC()

static Value * EmitSystemZIntrinsicWithCC ( CodeGenFunction CGF,
unsigned  IntrinsicID,
const CallExpr E 
)
static

Handle a SystemZ function in which the final argument is a pointer to an int that receives the post-instruction CC value.

At the LLVM level this is represented as a function that returns a {result, cc} pair.

Definition at line 19507 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateStore(), E, clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::Function, and clang::CodeGen::CodeGenModule::getIntrinsic().

◆ EmitTargetArchBuiltinExpr()

static Value * EmitTargetArchBuiltinExpr ( CodeGenFunction CGF,
unsigned  BuiltinID,
const CallExpr E,
ReturnValueSlot  ReturnValue,
llvm::Triple::ArchType  Arch 
)
static

◆ emitTernaryMaybeConstrainedFPBuiltin()

static Value * emitTernaryMaybeConstrainedFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID,
unsigned  ConstrainedIntrinsicID 
)
static

◆ EmitToInt()

static Value * EmitToInt ( CodeGenFunction CGF,
llvm::Value V,
QualType  T,
llvm::IntegerType *  IntType 
)
static

Emit the conversions required to turn the given value into an integer of the given size.

Definition at line 174 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::T, and V.

Referenced by EmitBinaryAtomicPost(), MakeAtomicCmpXchgValue(), and MakeBinaryAtomicValue().

◆ emitUnaryMaybeConstrainedFPBuiltin()

static Value * emitUnaryMaybeConstrainedFPBuiltin ( CodeGenFunction CGF,
const CallExpr E,
unsigned  IntrinsicID,
unsigned  ConstrainedIntrinsicID 
)
static

◆ EmitX86BitTestIntrinsic()

static llvm::Value * EmitX86BitTestIntrinsic ( CodeGenFunction CGF,
BitTest  BT,
const CallExpr E,
Value BitBase,
Value BitPos 
)
static

◆ EmitX86CompressExpand()

static Value * EmitX86CompressExpand ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
bool  IsCompress 
)
static

◆ EmitX86CompressStore()

static Value * EmitX86CompressStore ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops 
)
static

◆ EmitX86ConvertIntToFp()

static Value * EmitX86ConvertIntToFp ( CodeGenFunction CGF,
const CallExpr E,
ArrayRef< Value * >  Ops,
bool  IsSigned 
)
static

◆ EmitX86ConvertToMask()

static Value * EmitX86ConvertToMask ( CodeGenFunction CGF,
Value In 
)
static

Definition at line 13860 of file CGBuiltin.cpp.

References EmitX86MaskedCompare().

◆ EmitX86CvtF16ToFloatExpr()

static Value * EmitX86CvtF16ToFloatExpr ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
llvm::Type DstTy 
)
static

◆ EmitX86ExpandLoad()

static Value * EmitX86ExpandLoad ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops 
)
static

◆ EmitX86FMAExpr()

static Value * EmitX86FMAExpr ( CodeGenFunction CGF,
const CallExpr E,
ArrayRef< Value * >  Ops,
unsigned  BuiltinID,
bool  IsAddSub 
)
static

◆ EmitX86FunnelShift()

static Value * EmitX86FunnelShift ( CodeGenFunction CGF,
Value Op0,
Value Op1,
Value Amt,
bool  IsRight 
)
static

◆ EmitX86MaskedCompare()

static Value * EmitX86MaskedCompare ( CodeGenFunction CGF,
unsigned  CC,
bool  Signed,
ArrayRef< Value * >  Ops 
)
static

◆ EmitX86MaskedCompareResult()

static Value * EmitX86MaskedCompareResult ( CodeGenFunction CGF,
Value Cmp,
unsigned  NumElts,
Value MaskIn 
)
static

◆ EmitX86MaskedLoad()

static Value * EmitX86MaskedLoad ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
Align  Alignment 
)
static

Definition at line 13653 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and getMaskVecValue().

◆ EmitX86MaskedStore()

static Value * EmitX86MaskedStore ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
Align  Alignment 
)
static

Definition at line 13642 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and getMaskVecValue().

◆ EmitX86MaskLogic()

static Value * EmitX86MaskLogic ( CodeGenFunction CGF,
Instruction::BinaryOps  Opc,
ArrayRef< Value * >  Ops,
bool  InvertLHS = false 
)
static

Definition at line 13702 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and getMaskVecValue().

◆ EmitX86Muldq()

static Value * EmitX86Muldq ( CodeGenFunction CGF,
bool  IsSigned,
ArrayRef< Value * >  Ops 
)
static

◆ EmitX86ScalarSelect()

static Value * EmitX86ScalarSelect ( CodeGenFunction CGF,
Value Mask,
Value Op0,
Value Op1 
)
static

◆ EmitX86Select()

static Value * EmitX86Select ( CodeGenFunction CGF,
Value Mask,
Value Op0,
Value Op1 
)
static

◆ EmitX86SExtMask()

static Value * EmitX86SExtMask ( CodeGenFunction CGF,
Value Op,
llvm::Type DstTy 
)
static

Definition at line 14198 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and getMaskVecValue().

◆ EmitX86Ternlog()

static Value * EmitX86Ternlog ( CodeGenFunction CGF,
bool  ZeroMask,
ArrayRef< Value * >  Ops 
)
static

◆ EmitX86vpcom()

static Value * EmitX86vpcom ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
bool  IsSigned 
)
static

◆ EncompassingIntegerType()

static struct WidthAndSignedness EncompassingIntegerType ( ArrayRef< struct WidthAndSignedness >  Types)
static

Definition at line 769 of file CGBuiltin.cpp.

References clang::Signed.

◆ findARMVectorIntrinsicInMap()

static const ARMVectorIntrinsicInfo * findARMVectorIntrinsicInMap ( ArrayRef< ARMVectorIntrinsicInfo >  IntrinsicMap,
unsigned  BuiltinID,
bool MapProvenSorted 
)
static

Definition at line 7534 of file CGBuiltin.cpp.

◆ getBitTestAtomicOrdering()

static llvm::AtomicOrdering getBitTestAtomicOrdering ( BitTest::InterlockingKind  I)
static

Definition at line 1237 of file CGBuiltin.cpp.

Referenced by EmitBitTestIntrinsic().

◆ getDefaultBuiltinObjectSizeResult()

static llvm::Value * getDefaultBuiltinObjectSizeResult ( unsigned  Type,
llvm::IntegerType *  ResType 
)
static

Definition at line 809 of file CGBuiltin.cpp.

◆ getDotProductIntrinsic()

Intrinsic::ID getDotProductIntrinsic ( QualType  QT,
int  elementCount 
)

◆ GetFloatNeonType()

static llvm::VectorType * GetFloatNeonType ( CodeGenFunction CGF,
NeonTypeFlags  IntTypeFlags 
)
static

◆ GetIntegerConstantValue()

template<typename Integer >
static Integer GetIntegerConstantValue ( const Expr E,
ASTContext Context 
)
static

Definition at line 9271 of file CGBuiltin.cpp.

References E, and clang::Expr::getIntegerConstantExpr().

◆ getIntegerWidthAndSignedness()

static WidthAndSignedness getIntegerWidthAndSignedness ( const clang::ASTContext context,
const clang::QualType  Type 
)
static

◆ getIntrinsicForHexagonNonClangBuiltin()

static std::pair< Intrinsic::ID, unsigned > getIntrinsicForHexagonNonClangBuiltin ( unsigned  BuiltinID)
static

Definition at line 21803 of file CGBuiltin.cpp.

References CUSTOM_BUILTIN_MAPPING.

◆ getMaskVecValue()

static Value * getMaskVecValue ( CodeGenFunction CGF,
Value Mask,
unsigned  NumElts 
)
static

◆ GetNeonType()

static llvm::FixedVectorType * GetNeonType ( CodeGenFunction CGF,
NeonTypeFlags  TypeFlags,
bool  HasLegalHalfType = true,
bool  V1Ty = false,
bool  AllowBFloatArgsAndRet = true 
)
static

◆ getOSLogArgType()

static CanQualType getOSLogArgType ( ASTContext C,
int  Size 
)
static

Get the argument type for arguments to os_log_helper.

Definition at line 2057 of file CGBuiltin.cpp.

References clang::C.

◆ getSVEVectorForElementType()

static llvm::ScalableVectorType * getSVEVectorForElementType ( llvm::Type EltTy)
static

Definition at line 9788 of file CGBuiltin.cpp.

References SVEBitsPerBlock.

◆ HasExtraNeonArgument()

static bool HasExtraNeonArgument ( unsigned  BuiltinID)
static

Return true if BuiltinID is an overloaded Neon intrinsic with an extra argument that specifies the vector type.

Definition at line 8544 of file CGBuiltin.cpp.

◆ initializeAlloca()

static void initializeAlloca ( CodeGenFunction CGF,
AllocaInst *  AI,
Value Size,
Align  AlignmentInBytes 
)
static

◆ InsertExplicitUndefOperand()

static void InsertExplicitUndefOperand ( CGBuilderTy Builder,
llvm::Type Ty,
SmallVectorImpl< Value * > &  Ops 
)
static

Definition at line 10301 of file CGBuiltin.cpp.

◆ InsertExplicitZeroOperand()

static void InsertExplicitZeroOperand ( CGBuilderTy Builder,
llvm::Type Ty,
SmallVectorImpl< Value * > &  Ops 
)
static

Definition at line 10295 of file CGBuiltin.cpp.

◆ isSpecialMixedSignMultiply()

static bool isSpecialMixedSignMultiply ( unsigned  BuiltinID,
WidthAndSignedness  Op1Info,
WidthAndSignedness  Op2Info,
WidthAndSignedness  ResultInfo 
)
static

Determine if a binop is a checked mixed-sign multiply we can specialize.

Definition at line 2292 of file CGBuiltin.cpp.

Referenced by EmitCheckedMixedSignMultiply().

◆ isSpecialUnsignedMultiplySignedResult()

static bool isSpecialUnsignedMultiplySignedResult ( unsigned  BuiltinID,
WidthAndSignedness  Op1Info,
WidthAndSignedness  Op2Info,
WidthAndSignedness  ResultInfo 
)
static

Definition at line 2250 of file CGBuiltin.cpp.

Referenced by EmitCheckedUnsignedMultiplySignedResult().

◆ loadRISCVFeatureBits()

static Value * loadRISCVFeatureBits ( unsigned  Index,
CGBuilderTy Builder,
CodeGenModule CGM 
)
static

◆ MakeAtomicCmpXchgValue()

static Value * MakeAtomicCmpXchgValue ( CodeGenFunction CGF,
const CallExpr E,
bool  ReturnBool 
)
static

Utility to insert an atomic cmpxchg instruction.

Parameters
CGFThe current codegen function.
EBuiltin call expression to convert to cmpxchg. arg0 - address to operate on arg1 - value to compare with arg2 - new value
ReturnBoolSpecifies whether to return success flag of cmpxchg result or the old value.
Returns
result of cmpxchg, according to ReturnBool

Note: In order to lower Microsoft's _InterlockedCompareExchange* intrinsics invoke the function EmitAtomicCmpXchgForMSIntrin.

Definition at line 311 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), E, EmitFromInt(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitToInt(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), and clang::T.

◆ MakeBinaryAtomicValue()

static Value * MakeBinaryAtomicValue ( CodeGenFunction CGF,
llvm::AtomicRMWInst::BinOp  Kind,
const CallExpr E,
AtomicOrdering  Ordering = AtomicOrdering::SequentiallyConsistent 
)
static

◆ mutateLongDoubleBuiltin()

static unsigned mutateLongDoubleBuiltin ( unsigned  BuiltinID)
static

◆ MVEImmediateShr()

static llvm::Value * MVEImmediateShr ( CGBuilderTy Builder,
llvm::Value V,
uint32_t  Shift,
bool  Unsigned 
)
static

Definition at line 9282 of file CGBuiltin.cpp.

References clang::Unsigned, and V.

◆ packTBLDVectorList()

static Value * packTBLDVectorList ( CodeGenFunction CGF,
ArrayRef< Value * >  Ops,
Value ExtOp,
Value IndexOp,
llvm::Type ResTy,
unsigned  IntID,
const char *  Name 
)
static

◆ SignOrZeroExtend()

static llvm::Value * SignOrZeroExtend ( CGBuilderTy Builder,
llvm::Value V,
llvm::Type T,
bool  Unsigned 
)
static

Definition at line 9275 of file CGBuiltin.cpp.

References clang::T, clang::Unsigned, and V.

◆ swapCommutativeSMEOperands()

static void swapCommutativeSMEOperands ( unsigned  BuiltinID,
SmallVectorImpl< Value * > &  Ops 
)
static

Definition at line 10826 of file CGBuiltin.cpp.

◆ translateAarch64ToMsvcIntrin()

static std::optional< CodeGenFunction::MSVCIntrin > translateAarch64ToMsvcIntrin ( unsigned  BuiltinID)
static

Definition at line 1620 of file CGBuiltin.cpp.

◆ translateArmToMsvcIntrin()

static std::optional< CodeGenFunction::MSVCIntrin > translateArmToMsvcIntrin ( unsigned  BuiltinID)
static

Definition at line 1474 of file CGBuiltin.cpp.

◆ translateX86ToMsvcIntrin()

static std::optional< CodeGenFunction::MSVCIntrin > translateX86ToMsvcIntrin ( unsigned  BuiltinID)
static

Definition at line 1774 of file CGBuiltin.cpp.

◆ tryUseTestFPKind()

static Value * tryUseTestFPKind ( CodeGenFunction CGF,
unsigned  BuiltinID,
Value V 
)
static

◆ TypeRequiresBuiltinLaunder()

static bool TypeRequiresBuiltinLaunder ( CodeGenModule CGM,
QualType  Ty 
)
static

Determine if the specified type requires laundering by checking if it is a dynamic class type or contains a subobject which is a dynamic class type.

Definition at line 2420 of file CGBuiltin.cpp.

References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), and TypeRequiresBuiltinLaunderImp().

◆ TypeRequiresBuiltinLaunderImp()

static bool TypeRequiresBuiltinLaunderImp ( const ASTContext Ctx,
QualType  Ty,
llvm::SmallPtrSetImpl< const Decl * > &  Seen 
)
static

◆ VectorUnzip()

static llvm::Value * VectorUnzip ( CGBuilderTy Builder,
llvm::Value V,
bool  Odd 
)
static

Definition at line 9338 of file CGBuiltin.cpp.

References V.

◆ VectorZip()

static llvm::Value * VectorZip ( CGBuilderTy Builder,
llvm::Value V0,
llvm::Value V1 
)
static

Definition at line 9349 of file CGBuiltin.cpp.

Variable Documentation

◆ AArch64SIMDIntrinsicMap

const ARMVectorIntrinsicInfo AArch64SIMDIntrinsicMap[]
static

Definition at line 6826 of file CGBuiltin.cpp.

◆ AArch64SIMDIntrinsicsProvenSorted

bool AArch64SIMDIntrinsicsProvenSorted = false
static

Definition at line 7528 of file CGBuiltin.cpp.

◆ AArch64SISDIntrinsicMap

const ARMVectorIntrinsicInfo AArch64SISDIntrinsicMap[]
static

Definition at line 7101 of file CGBuiltin.cpp.

◆ AArch64SISDIntrinsicsProvenSorted

bool AArch64SISDIntrinsicsProvenSorted = false
static

Definition at line 7529 of file CGBuiltin.cpp.

◆ AArch64SMEIntrinsicMap

const ARMVectorIntrinsicInfo AArch64SMEIntrinsicMap[]
static
Initial value:
= {
#define GET_SME_LLVM_INTRINSIC_MAP
}

Definition at line 7517 of file CGBuiltin.cpp.

◆ AArch64SMEIntrinsicsProvenSorted

bool AArch64SMEIntrinsicsProvenSorted = false
static

Definition at line 7531 of file CGBuiltin.cpp.

◆ AArch64SVEIntrinsicMap

const ARMVectorIntrinsicInfo AArch64SVEIntrinsicMap[]
static
Initial value:
= {
#define GET_SVE_LLVM_INTRINSIC_MAP
}

Definition at line 7499 of file CGBuiltin.cpp.

◆ AArch64SVEIntrinsicsProvenSorted

bool AArch64SVEIntrinsicsProvenSorted = false
static

Definition at line 7530 of file CGBuiltin.cpp.

◆ ARMSIMDIntrinsicMap

const ARMVectorIntrinsicInfo ARMSIMDIntrinsicMap[]
static

Definition at line 6507 of file CGBuiltin.cpp.

◆ NEONEquivalentIntrinsicMap

const std::pair<unsigned, unsigned> NEONEquivalentIntrinsicMap[]
static

Definition at line 7341 of file CGBuiltin.cpp.

◆ NEONSIMDIntrinsicsProvenSorted

bool NEONSIMDIntrinsicsProvenSorted = false
static

Definition at line 7526 of file CGBuiltin.cpp.

◆ SVEBitsPerBlock

constexpr unsigned SVEBitsPerBlock = 128
constexpr

Definition at line 9786 of file CGBuiltin.cpp.

Referenced by getSVEVectorForElementType().