clang 23.0.0git
CIRGenCall.cpp File Reference
#include "CIRGenCall.h"
#include "CIRGenCXXABI.h"
#include "CIRGenFunction.h"
#include "CIRGenFunctionInfo.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "clang/CIR/ABIArgInfo.h"
#include "clang/CIR/MissingFeatures.h"
#include "llvm/Support/TypeSize.h"

Go to the source code of this file.

Functions

static void addAttributesFromFunctionProtoType (CIRGenBuilderTy &builder, mlir::NamedAttrList &attrs, const FunctionProtoType *fpt)
static void addNoBuiltinAttributes (mlir::MLIRContext &ctx, mlir::NamedAttrList &attrs, const LangOptions &langOpts, const NoBuiltinAttr *nba=nullptr)
static void addDenormalModeAttrs (llvm::DenormalMode fpDenormalMode, llvm::DenormalMode fp32DenormalMode, mlir::NamedAttrList &attrs)
 Add denormal-fp-math and denormal-fp-math-f32 as appropriate for the requested denormal behavior, accounting for the overriding behavior of the -f32 case.
static void addMergeableDefaultFunctionAttributes (const CodeGenOptions &codeGenOpts, mlir::NamedAttrList &attrs)
 Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and should not simply overwrite any existing attributes in the linked library.
static llvm::StringLiteral getZeroCallUsedRegsKindStr (llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind k)
static void addTrivialDefaultFunctionAttributes (mlir::MLIRContext *mlirCtx, StringRef name, bool hasOptNoneAttr, const CodeGenOptions &codeGenOpts, const LangOptions &langOpts, bool attrOnCallSite, mlir::NamedAttrList &attrs)
 Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and should not simply overwrite any existing attributes in the linked library.
static bool determineNoUndef (QualType clangTy, CIRGenTypes &types, const cir::CIRDataLayout &layout, const cir::ABIArgInfo &argInfo)
static CanQual< FunctionProtoTypegetFormalType (const CXXMethodDecl *md)
 Returns the canonical formal type of the given C++ method.
static void appendParameterTypes (const CIRGenTypes &cgt, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > fpt)
 Adds the formal parameters in FPT to the given prefix.
static const CIRGenFunctionInfoarrangeCIRFunctionInfo (CIRGenTypes &cgt, bool instanceMethod, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > fpt)
 Arrange the CIR function layout for a value of the given function type, on top of any implicit parameters already stored.
static const CIRGenFunctionInfoarrangeFreeFunctionLikeCall (CIRGenTypes &cgt, CIRGenModule &cgm, const CallArgList &args, const FunctionType *fnType)
static cir::CIRCallOpInterface emitCallLikeOp (CIRGenFunction &cgf, mlir::Location callLoc, cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal, cir::FuncOp directFuncOp, const SmallVectorImpl< mlir::Value > &cirCallArgs, bool isInvoke, const mlir::NamedAttrList &attrs, llvm::ArrayRef< mlir::NamedAttrList > argAttrs, const mlir::NamedAttrList &retAttrs)

Function Documentation

◆ addAttributesFromFunctionProtoType()

void addAttributesFromFunctionProtoType ( CIRGenBuilderTy & builder,
mlir::NamedAttrList & attrs,
const FunctionProtoType * fpt )
static

◆ addDenormalModeAttrs()

void addDenormalModeAttrs ( llvm::DenormalMode fpDenormalMode,
llvm::DenormalMode fp32DenormalMode,
mlir::NamedAttrList & attrs )
static

Add denormal-fp-math and denormal-fp-math-f32 as appropriate for the requested denormal behavior, accounting for the overriding behavior of the -f32 case.

Definition at line 154 of file CIRGenCall.cpp.

Referenced by addMergableDefaultFunctionAttributes(), and addMergeableDefaultFunctionAttributes().

◆ addMergeableDefaultFunctionAttributes()

void addMergeableDefaultFunctionAttributes ( const CodeGenOptions & codeGenOpts,
mlir::NamedAttrList & attrs )
static

Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and should not simply overwrite any existing attributes in the linked library.

Definition at line 167 of file CIRGenCall.cpp.

References addDenormalModeAttrs(), clang::CodeGenOptions::FP32DenormalMode, and clang::CodeGenOptions::FPDenormalMode.

Referenced by clang::CIRGen::CIRGenModule::addDefaultFunctionAttributes().

◆ addNoBuiltinAttributes()

void addNoBuiltinAttributes ( mlir::MLIRContext & ctx,
mlir::NamedAttrList & attrs,
const LangOptions & langOpts,
const NoBuiltinAttr * nba = nullptr )
static

◆ addTrivialDefaultFunctionAttributes()

void addTrivialDefaultFunctionAttributes ( mlir::MLIRContext * mlirCtx,
StringRef name,
bool hasOptNoneAttr,
const CodeGenOptions & codeGenOpts,
const LangOptions & langOpts,
bool attrOnCallSite,
mlir::NamedAttrList & attrs )
static

Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and should not simply overwrite any existing attributes in the linked library.

Definition at line 202 of file CIRGenCall.cpp.

References clang::LangOptions::assumeFunctionsAreConvergent(), clang::CodeGenOptions::DefaultFunctionAttrs, getZeroCallUsedRegsKindStr(), clang::LangOptions::isNoBuiltinFunc(), and clang::CodeGenOptions::TrapFuncName.

Referenced by clang::CIRGen::CIRGenModule::addDefaultFunctionAttributes().

◆ appendParameterTypes()

void appendParameterTypes ( const CIRGenTypes & cgt,
SmallVectorImpl< CanQualType > & prefix,
CanQual< FunctionProtoType > fpt )
static

Adds the formal parameters in FPT to the given prefix.

If any parameter in FPT has pass_object_size_attrs, then we'll add parameters for those, too. TODO(cir): this should be shared with LLVM codegen

Definition at line 722 of file CIRGenCall.cpp.

References clang::CIRGen::CIRGenModule::errorNYI(), clang::CIRGen::CIRGenTypes::getCGModule(), and cir::MissingFeatures::opCallExtParameterInfo().

Referenced by arrangeCIRFunctionInfo(), clang::CIRGen::CIRGenTypes::arrangeCXXStructorDeclaration(), clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(), and arrangeLLVMFunctionInfo().

◆ arrangeCIRFunctionInfo()

const CIRGenFunctionInfo & arrangeCIRFunctionInfo ( CIRGenTypes & cgt,
bool instanceMethod,
SmallVectorImpl< CanQualType > & prefix,
CanQual< FunctionProtoType > fpt )
static

◆ arrangeFreeFunctionLikeCall()

◆ determineNoUndef()

◆ emitCallLikeOp()

cir::CIRCallOpInterface emitCallLikeOp ( CIRGenFunction & cgf,
mlir::Location callLoc,
cir::FuncType indirectFuncTy,
mlir::Value indirectFuncVal,
cir::FuncOp directFuncOp,
const SmallVectorImpl< mlir::Value > & cirCallArgs,
bool isInvoke,
const mlir::NamedAttrList & attrs,
llvm::ArrayRef< mlir::NamedAttrList > argAttrs,
const mlir::NamedAttrList & retAttrs )
static

◆ getFormalType()

◆ getZeroCallUsedRegsKindStr()

llvm::StringLiteral getZeroCallUsedRegsKindStr ( llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind k)
static

Definition at line 174 of file CIRGenCall.cpp.

Referenced by addTrivialDefaultFunctionAttributes().