|
clang 23.0.0git
|
#include "CIRGenCall.h"#include "CIRGenFunction.h"#include "CIRGenModule.h"#include "CIRGenValue.h"#include "mlir/IR/BuiltinAttributes.h"#include "mlir/IR/Value.h"#include "mlir/Support/LLVM.h"#include "clang/AST/DeclBase.h"#include "clang/AST/Expr.h"#include "clang/AST/GlobalDecl.h"#include "clang/Basic/Builtins.h"#include "clang/Basic/DiagnosticFrontend.h"#include "clang/Basic/OperatorKinds.h"#include "clang/CIR/Dialect/IR/CIRTypes.h"#include "clang/CIR/MissingFeatures.h"#include "llvm/IR/Intrinsics.h"#include "llvm/Support/ErrorHandling.h"Go to the source code of this file.
Functions | |
| static RValue | emitLibraryCall (CIRGenFunction &cgf, const FunctionDecl *fd, const CallExpr *e, mlir::Operation *calleeValue) |
| template<typename Op> | |
| static RValue | emitBuiltinBitOp (CIRGenFunction &cgf, const CallExpr *e, bool poisonZero=false) |
| static mlir::Value | emitToInt (CIRGenFunction &cgf, mlir::Value v, QualType t, cir::IntType intType) |
| Emit the conversions required to turn the given value into an integer of the given size. | |
| static mlir::Value | emitFromInt (CIRGenFunction &cgf, mlir::Value v, QualType t, mlir::Type resultType) |
| static Address | checkAtomicAlignment (CIRGenFunction &cgf, const CallExpr *e) |
| static mlir::Value | makeBinaryAtomicValue (CIRGenFunction &cgf, cir::AtomicFetchKind kind, const CallExpr *expr, mlir::Type *originalArgType, mlir::Value *emittedArgValue=nullptr, cir::MemOrder ordering=cir::MemOrder::SequentiallyConsistent) |
| Utility to insert an atomic instruction based on Intrinsic::ID and the expression node. | |
| static RValue | emitBinaryAtomicPost (CIRGenFunction &cgf, cir::AtomicFetchKind atomicOpkind, const CallExpr *e, cir::BinOpKind binopKind, bool invert=false) |
| static void | emitAtomicFenceOp (CIRGenFunction &cgf, const CallExpr *expr, cir::SyncScopeKind syncScope) |
| static WidthAndSignedness | getIntegerWidthAndSignedness (const clang::ASTContext &astContext, const clang::QualType type) |
| static struct WidthAndSignedness | EncompassingIntegerType (ArrayRef< struct WidthAndSignedness > types) |
| template<class Operation> | |
| static RValue | emitUnaryMaybeConstrainedFPBuiltin (CIRGenFunction &cgf, const CallExpr &e) |
| template<class Operation> | |
| static RValue | emitUnaryFPBuiltin (CIRGenFunction &cgf, const CallExpr &e) |
| template<typename Op> | |
| static RValue | emitUnaryMaybeConstrainedFPToIntBuiltin (CIRGenFunction &cgf, const CallExpr &e) |
| template<typename Op> | |
| static RValue | emitBinaryFPBuiltin (CIRGenFunction &cgf, const CallExpr &e) |
| template<typename Op> | |
| static mlir::Value | emitBinaryMaybeConstrainedFPBuiltin (CIRGenFunction &cgf, const CallExpr &e) |
| static RValue | errorBuiltinNYI (CIRGenFunction &cgf, const CallExpr *e, unsigned builtinID) |
| static RValue | emitBuiltinAlloca (CIRGenFunction &cgf, const CallExpr *e, unsigned builtinID) |
| static bool | shouldCIREmitFPMathIntrinsic (CIRGenFunction &cgf, const CallExpr *e, unsigned builtinID) |
| static RValue | tryEmitFPMathIntrinsic (CIRGenFunction &cgf, const CallExpr *e, unsigned builtinID) |
| static mlir::Type | decodeFixedType (CIRGenFunction &cgf, ArrayRef< llvm::Intrinsic::IITDescriptor > &infos, mlir::MLIRContext *context) |
| static mlir::Type | correctIntegerSignedness (mlir::Type iitType, QualType astType, mlir::MLIRContext *context) |
| Helper function to correct integer signedness for intrinsic arguments and return type. | |
| static mlir::Value | getCorrectedPtr (mlir::Value argValue, mlir::Type expectedTy, CIRGenBuilderTy &builder) |
| static cir::FuncType | getIntrinsicType (CIRGenFunction &cgf, mlir::MLIRContext *context, llvm::Intrinsic::ID id) |
| static std::optional< mlir::Value > | emitTargetArchBuiltinExpr (CIRGenFunction *cgf, unsigned builtinID, const CallExpr *e, ReturnValueSlot &returnValue, llvm::Triple::ArchType arch) |
|
static |
Definition at line 89 of file CIRGenBuiltin.cpp.
References bytes(), clang::CIRGen::CIRGenFunction::cgm, clang::CIRGen::CIRGenFunction::emitPointerWithAlignment(), clang::CharUnits::fromQuantity(), clang::CIRGen::Address::getAlignment(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenModule::getASTContext(), clang::CallExpr::getBeginLoc(), clang::ASTContext::getCharWidth(), clang::CIRGen::CIRGenFunction::getContext(), clang::CIRGen::CIRGenModule::getDataLayout(), clang::CIRGen::CIRGenModule::getDiags(), clang::CIRGen::Address::getElementType(), clang::CharUnits::getQuantity(), cir::CIRDataLayout::getTypeSizeInBits(), clang::ASTContext::getTypeSizeInChars(), clang::DiagnosticsEngine::Report(), clang::ASTContext::VoidPtrTy, and clang::CIRGen::Address::withAlignment().
Referenced by makeBinaryAtomicValue().
|
static |
Helper function to correct integer signedness for intrinsic arguments and return type.
IIT always returns signed integers, but the actual intrinsic may expect unsigned integers based on the AST FunctionDecl parameter types.
Definition at line 840 of file CIRGenBuiltin.cpp.
References clang::Type::isUnsignedIntegerType().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 804 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::cgm, decodeFixedType(), and clang::CIRGen::CIRGenModule::errorNYI().
Referenced by decodeFixedType(), and getIntrinsicType().
|
static |
Definition at line 186 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::emitAtomicExprWithMemOrder(), clang::ast_matchers::expr, clang::CIRGen::CIRGenFunction::getBuilder(), clang::CIRGen::CIRGenFunction::getLoc(), and clang::CIRGen::CIRGenFunction::getMLIRContext().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 165 of file CIRGenBuiltin.cpp.
References emitFromInt(), clang::CIRGen::RValue::get(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::Expr::getType(), and makeBinaryAtomicValue().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 289 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::convertType(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::Expr::getExprLoc(), clang::CIRGen::CIRGenFunction::getLoc(), and clang::Expr::getType().
Referenced by tryEmitFPMathIntrinsic().
|
static |
Definition at line 301 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::convertType(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), cir::MissingFeatures::fpConstraints(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::Expr::getExprLoc(), clang::CIRGen::CIRGenFunction::getLoc(), and clang::Expr::getType().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitBuiltinExpr(), and tryEmitFPMathIntrinsic().
|
static |
Definition at line 332 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::cgm, cir::CIRBaseBuilderTy::createAlloca(), cir::CIRBaseBuilderTy::createBitcast(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), clang::CIRGen::CIRGenModule::errorNYI(), clang::CIRGen::RValue::get(), clang::QualType::getAddressSpace(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::CIRGen::CIRGenTypeCache::getCIRAllocaAddressSpace(), clang::CIRGen::CIRGenFunction::getContext(), clang::CIRGen::CIRGenFunction::getLangOpts(), clang::CIRGen::CIRGenFunction::getLoc(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::TargetInfo::getSuitableAlign(), clang::ASTContext::getTargetInfo(), clang::Expr::getType(), clang::CIRGen::CIRGenBuilderTy::getUInt8PtrTy(), clang::CIRGen::CIRGenBuilderTy::getUInt8Ty(), cir::CIRBaseBuilderTy::getVoidPtrTy(), cir::isMatchingAddressSpace(), clang::LangOptionsBase::Pattern, clang::ASTContext::toCharUnitsFromBits(), clang::LangOptionsBase::Uninitialized, and clang::LangOptionsBase::Zero.
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 43 of file CIRGenBuiltin.cpp.
References cir::MissingFeatures::builtinCheckKind(), clang::CIRGen::CIRGenFunction::convertType(), cir::CIRBaseBuilderTy::createIntCast(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenFunction::getBuilder(), clang::CIRGen::CIRGenFunction::getLoc(), clang::Stmt::getSourceRange(), and clang::Expr::getType().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 78 of file CIRGenBuiltin.cpp.
References cir::CIRBaseBuilderTy::createIntToPtr(), clang::CIRGen::CIRGenFunction::emitFromMemory(), and clang::CIRGen::CIRGenFunction::getBuilder().
Referenced by emitBinaryAtomicPost().
|
static |
Definition at line 36 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::emitCall(), clang::CIRGen::CIRGenCallee::forDirect(), clang::CallExpr::getCallee(), and clang::Expr::getType().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 2271 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::emitAArch64BuiltinExpr(), clang::CIRGen::CIRGenFunction::emitAMDGPUBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitX86BuiltinExpr(), clang::CIRGen::CIRGenFunction::getLangOpts(), clang::CIRGen::CIRGenFunction::getTarget(), and clang::TargetInfo::getTriple().
Referenced by clang::CIRGen::CIRGenFunction::emitTargetBuiltinExpr().
|
static |
Emit the conversions required to turn the given value into an integer of the given size.
Definition at line 67 of file CIRGenBuiltin.cpp.
References cir::CIRBaseBuilderTy::createPtrToInt(), clang::CIRGen::CIRGenFunction::emitToMemory(), and clang::CIRGen::CIRGenFunction::getBuilder().
Referenced by makeBinaryAtomicValue().
|
static |
Definition at line 269 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::emitScalarExpr(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), and clang::CIRGen::CIRGenFunction::getBuilder().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 256 of file CIRGenBuiltin.cpp.
References cir::MissingFeatures::cgFPOptionsRAII(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), cir::MissingFeatures::fpConstraints(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), and clang::CIRGen::CIRGenFunction::getBuilder().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitPPCBuiltinExpr(), and tryEmitFPMathIntrinsic().
|
static |
Definition at line 277 of file CIRGenBuiltin.cpp.
References clang::CIRGen::CIRGenFunction::convertType(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), cir::MissingFeatures::fpConstraints(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), clang::CIRGen::CIRGenFunction::getBuilder(), and clang::Expr::getType().
Referenced by tryEmitFPMathIntrinsic().
|
static |
Definition at line 224 of file CIRGenBuiltin.cpp.
References EncompassingIntegerType(), and clang::ast_matchers::type.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitBuiltinExpr(), EncompassingIntegerType(), and EncompassingIntegerType().
|
static |
Definition at line 315 of file CIRGenBuiltin.cpp.
References clang::ASTContext::BuiltinInfo, clang::CIRGen::CIRGenFunction::cgm, clang::CIRGen::CIRGenModule::errorNYI(), clang::CIRGen::CIRGenFunction::getContext(), clang::Builtin::Context::getName(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::CIRGen::CIRGenFunction::getUndefRValue(), and clang::Builtin::Context::isLibFunction().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 852 of file CIRGenBuiltin.cpp.
References cir::MissingFeatures::addressSpace(), cir::CIRBaseBuilderTy::createAddrSpaceCast(), and cir::CIRBaseBuilderTy::createBitcast().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 210 of file CIRGenBuiltin.cpp.
References clang::ASTContext::getIntWidth(), clang::ASTContext::getTypeInfo(), clang::ast_matchers::type, and clang::TypeInfo::Width.
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), and clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 870 of file CIRGenBuiltin.cpp.
References decodeFixedType(), clang::isa(), and kind.
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Utility to insert an atomic instruction based on Intrinsic::ID and the expression node.
Definition at line 110 of file CIRGenBuiltin.cpp.
References checkAtomicAlignment(), cir::CIRBaseBuilderTy::createBitcast(), clang::CIRGen::Address::emitRawPointer(), clang::CIRGen::CIRGenFunction::emitScalarExpr(), emitToInt(), clang::ast_matchers::expr, clang::CIRGen::CIRGenFunction::getBuilder(), clang::CIRGen::CIRGenFunction::getContext(), clang::CIRGen::CIRGenFunction::getLoc(), clang::Type::getPointeeType(), cir::CIRBaseBuilderTy::getPointerTo(), clang::CIRGen::CIRGenBuilderTy::getSIntNTy(), clang::ASTContext::getTypeSize(), clang::CIRGen::CIRGenBuilderTy::getUIntNTy(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isPointerType(), clang::Type::isUnsignedIntegerType(), kind, and clang::ast_matchers::type.
Referenced by emitBinaryAtomicPost().
|
static |
Definition at line 392 of file CIRGenBuiltin.cpp.
References clang::ASTContext::BuiltinInfo, clang::CIRGen::CIRGenFunction::cgm, clang::CIRGen::CIRGenFunction::curFuncDecl, clang::CIRGen::CIRGenModule::getCodeGenOpts(), clang::CIRGen::CIRGenFunction::getContext(), clang::CallExpr::getFPFeatures(), clang::CIRGen::CIRGenFunction::getLangOpts(), clang::CIRGen::CIRGenModule::getTriple(), clang::Decl::hasAttr(), clang::CallExpr::hasStoredFPFeatures(), and clang::Builtin::Context::shouldGenerateFPMathIntrinsic().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().
|
static |
Definition at line 415 of file CIRGenBuiltin.cpp.
References emitBinaryFPBuiltin(), emitBinaryMaybeConstrainedFPBuiltin(), emitUnaryMaybeConstrainedFPBuiltin(), emitUnaryMaybeConstrainedFPToIntBuiltin(), cir::MissingFeatures::fastMathFlags(), clang::CIRGen::RValue::get(), and clang::CIRGen::RValue::getIgnored().
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr().