|
clang 24.0.0git
|
#include "CGBuiltin.h"#include "ABIInfo.h"#include "CGCUDARuntime.h"#include "CGCXXABI.h"#include "CGDebugInfo.h"#include "CGObjCRuntime.h"#include "CGOpenCLRuntime.h"#include "CGRecordLayout.h"#include "CGValue.h"#include "CodeGenFunction.h"#include "CodeGenModule.h"#include "ConstantEmitter.h"#include "PatternInit.h"#include "TargetInfo.h"#include "clang/AST/OSLog.h"#include "clang/AST/StmtVisitor.h"#include "clang/Basic/DiagnosticFrontend.h"#include "clang/Basic/TargetInfo.h"#include "clang/CodeGenUtils/TargetUtils.h"#include "llvm/ADT/APFloat.h"#include "llvm/IR/InlineAsm.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/IntrinsicsX86.h"#include "llvm/IR/MatrixBuilder.h"#include "llvm/Support/ConvertUTF.h"#include "llvm/Support/ScopedPrinter.h"#include <algorithm>#include <optional>#include <utility>Go to the source code of this file.
Macros | |
| #define | MUTATE_LDBL(func) |
Functions | |
| static bool | shouldEmitBuiltinAsIR (unsigned BuiltinID, const Builtin::Context &BI, const CodeGenFunction &CGF) |
| Some builtins do not have library implementation on some targets and are instead emitted as LLVM IRs by some target builtin emitters. | |
| static Value * | EmitTargetArchBuiltinExpr (CodeGenFunction *CGF, unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Triple::ArchType Arch) |
| static void | initializeAlloca (CodeGenFunction &CGF, AllocaInst *AI, Value *Size, Align AlignmentInBytes) |
| void | appendDefaultIntrinsicArgs (SmallVectorImpl< llvm::Value * > &Args, llvm::Function *F) |
| Value * | EmitToInt (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. | |
| Value * | EmitFromInt (CodeGenFunction &CGF, llvm::Value *V, QualType T, llvm::Type *ResultType) |
| Address | CheckAtomicAlignment (CodeGenFunction &CGF, const CallExpr *E) |
| Value * | MakeBinaryAtomicValue (CodeGenFunction &CGF, llvm::AtomicRMWInst::BinOp Kind, const CallExpr *E, AtomicOrdering Ordering, llvm::SyncScope::ID SSID) |
| Utility to insert an atomic instruction based on Intrinsic::ID and the expression node. | |
| static Value * | EmitNontemporalStore (CodeGenFunction &CGF, const CallExpr *E) |
| static Value * | EmitNontemporalLoad (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. | |
| Value * | MakeAtomicCmpXchgValue (CodeGenFunction &CGF, const CallExpr *E, bool ReturnBool, llvm::AtomicOrdering SuccessOrdering, llvm::AtomicOrdering FailureOrdering, llvm::SyncScope::ID SSID) |
| Utility to insert an atomic cmpxchg instruction. | |
| static Value * | EmitAtomicCmpXchgForMSIntrin (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 Value * | EmitAtomicCmpXchg128ForMSIntrin (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering SuccessOrdering) |
| static Value * | EmitAtomicIncrementValue (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering Ordering=AtomicOrdering::SequentiallyConsistent) |
| static Value * | EmitAtomicDecrementValue (CodeGenFunction &CGF, const CallExpr *E, AtomicOrdering Ordering=AtomicOrdering::SequentiallyConsistent) |
| static Value * | EmitISOVolatileLoad (CodeGenFunction &CGF, const CallExpr *E) |
| static Value * | EmitISOVolatileStore (CodeGenFunction &CGF, const CallExpr *E) |
| Value * | emitUnaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID) |
| static Value * | emitBinaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID) |
| static Value * | emitBinaryExpMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, Intrinsic::ID IntrinsicID, Intrinsic::ID ConstrainedIntrinsicID) |
| static Value * | emitTernaryMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID) |
| static Value * | emitMaybeConstrainedFPToIntRoundBuiltin (CodeGenFunction &CGF, const CallExpr *E, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID) |
| static Value * | emitFrexpBuiltin (CodeGenFunction &CGF, const CallExpr *E, Intrinsic::ID IntrinsicID) |
| static void | emitSincosBuiltin (CodeGenFunction &CGF, const CallExpr *E, Intrinsic::ID IntrinsicID) |
| static llvm::Value * | emitModfBuiltin (CodeGenFunction &CGF, const CallExpr *E, Intrinsic::ID IntrinsicID) |
| static Value * | EmitFAbs (CodeGenFunction &CGF, Value *V) |
| EmitFAbs - Emit a call to @llvm.fabs(). | |
| static Value * | EmitSignBit (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) |
| llvm::Value * | EmitOverflowIntrinsic (CodeGenFunction &CGF, const Intrinsic::ID IntrinsicID, llvm::Value *X, llvm::Value *Y, llvm::Value *&Carry) |
| Emit a call to llvm. | |
| 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::Value * | getDefaultBuiltinObjectSizeResult (unsigned Type, llvm::IntegerType *ResType) |
| static const FieldDecl * | FindFlexibleArrayMemberField (CodeGenFunction &CGF, ASTContext &Ctx, const RecordDecl *RD) |
| Find a struct's flexible array member. | |
| static bool | GetFieldOffset (ASTContext &Ctx, const RecordDecl *RD, const FieldDecl *FD, int64_t &Offset) |
| Calculate the offset of a struct field. | |
| static std::optional< int64_t > | GetFieldOffset (ASTContext &Ctx, const RecordDecl *RD, const FieldDecl *FD) |
| static llvm::Value * | EmitPositiveResultOrZero (CodeGenFunction &CGF, llvm::Value *Res, llvm::Value *Index, llvm::IntegerType *ResType, bool IsSigned) |
| static std::pair< llvm::Value *, llvm::Value * > | GetCountFieldAndIndex (CodeGenFunction &CGF, const MemberExpr *ME, const FieldDecl *ArrayFD, const FieldDecl *CountFD, const Expr *Idx, llvm::IntegerType *ResType, bool IsSigned) |
| static char | bitActionToX86BTCode (BitTest::ActionKind A) |
| static llvm::Value * | EmitX86BitTestIntrinsic (CodeGenFunction &CGF, BitTest BT, const CallExpr *E, Value *BitBase, Value *BitPos) |
| static llvm::AtomicOrdering | getBitTestAtomicOrdering (BitTest::InterlockingKind I) |
| static llvm::Value * | EmitBitCountExpr (CodeGenFunction &CGF, const Expr *E) |
| static llvm::Value * | EmitBitTestIntrinsic (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E) |
| Emit a _bittest* intrinsic. | |
| static RValue | EmitMSVCRTSetJmp (CodeGenFunction &CGF, MSVCSetJmpKind SJKind, const CallExpr *E) |
| MSVC handles setjmp a bit differently on different platforms. | |
| static Value * | EmitAbs (CodeGenFunction &CGF, Value *ArgValue, bool HasNSW) |
| static Value * | EmitOverflowCheckedAbs (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 | 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 Value * | tryUseTestFPKind (CodeGenFunction &CGF, unsigned BuiltinID, Value *V) |
| static RValue | EmitHipStdParUnsupportedBuiltin (CodeGenFunction *CGF, const FunctionDecl *FD) |
| static void | ClearPadding (CodeGenFunction &CGF, Address Src, const ASTContext::BitInterval &PaddingInterval) |
| static std::string | getSPIRVBuiltinName (unsigned BuiltinID, bool IsFloat=false, bool IsSigned=false) |
| static llvm::TargetExtType * | getTargetExtType (CodeGenModule &CGM, const CooperativeMatrixType *MTy) |
| static std::string | getCoopMatFullSuffix (llvm::Type *Ty) |
| Returns a suffix encoding ALL parameters of a spirv.CooperativeMatrixKHR TargetExtType: element type + scope + rows + cols + use. | |
| static std::string | getPtrAddrSpaceSuffix (llvm::Type *PtrTy) |
| Returns a name suffix encoding the address space of a pointer type, matching OpenCL/SPIR-V address space conventions. | |
| #define MUTATE_LDBL | ( | func | ) |
Referenced by mutateLongDoubleBuiltin().
| void appendDefaultIntrinsicArgs | ( | SmallVectorImpl< llvm::Value * > & | Args, |
| llvm::Function * | F ) |
Definition at line 210 of file CGBuiltin.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
Checks if using the result of __builtin_object_size(p, From) in place of __builtin_object_size(p, To) is correct.
Definition at line 859 of file CGBuiltin.cpp.
|
static |
Definition at line 1588 of file CGBuiltin.cpp.
Referenced by EmitX86BitTestIntrinsic().
| Address CheckAtomicAlignment | ( | CodeGenFunction & | CGF, |
| const CallExpr * | E ) |
Definition at line 255 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CharUnits::fromQuantity(), clang::CallExpr::getArg(), clang::CallExpr::getBeginLoc(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getDataLayout(), clang::CodeGen::CodeGenModule::getDiags(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), clang::DiagnosticsEngine::Report(), and clang::ASTContext::VoidPtrTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitAMDGPUBuiltinExpr(), EmitAtomicCmpXchgForMSIntrin(), EmitAtomicDecrementValue(), EmitAtomicIncrementValue(), EmitBinaryAtomicPost(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr(), MakeAtomicCmpXchgValue(), and MakeBinaryAtomicValue().
|
static |
Definition at line 2693 of file CGBuiltin.cpp.
References clang::CharUnits::alignmentAtOffset(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), ASTContext::BitInterval::First, clang::CharUnits::fromQuantity(), clang::CodeGen::Address::getAlignment(), clang::CodeGen::Address::getBasePointer(), clang::ASTContext::getCharWidth(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntTy, ASTContext::BitInterval::Last, uint64_t, uint8_t, and clang::Zero.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 2092 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and EmitOverflowCheckedAbs().
|
static |
Definition at line 472 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CallExpr::getNumArgs(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::Success, clang::ASTContext::toCharUnitsFromBits(), and clang::CodeGen::Address::withElementType().
Referenced by clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr().
|
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 417 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::CodeGen::CodeGenTypeCache::IntPtrTy, and clang::Type::isPointerType().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr().
|
static |
Definition at line 536 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), clang::CallExpr::getArg(), clang::Expr::getType(), and clang::Type::isPointerType().
Referenced by clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr().
|
static |
Definition at line 525 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), clang::CallExpr::getArg(), clang::Expr::getType(), and clang::Type::isPointerType().
Referenced by clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr().
|
static |
Definition at line 321 of file CGBuiltin.cpp.
References clang::CodeGen::RValue::get(), and MakeBinaryAtomicValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Utility to insert an atomic instruction based Intrinsic::ID and the expression node, where the return value is the result of the operation.
Definition at line 330 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), EmitFromInt(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitToInt(), clang::CodeGen::RValue::get(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::ASTContext::hasSameUnqualifiedType(), and clang::Type::isPointerType().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 612 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), and clang::CodeGen::CodeGenModule::getIntrinsic().
|
static |
Definition at line 594 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), and clang::CodeGen::CodeGenModule::getIntrinsic().
|
static |
Definition at line 1645 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenFunction::getTarget(), and clang::TargetInfo::isBigEndian().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitCheckedArgForBuiltin().
|
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 1674 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(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitX86BitTestIntrinsic(), clang::CallExpr::getArg(), getBitTestAtomicOrdering(), clang::CodeGen::CodeGenFunction::getTarget(), clang::TargetInfo::getTriple(), clang::Value::getType(), clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::CharUnits::One().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Emit a checked mixed-sign multiply.
This is a cheaper specialization of the generic checked-binop irgen.
Definition at line 2385 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CGBuilderTy::CreateStore(), EmitOverflowIntrinsic(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::CodeGen::RValue::get(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::CodeGen::CodeGenFunction::getTypes(), isSpecialMixedSignMultiply(), clang::QualType::isVolatileQualified(), clang::Signed, clang::Unsigned, and clang::Zero.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 2339 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateStore(), EmitOverflowIntrinsic(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::CodeGen::RValue::get(), clang::Type::getPointeeType(), clang::Expr::getType(), isSpecialUnsignedMultiplySignedResult(), and clang::QualType::isVolatileQualified().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
EmitFAbs - Emit a call to @llvm.fabs().
Definition at line 738 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, and V.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 669 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
| Value * EmitFromInt | ( | CodeGenFunction & | CGF, |
| llvm::Value * | V, | ||
| QualType | T, | ||
| llvm::Type * | ResultType ) |
Definition at line 244 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitFromMemory(), and V.
Referenced by EmitBinaryAtomicPost(), MakeAtomicCmpXchgValue(), and MakeBinaryAtomicValue().
|
static |
Definition at line 2623 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::NamedDecl::getNameAsString(), and clang::CodeGen::CodeGenModule::getTypes().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 549 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateAlignedLoad(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Type::getPointeeType(), clang::CharUnits::getQuantity(), clang::Expr::getType(), and clang::ASTContext::getTypeSizeInChars().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 562 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateAlignedStore(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::ASTContext::getTypeSizeInChars().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 773 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CGCallee::forDirect(), clang::CallExpr::getCallee(), and clang::Expr::getType().
|
static |
Definition at line 651 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenModule::getIntrinsic(), and clang::Expr::getType().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 719 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CallExpr::getArg(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
MSVC handles setjmp a bit differently on different platforms.
On 32-bit x86 extra parameters can be passed as variadic arguments, but we always pass none. Everywhere else a frame value is passed: the stack pointer as it was on entry to the function for AArch64 and 32-bit Arm, and the frame address for the rest.
Definition at line 1762 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenTypeCache::AllocaInt8PtrTy, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCallOrInvoke(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::RValue::get(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenFunction::getTarget(), clang::TargetInfo::getTriple(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::CodeGen::CodeGenTypeCache::IntTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 313 of file CGBuiltin.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CallExpr::getArg(), clang::Expr::getExprLoc(), clang::Expr::getType(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 302 of file CGBuiltin.cpp.
References clang::Addr, clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::CallExpr::getArg(), clang::Expr::getType(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 2098 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, Constant, EmitAbs(), clang::CodeGen::CodeGenFunction::EmitCheck(), clang::CodeGen::CodeGenFunction::EmitCheckSourceLocation(), clang::CodeGen::CodeGenFunction::EmitCheckTypeDescriptor(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitTrapCheck(), clang::CallExpr::getArg(), clang::Expr::getExprLoc(), clang::Expr::getType(), clang::Value::getType(), and clang::Zero.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
| llvm::Value * EmitOverflowIntrinsic | ( | CodeGenFunction & | CGF, |
| const Intrinsic::ID | IntrinsicID, | ||
| llvm::Value * | X, | ||
| llvm::Value * | Y, | ||
| llvm::Value *& | Carry ) |
Emit a call to llvm.
{sadd,uadd,ssub,usub,smul,umul}.with.overflow.* depending on IntrinsicID.
Definition at line 792 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenModule::getIntrinsic(), and X.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), EmitCheckedMixedSignMultiply(), EmitCheckedUnsignedMultiplySignedResult(), and clang::CodeGen::CodeGenFunction::EmitHLSLBuiltinExpr().
|
static |
Definition at line 1012 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, and Cmp.
|
static |
Emit the computation of the sign bit for a floating point value.
Returns the i1 sign bit value.
Definition at line 744 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(), V, and clang::Zero.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 687 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateStore(), clang::Domain, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 75 of file CGBuiltin.cpp.
References Arch, clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAMDGPUBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAVRBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitBPFBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitDirectXBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitHexagonBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitNVPTXBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitPPCBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitRISCVBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitSPIRVBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitSystemZBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitWebAssemblyBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitX86BuiltinExpr(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenFunction::getTarget(), and clang::TargetInfo::getTriple().
Referenced by clang::CodeGen::CodeGenFunction::EmitTargetBuiltinExpr().
|
static |
Definition at line 632 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), and clang::CodeGen::CodeGenModule::getIntrinsic().
| Value * EmitToInt | ( | 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.
Definition at line 233 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitToMemory(), and V.
Referenced by EmitBinaryAtomicPost(), MakeAtomicCmpXchgValue(), and MakeBinaryAtomicValue().
| Value * emitUnaryMaybeConstrainedFPBuiltin | ( | CodeGenFunction & | CGF, |
| const CallExpr * | E, | ||
| unsigned | IntrinsicID, | ||
| unsigned | ConstrainedIntrinsicID ) |
Definition at line 577 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CallExpr::getArg(), and clang::CodeGen::CodeGenModule::getIntrinsic().
|
static |
Definition at line 1598 of file CGBuiltin.cpp.
References clang::Asm, bitActionToX86BTCode(), clang::CodeGen::CodeGenFunction::Builder, clang::CallExpr::getArg(), clang::TargetInfo::getClobbers(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenFunction::getTarget(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), and clang::CodeGen::CodeGenTypeCache::Int8Ty.
Referenced by EmitBitTestIntrinsic().
|
static |
Definition at line 827 of file CGBuiltin.cpp.
References EncompassingIntegerType(), and clang::Signed.
|
static |
Find a struct's flexible array member.
It may be embedded inside multiple sub-structs, but must still be the last field.
Definition at line 884 of file CGBuiltin.cpp.
References clang::RecordDecl::fields(), FindFlexibleArrayMemberField(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::Decl::isFlexibleArrayMemberLike(), and clang::Decl::isImplicit().
Referenced by FindFlexibleArrayMemberField().
|
static |
Definition at line 1634 of file CGBuiltin.cpp.
Referenced by EmitBitTestIntrinsic().
|
static |
Returns a suffix encoding ALL parameters of a spirv.CooperativeMatrixKHR TargetExtType: element type + scope + rows + cols + use.
E.g. target("spirv.CooperativeMatrixKHR", float, 3, 16, 16, 2) -> "_f32_sc3_16x16_u2"
Definition at line 2819 of file CGBuiltin.cpp.
References clang::cast().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
|
static |
Definition at line 867 of file CGBuiltin.cpp.
|
static |
Definition at line 941 of file CGBuiltin.cpp.
References GetFieldOffset(), and int64_t.
|
static |
Calculate the offset of a struct field.
It may be embedded inside multiple sub-structs.
Definition at line 909 of file CGBuiltin.cpp.
References clang::RecordDecl::fields(), clang::ASTContext::getASTRecordLayout(), GetFieldOffset(), clang::ASTRecordLayout::getFieldOffset(), int64_t, clang::Decl::isImplicit(), clang::TagDecl::isUnion(), and uint32_t.
Referenced by GetFieldOffset(), and GetFieldOffset().
|
static |
Definition at line 815 of file CGBuiltin.cpp.
References clang::ASTContext::getIntWidth(), clang::Type::isIntegerType(), clang::Type::isSignedIntegerType(), and clang::Signed.
|
static |
Get the argument type for arguments to os_log_helper.
Definition at line 2140 of file CGBuiltin.cpp.
References clang::C.
Referenced by clang::CodeGen::CodeGenFunction::emitBuiltinOSLogFormat(), and clang::CodeGen::CodeGenFunction::generateBuiltinOSLogHelperFunction().
|
static |
Returns a name suffix encoding the address space of a pointer type, matching OpenCL/SPIR-V address space conventions.
E.g. ptr addrspace(1) -> "_global" ptr addrspace(3) -> "_local" ptr addrspace(0) -> "_private" ptr addrspace(4) -> "_generic"
Definition at line 2853 of file CGBuiltin.cpp.
References clang::cast().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 2775 of file CGBuiltin.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 2806 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenTypes::ConvertTypeForCoopMat(), and clang::CodeGen::CodeGenModule::getTypes().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Definition at line 157 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateMemSet(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::initializationPatternFor(), clang::LangOptionsBase::Pattern, clang::CodeGen::CodeGenModule::stopAutoInit(), clang::LangOptionsBase::Uninitialized, and clang::LangOptionsBase::Zero.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Determine if a binop is a checked mixed-sign multiply we can specialize.
Definition at line 2373 of file CGBuiltin.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and EmitCheckedMixedSignMultiply().
|
static |
Definition at line 2331 of file CGBuiltin.cpp.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and EmitCheckedUnsignedMultiplySignedResult().
| Value * MakeAtomicCmpXchgValue | ( | CodeGenFunction & | CGF, |
| const CallExpr * | E, | ||
| bool | ReturnBool, | ||
| llvm::AtomicOrdering | SuccessOrdering, | ||
| llvm::AtomicOrdering | FailureOrdering, | ||
| llvm::SyncScope::ID | SSID ) |
Utility to insert an atomic cmpxchg instruction.
| CGF | The current codegen function. |
| E | Builtin call expression to convert to cmpxchg. arg0 - address to operate on arg1 - value to compare with arg2 - new value |
| ReturnBool | Specifies whether to return success flag of cmpxchg result or the old value. |
Note: In order to lower Microsoft's _InterlockedCompareExchange* intrinsics invoke the function EmitAtomicCmpXchgForMSIntrin.
Definition at line 375 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CheckAtomicAlignment(), Cmp, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), EmitFromInt(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitToInt(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), and clang::New.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitNVPTXBuiltinExpr().
| Value * MakeBinaryAtomicValue | ( | CodeGenFunction & | CGF, |
| llvm::AtomicRMWInst::BinOp | Kind, | ||
| const CallExpr * | E, | ||
| AtomicOrdering | Ordering, | ||
| llvm::SyncScope::ID | SSID ) |
Utility to insert an atomic instruction based on Intrinsic::ID and the expression node.
Definition at line 274 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::cast(), clang::CodeGen::CodeGenFunction::CGM, CheckAtomicAlignment(), clang::CodeGen::CGBuilderTy::CreateAtomicRMW(), EmitFromInt(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), EmitToInt(), clang::CallExpr::getArg(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::ASTContext::getTypeSize(), clang::ASTContext::hasSameUnqualifiedType(), and clang::Type::isPointerType().
Referenced by EmitBinaryAtomic(), clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitNVPTXBuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitPPCBuiltinExpr().
Definition at line 2541 of file CGBuiltin.cpp.
References acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1, fabs, fdim, floor, fma, fmax, fmin, fmod, frexp, hypot, ilogb, ldexp, lgamma, llrint, llround, log, log10, log1p, log2, logb, lrint, lround, modf(), MUTATE_LDBL, nan(), nearbyint, nextafter, nexttoward, pow, remainder, remquo, rint, round, scalbln, scalbn, sin, sinh, sqrt, tan, tanh, tgamma, and trunc.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
static |
Some builtins do not have library implementation on some targets and are instead emitted as LLVM IRs by some target builtin emitters.
FIXME: Remove this when library support is added
Definition at line 51 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CurFPFeatures, clang::LangOptionsBase::FPE_Ignore, clang::FPOptions::getExceptionMode(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), and clang::CodeGen::TargetCodeGenInfo::supportsLibCall().
|
static |
Definition at line 2612 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::getTargetHooks(), clang::CodeGen::TargetCodeGenInfo::testFPKind(), and V.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().
|
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 2474 of file CGBuiltin.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), and clang::QualType::requiresBuiltinLaunder().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr().