clang 22.0.0git
clang::CIRGen::CIRGenFunction Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.h"

Inheritance diagram for clang::CIRGen::CIRGenFunction:
[legend]

Classes

class  AbstractCallee
 An abstract representation of regular/ObjC call/message targets. More...
struct  AutoVarEmission
struct  CGCoroInfo
class  ConditionalEvaluation
 An object to manage conditionally-evaluated expressions. More...
struct  ConditionalInfo
class  ConstantEmission
class  CXXDefaultInitExprScope
 The scope of a CXXDefaultInitExpr. More...
class  DeclMapRevertingRAII
class  FieldConstructionScope
 A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr. More...
struct  LexicalScope
 Represents a scope, including function bodies, compound statements, and the substatements of if/while/do/for/switch/try statements. More...
class  OpaqueValueMapping
 An RAII object to set (and then clear) a mapping for an OpaqueValueExpr. More...
class  OpaqueValueMappingData
 A non-RAII class containing all the information about a bound opaque value. More...
struct  OpenACCDataOperandInfo
struct  PrototypeWrapper
class  RunCleanupsScope
 Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited. More...
class  SourceLocRAIIObject
class  StmtExprEvaluation
 An RAII object to record that we're evaluating a statement expression. More...
struct  VlaSizePair
struct  VPtr

Public Types

using DeclMapTy = llvm::DenseMap<const clang::Decl *, Address>
using SymTableTy = llvm::ScopedHashTable<const clang::Decl *, mlir::Value>
 The symbol table maps a variable name to a value in the current scope.
using SymTableScopeTy
using VisitedVirtualBasesSetTy
using VPtrsVector = llvm::SmallVector<VPtr, 4>
using SourceLocExprScopeGuard
typedef void Destroyer(CIRGenFunction &cgf, Address addr, QualType ty)

Public Member Functions

bool isCoroutine () const
clang::ASTContextgetContext () const
CIRGenBuilderTygetBuilder ()
CIRGenModulegetCIRGenModule ()
const CIRGenModulegetCIRGenModule () const
mlir::Block * getCurFunctionEntryBlock ()
mlir::Type convertTypeForMem (QualType t)
mlir::Type convertType (clang::QualType t)
mlir::Type convertType (const TypeDecl *t)
 CIRGenFunction (CIRGenModule &cgm, CIRGenBuilderTy &builder, bool suppressNewContext=false)
 ~CIRGenFunction ()
CIRGenTypesgetTypes () const
const TargetInfogetTarget () const
mlir::MLIRContext & getMLIRContext ()
mlir::Value createDummyValue (mlir::Location loc, clang::QualType qt)
void emitNullInitialization (mlir::Location loc, Address destPtr, QualType ty)
std::string getCounterRefTmpAsString ()
std::string getCounterAggTmpAsString ()
mlir::Location getLoc (clang::SourceLocation srcLoc)
 Helpers to convert Clang's SourceLocation to a MLIR Location.
mlir::Location getLoc (clang::SourceRange srcLoc)
mlir::Location getLoc (mlir::Location lhs, mlir::Location rhs)
const clang::LangOptionsgetLangOpts () const
bool haveInsertPoint () const
 True if an insertion point is defined.
bool isLValueSuitableForInlineAtomic (LValue lv)
 An LValue is a candidate for having its loads and stores be made atomic if we are operating under /volatile:ms and the LValue itself is volatile and performing such an operation can be performed without a libcall.
VlaSizePair getVLASize (const VariableArrayType *type)
 Returns an MLIR::Value+QualType pair that corresponds to the size, in non-variably-sized elements, of a variable length array type, plus that largest non-variably-sized element type.
VlaSizePair getVLASize (QualType type)
void finishFunction (SourceLocation endLoc)
bool isTrivialInitializer (const Expr *init)
 Determine whether the given initializer is trivial in the sense that it requires no code to be generated.
bool constantFoldsToBool (const clang::Expr *cond, bool &resultBool, bool allowLabels=false)
 If the specified expression does not fold to a constant, or if it does but contains a label, return false.
bool constantFoldsToSimpleInteger (const clang::Expr *cond, llvm::APSInt &resultInt, bool allowLabels=false)
 If the specified expression does not fold to a constant, or if it does fold but contains a label, return false.
bool containsLabel (const clang::Stmt *s, bool ignoreCaseStmts=false)
 Return true if the statement contains a label in it.
ConstantEmission tryEmitAsConstant (const DeclRefExpr *refExpr)
 Try to emit a reference to the given value without producing it as an l-value.
ConstantEmission tryEmitAsConstant (const MemberExpr *me)
mlir::Value evaluateExprAsBool (const clang::Expr *e)
 Perform the usual unary conversions on the specified expression and compare the result against zero, returning an Int1Ty value.
cir::GlobalOp addInitializerToStaticVarDecl (const VarDecl &d, cir::GlobalOp gv, cir::GetGlobalOp gvAddr)
 Add the initializer for 'd' to the global variable that has already been created for it.
void enterDtorCleanups (const CXXDestructorDecl *dtor, CXXDtorType type)
 Enter the cleanups necessary to complete the given phase of destruction for a destructor.
bool needsEHCleanup (QualType::DestructionKind kind)
 Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
CleanupKind getCleanupKind (QualType::DestructionKind kind)
void pushStackRestore (CleanupKind kind, Address spMem)
void setAddrOfLocalVar (const clang::VarDecl *vd, Address addr)
 Set the address of a local variable.
bool shouldNullCheckClassCastValue (const CastExpr *ce)
RValue convertTempToRValue (Address addr, clang::QualType type, clang::SourceLocation loc)
 Given the address of a temporary variable, produce an r-value of its type.
VPtrsVector getVTablePointers (const clang::CXXRecordDecl *vtableClass)
void getVTablePointers (clang::BaseSubobject base, const clang::CXXRecordDecl *nearestVBase, clang::CharUnits offsetFromNearestVBase, bool baseIsNonVirtualPrimaryBase, const clang::CXXRecordDecl *vtableClass, VisitedVirtualBasesSetTy &vbases, VPtrsVector &vptrs)
mlir::Value getVTablePtr (mlir::Location loc, Address thisAddr, const clang::CXXRecordDecl *vtableClass)
 Return the Value of the vtable pointer member pointed to by thisAddr.
bool shouldEmitVTableTypeCheckedLoad (const CXXRecordDecl *rd)
 Returns whether we should perform a type checked load when loading a virtual function for virtual calls to members of RD.
LValue makeNaturalAlignPointeeAddrLValue (mlir::Value v, clang::QualType t)
 Given a value of type T* that may not be to a complete object, construct an l-vlaue withi the natural pointee alignment of T.
LValue makeNaturalAlignAddrLValue (mlir::Value val, QualType ty)
Address makeNaturalAddressForPointer (mlir::Value ptr, QualType t, CharUnits alignment, bool forPointeeType=false, LValueBaseInfo *baseInfo=nullptr)
 Construct an address with the natural alignment of T.
Address getAddressOfBaseClass (Address value, const CXXRecordDecl *derived, llvm::iterator_range< CastExpr::path_const_iterator > path, bool nullCheckValue, SourceLocation loc)
mlir::Value getVTTParameter (GlobalDecl gd, bool forVirtualBase, bool delegating)
 Return the VTT parameter that should be passed to a base constructor/destructor with virtual bases.
LValue makeAddrLValue (Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
LValue makeAddrLValue (Address addr, QualType ty, LValueBaseInfo baseInfo)
void initializeVTablePointers (mlir::Location loc, const clang::CXXRecordDecl *rd)
void initializeVTablePointer (mlir::Location loc, const VPtr &vptr)
AggValueSlot::Overlap_t getOverlapForFieldInit (const FieldDecl *fd)
Address getAddrOfLocalVar (const clang::VarDecl *vd)
 Return the address of a local variable.
Address getAddrOfBitFieldStorage (LValue base, const clang::FieldDecl *field, mlir::Type fieldType, unsigned index)
LValue getOrCreateOpaqueLValueMapping (const OpaqueValueExpr *e)
 Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.
RValue getOrCreateOpaqueRValueMapping (const OpaqueValueExpr *e)
 Given an opaque value expression, return its RValue mapping if it exists, otherwise create one.
mlir::Value loadCXXThis ()
 Load the value for 'this'.
Address loadCXXThisAddress ()
mlir::Value loadCXXVTT ()
 Load the VTT parameter to base constructors/destructors have virtual bases.
Address getAddressOfDirectBaseInCompleteClass (mlir::Location loc, Address value, const CXXRecordDecl *derived, const CXXRecordDecl *base, bool baseIsVirtual)
 Convert the given pointer to a complete class to the given direct base.
AggValueSlot::Overlap_t getOverlapForReturnValue ()
 Determine whether a return value slot may overlap some other object.
AggValueSlot::Overlap_t getOverlapForBaseInit (const CXXRecordDecl *rd, const CXXRecordDecl *baseRD, bool isVirtual)
 Determine whether a base class initialization may overlap some other object.
RValue getUndefRValue (clang::QualType ty)
 Get an appropriate 'undef' rvalue for the given type.
cir::FuncOp generateCode (clang::GlobalDecl gd, cir::FuncOp fn, cir::FuncType funcType)
clang::QualType buildFunctionArgList (clang::GlobalDecl gd, FunctionArgList &args)
void startFunction (clang::GlobalDecl gd, clang::QualType returnType, cir::FuncOp fn, cir::FuncType funcType, FunctionArgList args, clang::SourceLocation loc, clang::SourceLocation startLoc)
 Emit code for the start of a function.
void popCleanupBlocks (EHScopeStack::stable_iterator oldCleanupStackDepth)
 Takes the old cleanup stack size and emits the cleanup blocks that have been added.
void popCleanupBlock ()
 Pops a cleanup block.
template<class T, class... As>
void pushFullExprCleanup (CleanupKind kind, As... a)
 Push a cleanup to be run at the end of the current full-expression.
void pushDestroy (CleanupKind kind, Address addr, QualType type, Destroyer *destroyer)
DestroyergetDestroyer (clang::QualType::DestructionKind kind)
mlir::Value emitAlignmentAssumption (mlir::Value ptrValue, QualType ty, SourceLocation loc, SourceLocation assumptionLoc, int64_t alignment, mlir::Value offsetValue=nullptr)
mlir::Value emitAlignmentAssumption (mlir::Value ptrValue, const Expr *expr, SourceLocation assumptionLoc, int64_t alignment, mlir::Value offsetValue=nullptr)
Address emitAddrOfFieldStorage (Address base, const FieldDecl *field, llvm::StringRef fieldName, unsigned fieldIndex)
 Get the address of a zero-sized field within a record.
mlir::Value emitAlloca (llvm::StringRef name, mlir::Type ty, mlir::Location loc, clang::CharUnits alignment, bool insertIntoFnEntryBlock, mlir::Value arraySize=nullptr)
mlir::Value emitAlloca (llvm::StringRef name, mlir::Type ty, mlir::Location loc, clang::CharUnits alignment, mlir::OpBuilder::InsertPoint ip, mlir::Value arraySize=nullptr)
void emitAggregateStore (mlir::Value value, Address dest)
void emitAggExpr (const clang::Expr *e, AggValueSlot slot)
LValue emitAggExprToLValue (const Expr *e)
void emitAggregateCopy (LValue dest, LValue src, QualType eltTy, AggValueSlot::Overlap_t mayOverlap)
 Emit an aggregate copy.
RValue emitAnyExpr (const clang::Expr *e, AggValueSlot aggSlot=AggValueSlot::ignored())
 Emit code to compute the specified expression which can have any type.
void emitAnyExprToMem (const Expr *e, Address location, Qualifiers quals, bool isInitializer)
 Emits the code necessary to evaluate an arbitrary expression into the given memory location.
RValue emitAnyExprToTemp (const clang::Expr *e)
 Similarly to emitAnyExpr(), however, the result will always be accessible even if no aggregate location is provided.
void emitAnyExprToExn (const Expr *e, Address addr)
void emitArrayDestroy (mlir::Value begin, mlir::Value numElements, QualType elementType, CharUnits elementAlign, Destroyer *destroyer)
 Destroys all the elements of the given array, beginning from last to first.
mlir::Value emitArrayLength (const clang::ArrayType *arrayType, QualType &baseType, Address &addr)
 Computes the length of an array in elements, as well as the base element type and a properly-typed first element pointer.
LValue emitArraySubscriptExpr (const clang::ArraySubscriptExpr *e)
Address emitArrayToPointerDecay (const Expr *e, LValueBaseInfo *baseInfo=nullptr)
mlir::LogicalResult emitAsmStmt (const clang::AsmStmt &s)
RValue emitAtomicExpr (AtomicExpr *e)
void emitAtomicInit (Expr *init, LValue dest)
AutoVarEmission emitAutoVarAlloca (const clang::VarDecl &d, mlir::OpBuilder::InsertPoint ip={})
void emitAutoVarDecl (const clang::VarDecl &d)
 Emit code and set up symbol table for a variable declaration with auto, register, or no storage class specifier.
void emitAutoVarCleanups (const AutoVarEmission &emission)
void emitAutoVarInit (const AutoVarEmission &emission)
 Emit the initializer for an allocated variable.
void emitAutoVarTypeCleanup (const AutoVarEmission &emission, clang::QualType::DestructionKind dtorKind)
 Enter a destroy cleanup for the given local variable.
void maybeEmitDeferredVarDeclInit (const VarDecl *vd)
void emitBaseInitializer (mlir::Location loc, const CXXRecordDecl *classDecl, CXXCtorInitializer *baseInit)
LValue emitBinaryOperatorLValue (const BinaryOperator *e)
mlir::LogicalResult emitBreakStmt (const clang::BreakStmt &s)
RValue emitBuiltinExpr (const clang::GlobalDecl &gd, unsigned builtinID, const clang::CallExpr *e, ReturnValueSlot returnValue)
RValue emitCall (const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOp, mlir::Location loc)
RValue emitCall (const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOrTryCall=nullptr)
RValue emitCall (clang::QualType calleeTy, const CIRGenCallee &callee, const clang::CallExpr *e, ReturnValueSlot returnValue)
void emitCallArg (CallArgList &args, const clang::Expr *e, clang::QualType argType)
void emitCallArgs (CallArgList &args, PrototypeWrapper prototype, llvm::iterator_range< clang::CallExpr::const_arg_iterator > argRange, AbstractCallee callee=AbstractCallee(), unsigned paramsToSkip=0)
RValue emitCallExpr (const clang::CallExpr *e, ReturnValueSlot returnValue=ReturnValueSlot())
LValue emitCallExprLValue (const clang::CallExpr *e)
CIRGenCallee emitCallee (const clang::Expr *e)
template<typename T>
mlir::LogicalResult emitCaseDefaultCascade (const T *stmt, mlir::Type condType, mlir::ArrayAttr value, cir::CaseOpKind kind, bool buildingTopLevelCase)
mlir::LogicalResult emitCaseStmt (const clang::CaseStmt &s, mlir::Type condType, bool buildingTopLevelCase)
LValue emitCastLValue (const CastExpr *e)
 Casts are never lvalues unless that cast is to a reference type.
mlir::Value emitCheckedArgForAssume (const Expr *e)
 Emits an argument for a call to a __builtin_assume.
mlir::Value emitComplexToScalarConversion (mlir::Value src, QualType srcTy, QualType dstTy, SourceLocation loc)
 Emit a conversion from the specified complex type to the specified destination type, where the destination type is an LLVM scalar type.
LValue emitCompoundAssignmentLValue (const clang::CompoundAssignOperator *e)
LValue emitCompoundLiteralLValue (const CompoundLiteralExpr *e)
void emitConstructorBody (FunctionArgList &args)
mlir::LogicalResult emitCoroutineBody (const CoroutineBodyStmt &s)
cir::CallOp emitCoroEndBuiltinCall (mlir::Location loc, mlir::Value nullPtr)
cir::CallOp emitCoroIDBuiltinCall (mlir::Location loc, mlir::Value nullPtr)
void emitDestroy (Address addr, QualType type, Destroyer *destroyer)
 Immediately perform the destruction of the given object.
void emitDestructorBody (FunctionArgList &args)
 Emits the body of the current destructor.
mlir::LogicalResult emitContinueStmt (const clang::ContinueStmt &s)
void emitCXXConstructExpr (const clang::CXXConstructExpr *e, AggValueSlot dest)
void emitCXXAggrConstructorCall (const CXXConstructorDecl *ctor, const clang::ArrayType *arrayType, Address arrayBegin, const CXXConstructExpr *e, bool newPointerIsChecked, bool zeroInitialize=false)
 Emit a loop to call a particular constructor for each of several members of an array.
void emitCXXAggrConstructorCall (const CXXConstructorDecl *ctor, mlir::Value numElements, Address arrayBase, const CXXConstructExpr *e, bool newPointerIsChecked, bool zeroInitialize)
 Emit a loop to call a particular constructor for each of several members of an array.
void emitCXXConstructorCall (const clang::CXXConstructorDecl *d, clang::CXXCtorType type, bool forVirtualBase, bool delegating, AggValueSlot thisAVS, const clang::CXXConstructExpr *e)
void emitCXXConstructorCall (const clang::CXXConstructorDecl *d, clang::CXXCtorType type, bool forVirtualBase, bool delegating, Address thisAddr, CallArgList &args, clang::SourceLocation loc)
void emitCXXDeleteExpr (const CXXDeleteExpr *e)
void emitCXXDestructorCall (const CXXDestructorDecl *dd, CXXDtorType type, bool forVirtualBase, bool delegating, Address thisAddr, QualType thisTy)
RValue emitCXXDestructorCall (GlobalDecl dtor, const CIRGenCallee &callee, mlir::Value thisVal, QualType thisTy, mlir::Value implicitParam, QualType implicitParamTy, const CallExpr *e)
mlir::LogicalResult emitCXXForRangeStmt (const CXXForRangeStmt &s, llvm::ArrayRef< const Attr * > attrs)
RValue emitCXXMemberCallExpr (const clang::CXXMemberCallExpr *e, ReturnValueSlot returnValue)
RValue emitCXXMemberOrOperatorCall (const clang::CXXMethodDecl *md, const CIRGenCallee &callee, ReturnValueSlot returnValue, mlir::Value thisPtr, mlir::Value implicitParam, clang::QualType implicitParamTy, const clang::CallExpr *ce, CallArgList *rtlArgs)
RValue emitCXXMemberOrOperatorMemberCallExpr (const clang::CallExpr *ce, const clang::CXXMethodDecl *md, ReturnValueSlot returnValue, bool hasQualifier, clang::NestedNameSpecifier qualifier, bool isArrow, const clang::Expr *base)
mlir::Value emitCXXNewExpr (const CXXNewExpr *e)
void emitNewArrayInitializer (const CXXNewExpr *E, QualType ElementType, mlir::Type ElementTy, Address BeginPtr, mlir::Value NumElements, mlir::Value AllocSizeWithoutCookie)
RValue emitCXXOperatorMemberCallExpr (const CXXOperatorCallExpr *e, const CXXMethodDecl *md, ReturnValueSlot returnValue)
RValue emitCXXPseudoDestructorExpr (const CXXPseudoDestructorExpr *expr)
void emitCXXTemporary (const CXXTemporary *temporary, QualType tempType, Address ptr)
 Emits all the code to cause the given temporary to be cleaned up.
void emitCXXThrowExpr (const CXXThrowExpr *e)
mlir::LogicalResult emitCXXTryStmt (const clang::CXXTryStmt &s)
void emitCtorPrologue (const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, FunctionArgList &args)
 This routine generates necessary code to initialize base classes and non-static data members belonging to this constructor.
void emitDelegatingCXXConstructorCall (const CXXConstructorDecl *ctor, const FunctionArgList &args)
void emitDeleteCall (const FunctionDecl *deleteFD, mlir::Value ptr, QualType deleteTy)
mlir::LogicalResult emitDoStmt (const clang::DoStmt &s)
mlir::Value emitDynamicCast (Address thisAddr, const CXXDynamicCastExpr *dce)
void emitExprAsInit (const clang::Expr *init, const clang::ValueDecl *d, LValue lvalue, bool capturedByInit=false)
 Emit an expression as an initializer for an object (variable, field, etc.) at the given location.
mlir::LogicalResult emitFunctionBody (const clang::Stmt *body)
mlir::LogicalResult emitGotoStmt (const clang::GotoStmt &s)
void emitImplicitAssignmentOperatorBody (FunctionArgList &args)
void emitInitializerForField (clang::FieldDecl *field, LValue lhs, clang::Expr *init)
LValue emitPredefinedLValue (const PredefinedExpr *e)
mlir::Value emitPromotedComplexExpr (const Expr *e, QualType promotionType)
mlir::Value emitPromotedScalarExpr (const Expr *e, QualType promotionType)
mlir::Value emitPromotedValue (mlir::Value result, QualType promotionType)
void emitReturnOfRValue (mlir::Location loc, RValue rv, QualType ty)
mlir::Value emitScalarExpr (const clang::Expr *e)
 Emit the computation of the specified expression of scalar type.
mlir::Value emitScalarPrePostIncDec (const UnaryOperator *e, LValue lv, cir::UnaryOpKind kind, bool isPre)
void emitStopPoint (const Stmt *s)
 Build a debug stoppoint if we are emitting debug info.
mlir::LogicalResult emitStmt (const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitSimpleStmt (const clang::Stmt *s, bool useCurrentScope)
mlir::LogicalResult emitForStmt (const clang::ForStmt &s)
void emitForwardingCallToLambda (const CXXMethodDecl *lambdaCallOperator, CallArgList &callArgs)
mlir::Value emitComplexExpr (const Expr *e)
 Emit the computation of the specified expression of complex type, returning the result.
void emitComplexExprIntoLValue (const Expr *e, LValue dest, bool isInit)
mlir::Value emitComplexPrePostIncDec (const UnaryOperator *e, LValue lv, cir::UnaryOpKind op, bool isPre)
LValue emitComplexAssignmentLValue (const BinaryOperator *e)
LValue emitComplexCompoundAssignmentLValue (const CompoundAssignOperator *e)
LValue emitScalarCompoundAssignWithComplex (const CompoundAssignOperator *e, mlir::Value &result)
mlir::LogicalResult emitCompoundStmt (const clang::CompoundStmt &s, Address *lastValue=nullptr, AggValueSlot slot=AggValueSlot::ignored())
mlir::LogicalResult emitCompoundStmtWithoutScope (const clang::CompoundStmt &s, Address *lastValue=nullptr, AggValueSlot slot=AggValueSlot::ignored())
void emitDecl (const clang::Decl &d, bool evaluateConditionDecl=false)
mlir::LogicalResult emitDeclStmt (const clang::DeclStmt &s)
LValue emitDeclRefLValue (const clang::DeclRefExpr *e)
mlir::LogicalResult emitDefaultStmt (const clang::DefaultStmt &s, mlir::Type condType, bool buildingTopLevelCase)
void emitDelegateCXXConstructorCall (const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, const FunctionArgList &args, clang::SourceLocation loc)
void emitDelegateCallArg (CallArgList &args, const clang::VarDecl *param, clang::SourceLocation loc)
 We are performing a delegate call; that is, the current function is delegating to another one.
mlir::LogicalResult emitIfOnBoolExpr (const clang::Expr *cond, const clang::Stmt *thenS, const clang::Stmt *elseS)
 Emit an if on a boolean condition to the specified blocks.
cir::IfOp emitIfOnBoolExpr (const clang::Expr *cond, BuilderCallbackRef thenBuilder, mlir::Location thenLoc, BuilderCallbackRef elseBuilder, std::optional< mlir::Location > elseLoc={})
 Emit an if on a boolean condition, filling then and else into appropriated regions.
mlir::Value emitOpOnBoolExpr (mlir::Location loc, const clang::Expr *cond)
 TODO(cir): see EmitBranchOnBoolExpr for extra ideas).
mlir::LogicalResult emitLabel (const clang::LabelDecl &d)
mlir::LogicalResult emitLabelStmt (const clang::LabelStmt &s)
void emitLambdaDelegatingInvokeBody (const CXXMethodDecl *md)
void emitLambdaStaticInvokeBody (const CXXMethodDecl *md)
mlir::LogicalResult emitIfStmt (const clang::IfStmt &s)
void emitIgnoredExpr (const clang::Expr *e)
 Emit code to compute the specified expression, ignoring the result.
RValue emitLoadOfBitfieldLValue (LValue lv, SourceLocation loc)
mlir::Value emitLoadOfComplex (LValue src, SourceLocation loc)
 Load a complex number from the specified l-value.
RValue emitLoadOfLValue (LValue lv, SourceLocation loc)
 Given an expression that represents a value lvalue, this method emits the address of the lvalue, then loads the result as an rvalue, returning the rvalue.
Address emitLoadOfReference (LValue refLVal, mlir::Location loc, LValueBaseInfo *pointeeBaseInfo)
LValue emitLoadOfReferenceLValue (Address refAddr, mlir::Location loc, QualType refTy, AlignmentSource source)
mlir::Value emitLoadOfScalar (LValue lvalue, SourceLocation loc)
 EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the memory representation to the LLVM value representation.
mlir::Value emitLoadOfScalar (Address addr, bool isVolatile, QualType ty, SourceLocation loc, LValueBaseInfo baseInfo)
LValue emitLValue (const clang::Expr *e)
 Emit code to compute a designator that specifies the location of the expression.
LValue emitLValueForBitField (LValue base, const FieldDecl *field)
LValue emitLValueForField (LValue base, const clang::FieldDecl *field)
LValue emitLValueForLambdaField (const FieldDecl *field)
LValue emitLValueForLambdaField (const FieldDecl *field, mlir::Value thisValue)
 Given that we are currently emitting a lambda, emit an l-value for one of its members.
LValue emitLValueForFieldInitialization (LValue base, const clang::FieldDecl *field, llvm::StringRef fieldName)
 Like emitLValueForField, excpet that if the Field is a reference, this will return the address of the reference and not the address of the value stored in the reference.
LValue emitMaterializeTemporaryExpr (const MaterializeTemporaryExpr *e)
LValue emitMemberExpr (const MemberExpr *e)
Address emitPointerWithAlignment (const clang::Expr *expr, LValueBaseInfo *baseInfo=nullptr)
 Given an expression with a pointer type, emit the value and compute our best estimate of the alignment of the pointee.
RValue emitReferenceBindingToExpr (const Expr *e)
 Emits a reference binding to the passed in expression.
mlir::LogicalResult emitReturnStmt (const clang::ReturnStmt &s)
RValue emitRotate (const CallExpr *e, bool isRotateLeft)
mlir::Value emitScalarConstant (const ConstantEmission &constant, Expr *e)
mlir::Value emitScalarConversion (mlir::Value src, clang::QualType srcType, clang::QualType dstType, clang::SourceLocation loc)
 Emit a conversion from the specified type to the specified destination type, both of which are CIR scalar types.
void emitScalarInit (const clang::Expr *init, mlir::Location loc, LValue lvalue, bool capturedByInit=false)
void emitStaticVarDecl (const VarDecl &d, cir::GlobalLinkageKind linkage)
void emitStoreOfComplex (mlir::Location loc, mlir::Value v, LValue dest, bool isInit)
 EmitStoreOfComplex - Store a complex number into the specified l-value.
void emitStoreOfScalar (mlir::Value value, Address addr, bool isVolatile, clang::QualType ty, bool isInit=false, bool isNontemporal=false)
void emitStoreOfScalar (mlir::Value value, LValue lvalue, bool isInit)
void emitStoreThroughLValue (RValue src, LValue dst, bool isInit=false)
 Store the specified rvalue into the specified lvalue, where both are guaranteed to the have the same type, and that type is 'Ty'.
mlir::Value emitStoreThroughBitfieldLValue (RValue src, LValue dstresult)
LValue emitStringLiteralLValue (const StringLiteral *e, llvm::StringRef name=".str")
mlir::LogicalResult emitSwitchBody (const clang::Stmt *s)
mlir::LogicalResult emitSwitchCase (const clang::SwitchCase &s, bool buildingTopLevelCase)
mlir::LogicalResult emitSwitchStmt (const clang::SwitchStmt &s)
mlir::Value emitToMemory (mlir::Value value, clang::QualType ty)
 Given a value and its clang type, returns the value casted to its memory representation.
void emitTrap (mlir::Location loc, bool createNewBlock)
 Emit a trap instruction, which is used to abort the program in an abnormal way, usually for debugging purposes.
LValue emitUnaryOpLValue (const clang::UnaryOperator *e)
mlir::Value emitUnPromotedValue (mlir::Value result, QualType unPromotionType)
void emitUnreachable (clang::SourceLocation loc, bool createNewBlock)
 Emit a reached-unreachable diagnostic if loc is valid and runtime checking is enabled.
void emitVarDecl (const clang::VarDecl &d)
 This method handles emission of any variable declaration inside a function, including static vars etc.
void emitVariablyModifiedType (QualType ty)
mlir::LogicalResult emitWhileStmt (const clang::WhileStmt &s)
void emitNullabilityCheck (LValue lhs, mlir::Value rhs, clang::SourceLocation loc)
 Given an assignment *lhs = rhs, emit a test that checks if rhs is nonnull, if 1LHS is marked _Nonnull.
bool isInConditionalBranch () const
void setBeforeOutermostConditional (mlir::Value value, Address addr)
template<typename FuncTy>
ConditionalInfo emitConditionalBlocks (const AbstractConditionalOperator *e, const FuncTy &branchGenFunc)
mlir::Value emitTernaryOnBoolExpr (const clang::Expr *cond, mlir::Location loc, const clang::Stmt *thenS, const clang::Stmt *elseS)
Address emitVAListRef (const Expr *e)
 Build a "reference" to a va_list; this is either the address or the value of the expression, depending on how va_list is defined.
void emitVAStart (mlir::Value vaList, mlir::Value count)
 Emits the start of a CIR variable-argument operation (cir.va_start)
void emitVAEnd (mlir::Value vaList)
 Emits the end of a CIR variable-argument operation (cir.va_start)
mlir::Value emitVAArg (VAArgExpr *ve)
 Generate code to get an argument from the passed in pointer and update it accordingly.
cir::AllocaOp createTempAlloca (mlir::Type ty, mlir::Location loc, const Twine &name="tmp", mlir::Value arraySize=nullptr, bool insertIntoFnEntryBlock=false)
 This creates an alloca and inserts it into the entry block if ArraySize is nullptr, otherwise inserts it at the current insertion point of the builder.
cir::AllocaOp createTempAlloca (mlir::Type ty, mlir::Location loc, const Twine &name="tmp", mlir::OpBuilder::InsertPoint ip={}, mlir::Value arraySize=nullptr)
 This creates an alloca and inserts it into the provided insertion point.
Address createTempAlloca (mlir::Type ty, CharUnits align, mlir::Location loc, const Twine &name="tmp", mlir::Value arraySize=nullptr, Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
 This creates a alloca and inserts it into the entry block.
Address createTempAllocaWithoutCast (mlir::Type ty, CharUnits align, mlir::Location loc, const Twine &name="tmp", mlir::Value arraySize=nullptr, mlir::OpBuilder::InsertPoint ip={})
 This creates a alloca and inserts it into the entry block of the current region.
Address createMemTemp (QualType t, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
 Create a temporary memory object of the given type, with appropriate alignmen and cast it to the default address space.
Address createMemTemp (QualType t, CharUnits align, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
OpenACCDataOperandInfo getOpenACCDataOperandInfo (const Expr *e)
mlir::Value emitOpenACCIntExpr (const Expr *intExpr)
mlir::Value createOpenACCConstantInt (mlir::Location loc, unsigned width, int64_t value)
mlir::LogicalResult emitOpenACCComputeConstruct (const OpenACCComputeConstruct &s)
mlir::LogicalResult emitOpenACCLoopConstruct (const OpenACCLoopConstruct &s)
mlir::LogicalResult emitOpenACCCombinedConstruct (const OpenACCCombinedConstruct &s)
mlir::LogicalResult emitOpenACCDataConstruct (const OpenACCDataConstruct &s)
mlir::LogicalResult emitOpenACCEnterDataConstruct (const OpenACCEnterDataConstruct &s)
mlir::LogicalResult emitOpenACCExitDataConstruct (const OpenACCExitDataConstruct &s)
mlir::LogicalResult emitOpenACCHostDataConstruct (const OpenACCHostDataConstruct &s)
mlir::LogicalResult emitOpenACCWaitConstruct (const OpenACCWaitConstruct &s)
mlir::LogicalResult emitOpenACCInitConstruct (const OpenACCInitConstruct &s)
mlir::LogicalResult emitOpenACCShutdownConstruct (const OpenACCShutdownConstruct &s)
mlir::LogicalResult emitOpenACCSetConstruct (const OpenACCSetConstruct &s)
mlir::LogicalResult emitOpenACCUpdateConstruct (const OpenACCUpdateConstruct &s)
mlir::LogicalResult emitOpenACCAtomicConstruct (const OpenACCAtomicConstruct &s)
mlir::LogicalResult emitOpenACCCacheConstruct (const OpenACCCacheConstruct &s)
void emitOpenACCDeclare (const OpenACCDeclareDecl &d)
void emitOpenACCRoutine (const OpenACCRoutineDecl &d)
AggValueSlot createAggTemp (QualType ty, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr)
 Create a temporary memory object for the given aggregate type.
template<typename T>
mlir::LogicalResult emitCaseDefaultCascade (const T *stmt, mlir::Type condType, mlir::ArrayAttr value, CaseOpKind kind, bool buildingTopLevelCase)
Public Member Functions inherited from clang::CIRGen::CIRGenTypeCache
 CIRGenTypeCache ()
clang::CharUnits getSizeAlign () const
clang::CharUnits getPointerAlign () const
cir::TargetAddressSpaceAttr getCIRAllocaAddressSpace () const

Static Public Member Functions

static cir::TypeEvaluationKind getEvaluationKind (clang::QualType type)
 Return the cir::TypeEvaluationKind of QualType type.
static bool hasScalarEvaluationKind (clang::QualType type)
static bool hasAggregateEvaluationKind (clang::QualType type)
static bool isConstructorDelegationValid (const clang::CXXConstructorDecl *ctor)
 Checks whether the given constructor is a valid subject for the complete-to-base constructor delegation optimization, i.e.

Public Attributes

CIRGenModulecgm
clang::GlobalDecl curGD
 The GlobalDecl for the current function being compiled or the global variable currently being initialized.
std::optional< mlir::Value > fnRetAlloca
 The compiler-generated variable that holds the return value.
CGCoroInfo curCoro
Address returnValue = Address::invalid()
 The temporary alloca to hold the return value.
EHScopeStack ehStack
 Tracks function scope overall cleanup handling.
llvm::DenseMap< const clang::ValueDecl *, clang::FieldDecl * > lambdaCaptureFields
clang::FieldDecllambdaThisCaptureField = nullptr
ImplicitParamDeclcxxabiThisDecl = nullptr
 CXXThisDecl - When generating code for a C++ member function, this will hold the implicit 'this' declaration.
mlir::Value cxxabiThisValue = nullptr
mlir::Value cxxThisValue = nullptr
clang::CharUnits cxxThisAlignment
ImplicitParamDeclcxxStructorImplicitParamDecl {}
 When generating code for a constructor or destructor, this will hold the implicit argument (e.g.
mlir::Value cxxStructorImplicitParamValue {}
Address cxxDefaultInitExprThis = Address::invalid()
 The value of 'this' to sue when evaluating CXXDefaultInitExprs within this expression.
const clang::DeclcurFuncDecl = nullptr
const clang::DeclcurCodeDecl = nullptr
 This is the inner-most code context, which includes blocks.
mlir::Operation * curFn = nullptr
 The current function or global initializer that is generated code for.
DeclMapTy localDeclMap
 This keeps track of the CIR allocas or globals for local C declarations.
llvm::SmallVector< mlir::Type, 2 > condTypeStack
 The type of the condition for the emitting switch statement.
clang::SanitizerSet sanOpts
 Sanitizers enabled for this function.
SymTableTy symbolTable
bool didCallStackSave = false
 Whether a cir.stacksave operation has been added.
bool sawAsmBlock = false
 Whether or not a Microsoft-style asm block has been processed within this fuction.
llvm::DenseMap< const OpaqueValueExpr *, LValueopaqueLValues
 Keeps track of the current set of opaque value expressions.
llvm::DenseMap< const OpaqueValueExpr *, RValueopaqueRValues
llvm::DenseMap< const Expr *, mlir::Value > vlaSizeMap
std::optional< mlir::Location > currSrcLoc
 Use to track source locations across nested visitor traversals.
unsigned counterRefTmp = 0
 Hold counters for incrementally naming temporaries.
unsigned counterAggTmp = 0
clang::CurrentSourceLocExprScope curSourceLocExprScope
 Source location information about the default argument or member initializer expression we're evaluating, if any.
EHScopeStack::stable_iterator prologueCleanupDepth
 The cleanup depth enclosing all the cleanups associated with the parameters.
EHScopeStack::stable_iterator currentCleanupStackDepth = ehStack.stable_end()
LexicalScopecurLexScope = nullptr
ConditionalEvaluationoutermostConditional = nullptr
Public Attributes inherited from clang::CIRGen::CIRGenTypeCache
cir::VoidType VoidTy
cir::IntType SInt8Ty
cir::IntType SInt16Ty
cir::IntType SInt32Ty
cir::IntType SInt64Ty
cir::IntType SInt128Ty
cir::IntType UInt8Ty
cir::IntType UInt16Ty
cir::IntType UInt32Ty
cir::IntType UInt64Ty
cir::IntType UInt128Ty
cir::FP16Type FP16Ty
cir::BF16Type BFloat16Ty
cir::SingleType FloatTy
cir::DoubleType DoubleTy
cir::FP80Type FP80Ty
cir::FP128Type FP128Ty
mlir::Type UCharTy
 ClangIR char.
union { 
   mlir::Type   UIntPtrTy 
   mlir::Type   SizeTy 
}; 
 intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
mlir::Type PtrDiffTy
cir::PointerType VoidPtrTy
 void* in address space 0
cir::PointerType UInt8PtrTy
cir::PointerType AllocaInt8PtrTy
 void* in alloca address space
union { 
   unsigned char   PointerAlignInBytes 
   unsigned char   PointerSizeInBytes 
}; 
 The size and alignment of a pointer into the generic address space.
unsigned char SizeAlignInBytes
 The alignment of size_t.
cir::TargetAddressSpaceAttr cirAllocaAddressSpace

Static Public Attributes

static Destroyer destroyCXXObject

Friends

class ::ScalarExprEmitter

Detailed Description

Definition at line 52 of file CIRGenFunction.h.

Member Typedef Documentation

◆ DeclMapTy

Definition at line 120 of file CIRGenFunction.h.

◆ Destroyer

typedef void clang::CIRGen::CIRGenFunction::Destroyer(CIRGenFunction &cgf, Address addr, QualType ty)

Definition at line 1076 of file CIRGenFunction.h.

◆ SourceLocExprScopeGuard

◆ SymTableScopeTy

Initial value:
llvm::ScopedHashTableScope<const clang::Decl *, mlir::Value>

Definition at line 386 of file CIRGenFunction.h.

◆ SymTableTy

using clang::CIRGen::CIRGenFunction::SymTableTy = llvm::ScopedHashTable<const clang::Decl *, mlir::Value>

The symbol table maps a variable name to a value in the current scope.

Entering a function creates a new scope, and the function arguments are added to the mapping. When the processing of a function is terminated, the scope is destroyed and the mappings created in this scope are dropped.

Definition at line 149 of file CIRGenFunction.h.

◆ VisitedVirtualBasesSetTy

◆ VPtrsVector

Constructor & Destructor Documentation

◆ CIRGenFunction()

clang::CIRGen::CIRGenFunction::CIRGenFunction ( CIRGenModule & cgm,
CIRGenBuilderTy & builder,
bool suppressNewContext = false )

Definition at line 27 of file CIRGenFunction.cpp.

References cgm, clang::CIRGen::CIRGenTypeCache::CIRGenTypeCache(), and ehStack.

Referenced by clang::CIRGen::CIRGenFunction::OpaqueValueMappingData::bind(), clang::CIRGen::CIRGenFunction::OpaqueValueMappingData::bind(), clang::CIRGen::CIRGenFunction::OpaqueValueMappingData::bind(), clang::CIRGen::CIRGenFunction::ConditionalEvaluation::ConditionalEvaluation(), clang::CIRGen::CIRGenFunction::ConditionalEvaluation::ConditionalEvaluation(), clang::CIRGen::CIRGenFunction::CXXDefaultInitExprScope::CXXDefaultInitExprScope(), clang::CIRGen::CIRGenFunction::DeclMapRevertingRAII::DeclMapRevertingRAII(), clang::CIRGen::CIRGenFunction::FieldConstructionScope::FieldConstructionScope(), clang::CIRGen::CIRGenFunction::AutoVarEmission::getObjectAddress(), clang::CIRGen::CIRGenFunction::LexicalScope::getOrCreateRetBlock(), clang::CIRGen::CIRGenFunction::ConstantEmission::getReferenceLValue(), clang::CIRGen::CIRGenFunction::LexicalScope::LexicalScope(), clang::CIRGen::CIRGenFunction::OpaqueValueMapping::OpaqueValueMapping(), clang::CIRGen::CIRGenFunction::OpaqueValueMapping::OpaqueValueMapping(), clang::CIRGen::CIRGenFunction::OpaqueValueMapping::OpaqueValueMapping(), clang::CIRGen::CIRGenFunction::OpaqueValueMapping::OpaqueValueMapping(), clang::CIRGen::CIRGenFunction::RunCleanupsScope::RunCleanupsScope(), clang::CIRGen::CIRGenFunction::SourceLocRAIIObject::SourceLocRAIIObject(), clang::CIRGen::CIRGenFunction::StmtExprEvaluation::StmtExprEvaluation(), and clang::CIRGen::CIRGenFunction::OpaqueValueMappingData::unbind().

◆ ~CIRGenFunction()

clang::CIRGen::CIRGenFunction::~CIRGenFunction ( )

Definition at line 33 of file CIRGenFunction.cpp.

Member Function Documentation

◆ addInitializerToStaticVarDecl()

cir::GlobalOp CIRGenFunction::addInitializerToStaticVarDecl ( const VarDecl & d,
cir::GlobalOp gv,
cir::GetGlobalOp gvAddr )

Add the initializer for 'd' to the global variable that has already been created for it.

If the initializer has a different type than gv does, this may free gv and return a different one. Otherwise it just returns gv.

Definition at line 413 of file CIRGenDecl.cpp.

References cir::MissingFeatures::addressSpace(), cgm, cir::MissingFeatures::dataLayoutTypeAllocSize(), clang::QualType::DK_cxx_destructor, clang::CIRGen::ConstantEmitter::finalize(), getContext(), clang::VarDecl::getSourceRange(), clang::VarDecl::needsDestruction(), cir::MissingFeatures::opGlobalConstant(), and clang::CIRGen::ConstantEmitter::tryEmitForInitializer().

Referenced by emitStaticVarDecl().

◆ buildFunctionArgList()

clang::QualType clang::CIRGen::CIRGenFunction::buildFunctionArgList ( clang::GlobalDecl gd,
FunctionArgList & args )

Definition at line 786 of file CIRGenFunction.cpp.

References clang::cast(), cgm, clang::GlobalDecl::getDecl(), and clang::isa().

Referenced by generateCode().

◆ constantFoldsToBool()

bool clang::CIRGen::CIRGenFunction::constantFoldsToBool ( const clang::Expr * cond,
bool & resultBool,
bool allowLabels = false )

If the specified expression does not fold to a constant, or if it does but contains a label, return false.

If it constant folds return true and set the boolean result in Result.

Definition at line 176 of file CIRGenFunction.cpp.

References constantFoldsToSimpleInteger().

Referenced by emitIfStmt().

◆ constantFoldsToSimpleInteger()

bool clang::CIRGen::CIRGenFunction::constantFoldsToSimpleInteger ( const clang::Expr * cond,
llvm::APSInt & resultInt,
bool allowLabels = false )

If the specified expression does not fold to a constant, or if it does fold but contains a label, return false.

If it constant folds, return true and set the folded value.

Definition at line 189 of file CIRGenFunction.cpp.

References containsLabel(), clang::Expr::EvaluateAsInt(), getContext(), clang::APValue::getInt(), and clang::Expr::EvalResult::Val.

Referenced by constantFoldsToBool().

◆ containsLabel()

bool clang::CIRGen::CIRGenFunction::containsLabel ( const clang::Stmt * s,
bool ignoreCaseStmts = false )

Return true if the statement contains a label in it.

If this statement is not executed normally, it not containing a label means that we can just remove the code.

Definition at line 141 of file CIRGenFunction.cpp.

References clang::isa(), and s.

Referenced by constantFoldsToSimpleInteger().

◆ convertTempToRValue()

RValue CIRGenFunction::convertTempToRValue ( Address addr,
clang::QualType type,
clang::SourceLocation loc )

◆ convertType() [1/2]

◆ convertType() [2/2]

mlir::Type clang::CIRGen::CIRGenFunction::convertType ( const TypeDecl * t)
inline

Definition at line 163 of file CIRGenFunction.h.

References convertType(), and getContext().

◆ convertTypeForMem()

◆ createAggTemp()

AggValueSlot clang::CIRGen::CIRGenFunction::createAggTemp ( QualType ty,
mlir::Location loc,
const Twine & name = "tmp",
Address * alloca = nullptr )
inline

◆ createDummyValue()

mlir::Value CIRGenFunction::createDummyValue ( mlir::Location loc,
clang::QualType qt )

◆ createMemTemp() [1/2]

Address CIRGenFunction::createMemTemp ( QualType t,
CharUnits align,
mlir::Location loc,
const Twine & name = "tmp",
Address * alloca = nullptr,
mlir::OpBuilder::InsertPoint ip = {} )

◆ createMemTemp() [2/2]

Address CIRGenFunction::createMemTemp ( QualType t,
mlir::Location loc,
const Twine & name = "tmp",
Address * alloca = nullptr,
mlir::OpBuilder::InsertPoint ip = {} )

Create a temporary memory object of the given type, with appropriate alignmen and cast it to the default address space.

Returns the original alloca instruction by Alloca if it is not nullptr.

Definition at line 2243 of file CIRGenExpr.cpp.

References createMemTemp(), and getContext().

Referenced by createAggTemp(), createMemTemp(), createReferenceTemporary(), emitAggExprToLValue(), emitAtomicExpr(), emitCall(), emitCompoundLiteralLValue(), emitLambdaDelegatingInvokeBody(), and emitValToTemp().

◆ createOpenACCConstantInt()

mlir::Value CIRGenFunction::createOpenACCConstantInt ( mlir::Location loc,
unsigned width,
int64_t value )

Definition at line 56 of file CIRGenOpenACC.cpp.

References getMLIRContext().

Referenced by getOpenACCDataOperandInfo().

◆ createTempAlloca() [1/3]

Address CIRGenFunction::createTempAlloca ( mlir::Type ty,
CharUnits align,
mlir::Location loc,
const Twine & name = "tmp",
mlir::Value arraySize = nullptr,
Address * allocaAddr = nullptr,
mlir::OpBuilder::InsertPoint ip = {} )

This creates a alloca and inserts it into the entry block.

The alloca is casted to default address space if necessary.

Definition at line 2278 of file CIRGenExpr.cpp.

References cir::MissingFeatures::addressSpace(), createTempAllocaWithoutCast(), and clang::CIRGen::Address::getPointer().

◆ createTempAlloca() [2/3]

cir::AllocaOp CIRGenFunction::createTempAlloca ( mlir::Type ty,
mlir::Location loc,
const Twine & name = "tmp",
mlir::OpBuilder::InsertPoint ip = {},
mlir::Value arraySize = nullptr )

This creates an alloca and inserts it into the provided insertion point.

Definition at line 2310 of file CIRGenExpr.cpp.

References emitAlloca().

◆ createTempAlloca() [3/3]

cir::AllocaOp CIRGenFunction::createTempAlloca ( mlir::Type ty,
mlir::Location loc,
const Twine & name = "tmp",
mlir::Value arraySize = nullptr,
bool insertIntoFnEntryBlock = false )

This creates an alloca and inserts it into the entry block if ArraySize is nullptr, otherwise inserts it at the current insertion point of the builder.


CIR build helpers

Definition at line 2299 of file CIRGenExpr.cpp.

References emitAlloca().

Referenced by createMemTemp(), createTempAllocaWithoutCast(), and emitAutoVarAlloca().

◆ createTempAllocaWithoutCast()

Address CIRGenFunction::createTempAllocaWithoutCast ( mlir::Type ty,
CharUnits align,
mlir::Location loc,
const Twine & name = "tmp",
mlir::Value arraySize = nullptr,
mlir::OpBuilder::InsertPoint ip = {} )

This creates a alloca and inserts it into the entry block of the current region.

Definition at line 2266 of file CIRGenExpr.cpp.

References cgm, and createTempAlloca().

Referenced by createTempAlloca().

◆ emitAddrOfFieldStorage()

◆ emitAggExpr()

◆ emitAggExprToLValue()

◆ emitAggregateCopy()

void CIRGenFunction::emitAggregateCopy ( LValue dest,
LValue src,
QualType eltTy,
AggValueSlot::Overlap_t mayOverlap )

Emit an aggregate copy.

Parameters
isVolatiletrue iff either the source or the destination is volatile.
MayOverlapWhether the tail padding of the destination might be occupied by some other object. More efficient code can often be generated if not.

Definition at line 790 of file CIRGenExprAggregate.cpp.

References cir::MissingFeatures::aggValueSlotVolatile(), cgm, clang::CPlusPlus, cir::MissingFeatures::cudaSupport(), clang::CIRGen::LValue::getAddress(), clang::Type::getAsCXXRecordDecl(), getContext(), getLangOpts(), clang::CIRGen::Address::getPointer(), clang::Type::isAnyComplexType(), clang::LangOptionsBase::NonGC, and cir::MissingFeatures::opTBAA().

Referenced by emitReturnOfRValue().

◆ emitAggregateStore()

void CIRGenFunction::emitAggregateStore ( mlir::Value value,
Address dest )

Definition at line 83 of file CIRGenCall.cpp.

References currSrcLoc.

Referenced by emitCall().

◆ emitAlignmentAssumption() [1/2]

mlir::Value clang::CIRGen::CIRGenFunction::emitAlignmentAssumption ( mlir::Value ptrValue,
const Expr * expr,
SourceLocation assumptionLoc,
int64_t alignment,
mlir::Value offsetValue = nullptr )

Definition at line 1002 of file CIRGenFunction.cpp.

References emitAlignmentAssumption(), and clang::ast_matchers::expr.

◆ emitAlignmentAssumption() [2/2]

mlir::Value clang::CIRGen::CIRGenFunction::emitAlignmentAssumption ( mlir::Value ptrValue,
QualType ty,
SourceLocation loc,
SourceLocation assumptionLoc,
int64_t alignment,
mlir::Value offsetValue = nullptr )

CIR emit functions

Definition at line 994 of file CIRGenFunction.cpp.

References getLoc(), and cir::MissingFeatures::sanitizers().

Referenced by emitAlignmentAssumption(), and emitBuiltinExpr().

◆ emitAlloca() [1/2]

mlir::Value clang::CIRGen::CIRGenFunction::emitAlloca ( llvm::StringRef name,
mlir::Type ty,
mlir::Location loc,
clang::CharUnits alignment,
bool insertIntoFnEntryBlock,
mlir::Value arraySize = nullptr )

◆ emitAlloca() [2/2]

mlir::Value clang::CIRGen::CIRGenFunction::emitAlloca ( llvm::StringRef name,
mlir::Type ty,
mlir::Location loc,
clang::CharUnits alignment,
mlir::OpBuilder::InsertPoint ip,
mlir::Value arraySize = nullptr )

◆ emitAnyExpr()

RValue CIRGenFunction::emitAnyExpr ( const clang::Expr * e,
AggValueSlot aggSlot = AggValueSlot::ignored() )

Emit code to compute the specified expression which can have any type.

The result is returned as an RValue struct. If this is an aggregate expression, the aggloc/agglocvolatile arguments indicate where the result should be returned.

The result is returned as an RValue struct.

Definition at line 1629 of file CIRGenExpr.cpp.

References clang::CIRGen::AggValueSlot::asRValue(), createAggTemp(), emitAggExpr(), emitComplexExpr(), emitScalarExpr(), clang::CIRGen::RValue::get(), clang::CIRGen::RValue::getComplex(), getCounterAggTmpAsString(), getEvaluationKind(), getLoc(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::CIRGen::AggValueSlot::isIgnored(), cir::TEK_Aggregate, cir::TEK_Complex, and cir::TEK_Scalar.

Referenced by clang::CIRGen::CIRGenFunction::OpaqueValueMappingData::bind(), emitAnyExprToTemp(), emitBinaryOperatorLValue(), emitIgnoredExpr(), emitReturnStmt(), and getOrCreateOpaqueRValueMapping().

◆ emitAnyExprToExn()

◆ emitAnyExprToMem()

void CIRGenFunction::emitAnyExprToMem ( const Expr * e,
Address location,
Qualifiers quals,
bool isInitializer )

◆ emitAnyExprToTemp()

RValue CIRGenFunction::emitAnyExprToTemp ( const clang::Expr * e)

Similarly to emitAnyExpr(), however, the result will always be accessible even if no aggregate location is provided.

Similar to emitAnyExpr(), however, the result will always be accessible even if no aggregate location is provided.

Definition at line 739 of file CIRGenCall.cpp.

References createAggTemp(), emitAnyExpr(), getCounterAggTmpAsString(), getLoc(), clang::Stmt::getSourceRange(), clang::Expr::getType(), hasAggregateEvaluationKind(), and clang::CIRGen::AggValueSlot::ignored().

Referenced by emitCallArg().

◆ emitArrayDestroy()

void CIRGenFunction::emitArrayDestroy ( mlir::Value begin,
mlir::Value numElements,
QualType elementType,
CharUnits elementAlign,
Destroyer * destroyer )

Destroys all the elements of the given array, beginning from last to first.

The array cannot be zero-length.

Parameters
begin- a type* denoting the first element of the array
numElements- the number of elements in the array
elementType- the element type of the array
destroyer- the function to call to destroy elements

Definition at line 755 of file CIRGenDecl.cpp.

References b, cgm, convertTypeForMem(), currSrcLoc, cir::MissingFeatures::dtorCleanups(), and clang::Type::isArrayType().

Referenced by emitDestroy().

◆ emitArrayLength()

mlir::Value clang::CIRGen::CIRGenFunction::emitArrayLength ( const clang::ArrayType * arrayType,
QualType & baseType,
Address & addr )

Computes the length of an array in elements, as well as the base element type and a properly-typed first element pointer.

Definition at line 953 of file CIRGenFunction.cpp.

References clang::ast_matchers::arrayType, cgm, currSrcLoc, clang::ASTContext::getAsArrayType(), getContext(), clang::CIRGen::Address::getElementType(), clang::isa(), clang::CIRGen::CIRGenTypeCache::SizeTy, and cir::MissingFeatures::vlas().

Referenced by emitCXXAggrConstructorCall(), and emitDestroy().

◆ emitArraySubscriptExpr()

◆ emitArrayToPointerDecay()

◆ emitAsmStmt()

◆ emitAtomicExpr()

◆ emitAtomicInit()

◆ emitAutoVarAlloca()

◆ emitAutoVarCleanups()

◆ emitAutoVarDecl()

void CIRGenFunction::emitAutoVarDecl ( const clang::VarDecl & d)

Emit code and set up symbol table for a variable declaration with auto, register, or no storage class specifier.

These turn into simple stack objects, globals depending on target.

Definition at line 260 of file CIRGenDecl.cpp.

References emitAutoVarAlloca(), emitAutoVarCleanups(), and emitAutoVarInit().

Referenced by emitVarDecl().

◆ emitAutoVarInit()

void CIRGenFunction::emitAutoVarInit ( const AutoVarEmission & emission)

◆ emitAutoVarTypeCleanup()

◆ emitBaseInitializer()

◆ emitBinaryOperatorLValue()

◆ emitBreakStmt()

mlir::LogicalResult CIRGenFunction::emitBreakStmt ( const clang::BreakStmt & s)

Definition at line 558 of file CIRGenStmt.cpp.

References getLoc(), and s.

Referenced by emitSimpleStmt().

◆ emitBuiltinExpr()

RValue CIRGenFunction::emitBuiltinExpr ( const clang::GlobalDecl & gd,
unsigned builtinID,
const clang::CallExpr * e,
ReturnValueSlot returnValue )

Definition at line 96 of file CIRGenBuiltin.cpp.

References cir::MissingFeatures::addressSpace(), cir::MissingFeatures::builtinCall(), cir::MissingFeatures::builtinCallF128(), cir::MissingFeatures::builtinCallMathErrno(), cir::MissingFeatures::builtinCheckKind(), cgm, conj, convertType(), cir::MissingFeatures::coroSizeBuiltinCall(), cir::MissingFeatures::coroutineFrame(), emitAlignmentAssumption(), emitBuiltinBitOp(), emitCheckedArgForAssume(), emitComplexExpr(), emitLibraryCall(), emitRotate(), emitScalarExpr(), emitTrap(), emitUnaryFPBuiltin(), emitUnaryMaybeConstrainedFPBuiltin(), emitUnreachable(), emitVAEnd(), emitVAListRef(), emitVAStart(), clang::Expr::EvaluateAsFloat(), clang::Expr::EvaluateAsRValue(), clang::Expr::EvaluateKnownConstInt(), cir::MissingFeatures::fastMathFlags(), clang::CIRGen::RValue::get(), clang::CallExpr::getArg(), clang::Decl::getAsFunction(), clang::CIRGen::RValue::getComplex(), getContext(), clang::GlobalDecl::getDecl(), clang::Expr::getExprLoc(), clang::APValue::getFloat(), clang::APValue::getInt(), clang::Expr::getIntegerConstantExpr(), getLangOpts(), getLoc(), getMLIRContext(), clang::CallExpr::getNumArgs(), clang::CIRGen::Address::getPointer(), clang::Stmt::getSourceRange(), clang::TargetInfo::getSuitableAlign(), clang::ASTContext::getTargetInfo(), clang::Expr::getType(), getUndefRValue(), clang::Decl::hasAttr(), clang::Expr::HasSideEffects(), clang::Expr::EvalStatus::hasSideEffects(), clang::APValue::isFloat(), clang::APValue::isInt(), clang::Expr::isPRValue(), clang::LangOptionsBase::Pattern, returnValue, clang::ASTContext::toCharUnitsFromBits(), clang::ast_matchers::type, clang::LangOptionsBase::Uninitialized, clang::Expr::EvalResult::Val, and clang::LangOptionsBase::Zero.

Referenced by emitCallExpr().

◆ emitCall() [1/3]

◆ emitCall() [2/3]

RValue CIRGenFunction::emitCall ( const CIRGenFunctionInfo & funcInfo,
const CIRGenCallee & callee,
ReturnValueSlot returnValue,
const CallArgList & args,
cir::CIRCallOpInterface * callOp,
mlir::Location loc )

◆ emitCall() [3/3]

RValue clang::CIRGen::CIRGenFunction::emitCall ( const CIRGenFunctionInfo & funcInfo,
const CIRGenCallee & callee,
ReturnValueSlot returnValue,
const CallArgList & args,
cir::CIRCallOpInterface * callOrTryCall = nullptr )
inline

Definition at line 1204 of file CIRGenFunction.h.

References currSrcLoc, emitCall(), and returnValue.

◆ emitCallArg()

◆ emitCallArgs()

◆ emitCallee()

◆ emitCallExpr()

◆ emitCallExprLValue()

◆ emitCaseDefaultCascade() [1/2]

template<typename T>
mlir::LogicalResult clang::CIRGen::CIRGenFunction::emitCaseDefaultCascade ( const T * stmt,
mlir::Type condType,
mlir::ArrayAttr value,
CaseOpKind kind,
bool buildingTopLevelCase )

◆ emitCaseDefaultCascade() [2/2]

template<typename T>
mlir::LogicalResult clang::CIRGen::CIRGenFunction::emitCaseDefaultCascade ( const T * stmt,
mlir::Type condType,
mlir::ArrayAttr value,
cir::CaseOpKind kind,
bool buildingTopLevelCase )

References s, clang::ast_matchers::stmt, and clang::T.

Referenced by emitCaseStmt(), and emitDefaultStmt().

◆ emitCaseStmt()

mlir::LogicalResult CIRGenFunction::emitCaseStmt ( const clang::CaseStmt & s,
mlir::Type condType,
bool buildingTopLevelCase )

Definition at line 651 of file CIRGenStmt.cpp.

References emitCaseDefaultCascade(), getContext(), and s.

Referenced by emitCaseDefaultCascade(), and emitSwitchCase().

◆ emitCastLValue()

LValue CIRGenFunction::emitCastLValue ( const CastExpr * e)

Casts are never lvalues unless that cast is to a reference type.

If the cast is to a reference, we can have the usual lvalue result, otherwise if a cast is needed by the code generator in an lvalue context, then it must mean that we need the address of an aggregate in order to access one of its members. This can happen for all the reasons that casts are permitted with aggregate result, including noop aggregate casts, and cast from scalar to union.

Definition at line 1129 of file CIRGenExpr.cpp.

References clang::cast(), clang::Type::castAsCXXRecordDecl(), cgm, clang::CastExpr::changesVolatileQualification(), convertTypeForMem(), emitDynamicCast(), emitLValue(), clang::CIRGen::LValue::getAddress(), getAddressOfBaseClass(), clang::CIRGen::LValue::getBaseInfo(), clang::CastExpr::getCastKind(), clang::CastExpr::getCastKindName(), clang::CIRGen::Address::getElementType(), clang::Expr::getExprLoc(), clang::Stmt::getSourceRange(), clang::CastExpr::getSubExpr(), clang::Expr::getType(), clang::CIRGen::LValue::isSimple(), clang::CIRGen::Address::isValid(), makeAddrLValue(), makeNaturalAlignAddrLValue(), cir::MissingFeatures::opTBAA(), clang::CastExpr::path(), V, and clang::CIRGen::Address::withElementType().

Referenced by emitLValue().

◆ emitCheckedArgForAssume()

mlir::Value CIRGenFunction::emitCheckedArgForAssume ( const Expr * e)

Emits an argument for a call to a __builtin_assume.

If the builtin sanitizer is enabled, a runtime check is also emitted.

Definition at line 489 of file CIRGenBuiltin.cpp.

References cgm, evaluateExprAsBool(), clang::Stmt::getSourceRange(), cir::MissingFeatures::sanitizers(), and sanOpts.

Referenced by emitBuiltinExpr().

◆ emitComplexAssignmentLValue()

LValue CIRGenFunction::emitComplexAssignmentLValue ( const BinaryOperator * e)

Definition at line 1048 of file CIRGenExprComplex.cpp.

References cgm, getLangOpts(), and clang::BinaryOperator::getOpcode().

Referenced by emitBinaryOperatorLValue().

◆ emitComplexCompoundAssignmentLValue()

LValue CIRGenFunction::emitComplexCompoundAssignmentLValue ( const CompoundAssignOperator * e)

Definition at line 1077 of file CIRGenExprComplex.cpp.

References getComplexOp(), and clang::BinaryOperator::getOpcode().

Referenced by emitLValue().

◆ emitComplexExpr()

mlir::Value CIRGenFunction::emitComplexExpr ( const Expr * e)

Emit the computation of the specified expression of complex type, returning the result.

EmitComplexExpr - Emit the computation of the specified expression of complex type, ignoring the result.

Definition at line 1022 of file CIRGenExprComplex.cpp.

References getComplexType(), and clang::Expr::getType().

Referenced by emitAnyExpr(), emitAtomicInit(), emitBuiltinExpr(), emitExprAsInit(), and evaluateExprAsBool().

◆ emitComplexExprIntoLValue()

void CIRGenFunction::emitComplexExprIntoLValue ( const Expr * e,
LValue dest,
bool isInit )

◆ emitComplexPrePostIncDec()

mlir::Value CIRGenFunction::emitComplexPrePostIncDec ( const UnaryOperator * e,
LValue lv,
cir::UnaryOpKind op,
bool isPre )

◆ emitComplexToScalarConversion()

mlir::Value CIRGenFunction::emitComplexToScalarConversion ( mlir::Value src,
QualType srcTy,
QualType dstTy,
SourceLocation loc )

Emit a conversion from the specified complex type to the specified destination type, where the destination type is an LLVM scalar type.

Definition at line 2096 of file CIRGenExprScalar.cpp.

References clang::Type::castAs(), convertType(), emitScalarConversion(), getLoc(), hasScalarEvaluationKind(), clang::Type::isAnyComplexType(), clang::Type::isBooleanType(), and clang::Type::isFloatingType().

Referenced by evaluateExprAsBool().

◆ emitCompoundAssignmentLValue()

LValue CIRGenFunction::emitCompoundAssignmentLValue ( const clang::CompoundAssignOperator * e)

◆ emitCompoundLiteralLValue()

◆ emitCompoundStmt()

mlir::LogicalResult CIRGenFunction::emitCompoundStmt ( const clang::CompoundStmt & s,
Address * lastValue = nullptr,
AggValueSlot slot = AggValueSlot::ignored() )

Definition at line 87 of file CIRGenStmt.cpp.

References b, emitCompoundStmtWithoutScope(), getLoc(), s, symbolTable, and clang::ast_matchers::type.

Referenced by emitSimpleStmt().

◆ emitCompoundStmtWithoutScope()

mlir::LogicalResult CIRGenFunction::emitCompoundStmtWithoutScope ( const clang::CompoundStmt & s,
Address * lastValue = nullptr,
AggValueSlot slot = AggValueSlot::ignored() )

Definition at line 66 of file CIRGenStmt.cpp.

References emitStmt(), emitStmtWithResult(), and s.

Referenced by emitCompoundStmt(), emitFunctionBody(), and emitSimpleStmt().

◆ emitConditionalBlocks()

template<typename FuncTy>
ConditionalInfo clang::CIRGen::CIRGenFunction::emitConditionalBlocks ( const AbstractConditionalOperator * e,
const FuncTy & branchGenFunc )

◆ emitConstructorBody()

◆ emitContinueStmt()

mlir::LogicalResult CIRGenFunction::emitContinueStmt ( const clang::ContinueStmt & s)

Definition at line 523 of file CIRGenStmt.cpp.

References getLoc(), and s.

Referenced by emitSimpleStmt().

◆ emitCoroEndBuiltinCall()

cir::CallOp clang::CIRGen::CIRGenFunction::emitCoroEndBuiltinCall ( mlir::Location loc,
mlir::Value nullPtr )

◆ emitCoroIDBuiltinCall()

cir::CallOp CIRGenFunction::emitCoroIDBuiltinCall ( mlir::Location loc,
mlir::Value nullPtr )

◆ emitCoroutineBody()

◆ emitCtorPrologue()

◆ emitCXXAggrConstructorCall() [1/2]

void CIRGenFunction::emitCXXAggrConstructorCall ( const CXXConstructorDecl * ctor,
const clang::ArrayType * arrayType,
Address arrayBegin,
const CXXConstructExpr * e,
bool newPointerIsChecked,
bool zeroInitialize = false )

Emit a loop to call a particular constructor for each of several members of an array.

Parameters
ctorthe constructor to call for each element
arrayTypethe type of the array to initialize
arrayBeginan arrayType*
zeroInitializetrue if each element should be zero-initialized before it is constructed

Definition at line 637 of file CIRGenClass.cpp.

References clang::ast_matchers::arrayType, emitArrayLength(), and emitCXXAggrConstructorCall().

Referenced by emitCXXAggrConstructorCall(), and emitCXXConstructExpr().

◆ emitCXXAggrConstructorCall() [2/2]

void CIRGenFunction::emitCXXAggrConstructorCall ( const CXXConstructorDecl * ctor,
mlir::Value numElements,
Address arrayBase,
const CXXConstructExpr * e,
bool newPointerIsChecked,
bool zeroInitialize )

◆ emitCXXConstructExpr()

◆ emitCXXConstructorCall() [1/2]

◆ emitCXXConstructorCall() [2/2]

◆ emitCXXDeleteExpr()

◆ emitCXXDestructorCall() [1/2]

void CIRGenFunction::emitCXXDestructorCall ( const CXXDestructorDecl * dd,
CXXDtorType type,
bool forVirtualBase,
bool delegating,
Address thisAddr,
QualType thisTy )

◆ emitCXXDestructorCall() [2/2]

◆ emitCXXForRangeStmt()

mlir::LogicalResult CIRGenFunction::emitCXXForRangeStmt ( const CXXForRangeStmt & s,
llvm::ArrayRef< const Attr * > attrs )

◆ emitCXXMemberCallExpr()

◆ emitCXXMemberOrOperatorCall()

RValue CIRGenFunction::emitCXXMemberOrOperatorCall ( const clang::CXXMethodDecl * md,
const CIRGenCallee & callee,
ReturnValueSlot returnValue,
mlir::Value thisPtr,
mlir::Value implicitParam,
clang::QualType implicitParamTy,
const clang::CallExpr * ce,
CallArgList * rtlArgs )

◆ emitCXXMemberOrOperatorMemberCallExpr()

◆ emitCXXNewExpr()

◆ emitCXXOperatorMemberCallExpr()

RValue CIRGenFunction::emitCXXOperatorMemberCallExpr ( const CXXOperatorCallExpr * e,
const CXXMethodDecl * md,
ReturnValueSlot returnValue )

◆ emitCXXPseudoDestructorExpr()

◆ emitCXXTemporary()

void CIRGenFunction::emitCXXTemporary ( const CXXTemporary * temporary,
QualType tempType,
Address ptr )

Emits all the code to cause the given temporary to be cleaned up.

Definition at line 32 of file CIRGenCleanup.cpp.

References destroyCXXObject, clang::CIRGen::NormalAndEHCleanup, and pushDestroy().

◆ emitCXXThrowExpr()

void CIRGenFunction::emitCXXThrowExpr ( const CXXThrowExpr * e)

◆ emitCXXTryStmt()

mlir::LogicalResult CIRGenFunction::emitCXXTryStmt ( const clang::CXXTryStmt & s)

Definition at line 68 of file CIRGenException.cpp.

References cgm, and s.

Referenced by emitStmt().

◆ emitDecl()

◆ emitDeclRefLValue()

◆ emitDeclStmt()

mlir::LogicalResult CIRGenFunction::emitDeclStmt ( const clang::DeclStmt & s)

Definition at line 436 of file CIRGenStmt.cpp.

References clang::CIRGen::Decl, emitDecl(), and s.

Referenced by emitSimpleStmt().

◆ emitDefaultStmt()

mlir::LogicalResult CIRGenFunction::emitDefaultStmt ( const clang::DefaultStmt & s,
mlir::Type condType,
bool buildingTopLevelCase )

Definition at line 675 of file CIRGenStmt.cpp.

References emitCaseDefaultCascade(), and s.

Referenced by emitCaseDefaultCascade(), and emitSwitchCase().

◆ emitDelegateCallArg()

void CIRGenFunction::emitDelegateCallArg ( CallArgList & args,
const clang::VarDecl * param,
clang::SourceLocation loc )

We are performing a delegate call; that is, the current function is delegating to another one.

Produce a r-value suitable for passing the given parameter.

Definition at line 260 of file CIRGenCall.cpp.

References clang::CIRGen::CallArgList::add(), cgm, convertTempToRValue(), clang::CIRGen::RValue::get(), getAddrOfLocalVar(), getContext(), getLangOpts(), getLoc(), clang::VarDecl::getSourceRange(), clang::ValueDecl::getType(), clang::VarDecl::needsDestruction(), cir::MissingFeatures::thunks(), and clang::ast_matchers::type.

Referenced by emitDelegateCXXConstructorCall(), and emitLambdaDelegatingInvokeBody().

◆ emitDelegateCXXConstructorCall()

◆ emitDelegatingCXXConstructorCall()

◆ emitDeleteCall()

◆ emitDestroy()

void CIRGenFunction::emitDestroy ( Address addr,
QualType type,
Destroyer * destroyer )

Immediately perform the destruction of the given object.

Parameters
addr- the address of the object; a type*
type- the type of the object; if an array type, all objects are destroyed in reverse order
destroyer- the function to call to destroy individual elements

Definition at line 803 of file CIRGenDecl.cpp.

References clang::CharUnits::alignmentOfArrayElement(), clang::ast_matchers::arrayType, cgm, emitArrayDestroy(), emitArrayLength(), clang::CIRGen::Address::getAlignment(), clang::ASTContext::getAsArrayType(), getContext(), clang::CIRGen::Address::getPointer(), length(), clang::ast_matchers::type, and cir::MissingFeatures::vlas().

◆ emitDestructorBody()

◆ emitDoStmt()

mlir::LogicalResult CIRGenFunction::emitDoStmt ( const clang::DoStmt & s)

◆ emitDynamicCast()

◆ emitExprAsInit()

void CIRGenFunction::emitExprAsInit ( const clang::Expr * init,
const clang::ValueDecl * d,
LValue lvalue,
bool capturedByInit = false )

Emit an expression as an initializer for an object (variable, field, etc.) at the given location.

The expression is not necessarily the normal initializer for the object, and the address is not necessarily its normal location.

Parameters
initthe initializing expression
dthe object to act as if we're initializing
lvaluethe lvalue to initialize
capturedByInittrue if d is a __block variable whose address is potentially changed by the initializer

Definition at line 542 of file CIRGenDecl.cpp.

References cir::MissingFeatures::aggValueSlotMayOverlap(), cgm, emitAggExpr(), emitComplexExpr(), emitReferenceBindingToExpr(), emitScalarInit(), emitStoreOfComplex(), emitStoreThroughLValue(), clang::CIRGen::AggValueSlot::forLValue(), getEvaluationKind(), clang::Expr::getExprLoc(), getLoc(), clang::Decl::getSourceRange(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::CIRGen::AggValueSlot::IsDestructed, clang::CIRGen::AggValueSlot::IsNotAliased, clang::CIRGen::AggValueSlot::MayOverlap, cir::TEK_Aggregate, cir::TEK_Complex, cir::TEK_Scalar, and clang::ast_matchers::type.

Referenced by emitAutoVarInit(), and emitInitializerForField().

◆ emitForStmt()

mlir::LogicalResult CIRGenFunction::emitForStmt ( const clang::ForStmt & s)

◆ emitForwardingCallToLambda()

◆ emitFunctionBody()

mlir::LogicalResult clang::CIRGen::CIRGenFunction::emitFunctionBody ( const clang::Stmt * body)

Definition at line 526 of file CIRGenFunction.cpp.

References emitCompoundStmtWithoutScope(), emitStmt(), and symbolTable.

Referenced by generateCode().

◆ emitGotoStmt()

mlir::LogicalResult CIRGenFunction::emitGotoStmt ( const clang::GotoStmt & s)

Definition at line 504 of file CIRGenStmt.cpp.

References cir::MissingFeatures::generateDebugInfo(), getLoc(), and s.

Referenced by emitSimpleStmt().

◆ emitIfOnBoolExpr() [1/2]

cir::IfOp CIRGenFunction::emitIfOnBoolExpr ( const clang::Expr * cond,
BuilderCallbackRef thenBuilder,
mlir::Location thenLoc,
BuilderCallbackRef elseBuilder,
std::optional< mlir::Location > elseLoc = {} )

Emit an if on a boolean condition, filling then and else into appropriated regions.

Definition at line 1967 of file CIRGenExpr.cpp.

References emitOpOnBoolExpr(), and getMLIRContext().

◆ emitIfOnBoolExpr() [2/2]

mlir::LogicalResult CIRGenFunction::emitIfOnBoolExpr ( const clang::Expr * cond,
const clang::Stmt * thenS,
const clang::Stmt * elseS )

Emit an if on a boolean condition to the specified blocks.

Emit an if on a boolean condition, filling then and else into appropriated regions.

FIXME: Based on the condition, this might try to simplify the codegen of the conditional based on the branch. In the future, we may apply code generation simplifications here, similar to those used in classic LLVM codegen See EmitBranchOnBoolExpr for inspiration.

Definition at line 1937 of file CIRGenExpr.cpp.

References emitIfOnBoolExpr(), emitStmt(), getLoc(), and clang::Stmt::getSourceRange().

Referenced by emitIfOnBoolExpr(), and emitIfStmt().

◆ emitIfStmt()

◆ emitIgnoredExpr()

void CIRGenFunction::emitIgnoredExpr ( const clang::Expr * e)

◆ emitImplicitAssignmentOperatorBody()

void CIRGenFunction::emitImplicitAssignmentOperatorBody ( FunctionArgList & args)

◆ emitInitializerForField()

◆ emitLabel()

◆ emitLabelStmt()

mlir::LogicalResult CIRGenFunction::emitLabelStmt ( const clang::LabelStmt & s)

◆ emitLambdaDelegatingInvokeBody()

◆ emitLambdaStaticInvokeBody()

void CIRGenFunction::emitLambdaStaticInvokeBody ( const CXXMethodDecl * md)

◆ emitLoadOfBitfieldLValue()

◆ emitLoadOfComplex()

mlir::Value CIRGenFunction::emitLoadOfComplex ( LValue src,
SourceLocation loc )

Load a complex number from the specified l-value.

Definition at line 1044 of file CIRGenExprComplex.cpp.

Referenced by convertTempToRValue(), and emitComplexPrePostIncDec().

◆ emitLoadOfLValue()

RValue CIRGenFunction::emitLoadOfLValue ( LValue lv,
SourceLocation loc )

◆ emitLoadOfReference()

◆ emitLoadOfReferenceLValue()

LValue CIRGenFunction::emitLoadOfReferenceLValue ( Address refAddr,
mlir::Location loc,
QualType refTy,
AlignmentSource source )

◆ emitLoadOfScalar() [1/2]

◆ emitLoadOfScalar() [2/2]

mlir::Value CIRGenFunction::emitLoadOfScalar ( LValue lvalue,
SourceLocation loc )

EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the memory representation to the LLVM value representation.

The l-value must be a simple l-value.

Definition at line 594 of file CIRGenExpr.cpp.

References emitLoadOfScalar(), clang::CIRGen::LValue::getAddress(), clang::CIRGen::LValue::getBaseInfo(), clang::CIRGen::LValue::getType(), clang::CIRGen::LValue::isVolatile(), cir::MissingFeatures::opLoadStoreNontemporal(), and cir::MissingFeatures::opLoadStoreTbaa().

Referenced by convertTempToRValue(), emitLoadOfLValue(), and emitLoadOfScalar().

◆ emitLValue()

◆ emitLValueForBitField()

◆ emitLValueForField()

◆ emitLValueForFieldInitialization()

LValue CIRGenFunction::emitLValueForFieldInitialization ( LValue base,
const clang::FieldDecl * field,
llvm::StringRef fieldName )

◆ emitLValueForLambdaField() [1/2]

LValue CIRGenFunction::emitLValueForLambdaField ( const FieldDecl * field)

◆ emitLValueForLambdaField() [2/2]

LValue CIRGenFunction::emitLValueForLambdaField ( const FieldDecl * field,
mlir::Value thisValue )

Given that we are currently emitting a lambda, emit an l-value for one of its members.

Definition at line 639 of file CIRGenExpr.cpp.

References cgm, curCodeDecl, emitLValueForField(), clang::ASTContext::getCanonicalTagType(), getContext(), clang::FieldDecl::getParent(), clang::FieldDecl::getSourceRange(), and makeNaturalAlignAddrLValue().

◆ emitMaterializeTemporaryExpr()

◆ emitMemberExpr()

◆ emitNewArrayInitializer()

void CIRGenFunction::emitNewArrayInitializer ( const CXXNewExpr * E,
QualType ElementType,
mlir::Type ElementTy,
Address BeginPtr,
mlir::Value NumElements,
mlir::Value AllocSizeWithoutCookie )

◆ emitNullabilityCheck()

void CIRGenFunction::emitNullabilityCheck ( LValue lhs,
mlir::Value rhs,
clang::SourceLocation loc )

Given an assignment *lhs = rhs, emit a test that checks if rhs is nonnull, if 1LHS is marked _Nonnull.

Definition at line 709 of file CIRGenDecl.cpp.

References cir::MissingFeatures::sanitizers(), and sanOpts.

◆ emitNullInitialization()

◆ emitOpenACCAtomicConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCAtomicConstruct ( const OpenACCAtomicConstruct & s)

Definition at line 308 of file CIRGenStmtOpenACC.cpp.

References cgm, and s.

Referenced by emitStmt().

◆ emitOpenACCCacheConstruct()

◆ emitOpenACCCombinedConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCCombinedConstruct ( const OpenACCCombinedConstruct & s)

Definition at line 220 of file CIRGenStmtOpenACC.cpp.

References getLoc(), clang::KernelsLoop, clang::ParallelLoop, s, and clang::SerialLoop.

Referenced by emitStmt().

◆ emitOpenACCComputeConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCComputeConstruct ( const OpenACCComputeConstruct & s)

◆ emitOpenACCDataConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCDataConstruct ( const OpenACCDataConstruct & s)

Definition at line 151 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCDeclare()

void CIRGenFunction::emitOpenACCDeclare ( const OpenACCDeclareDecl & d)

◆ emitOpenACCEnterDataConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCEnterDataConstruct ( const OpenACCEnterDataConstruct & s)

Definition at line 253 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCExitDataConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCExitDataConstruct ( const OpenACCExitDataConstruct & s)

Definition at line 261 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCHostDataConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCHostDataConstruct ( const OpenACCHostDataConstruct & s)

Definition at line 243 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCInitConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCInitConstruct ( const OpenACCInitConstruct & s)

Definition at line 161 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCIntExpr()

mlir::Value CIRGenFunction::emitOpenACCIntExpr ( const Expr * intExpr)

◆ emitOpenACCLoopConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCLoopConstruct ( const OpenACCLoopConstruct & s)

Definition at line 56 of file CIRGenStmtOpenACCLoop.cpp.

References emitStmt(), getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCRoutine()

void CIRGenFunction::emitOpenACCRoutine ( const OpenACCRoutineDecl & d)

◆ emitOpenACCSetConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCSetConstruct ( const OpenACCSetConstruct & s)

Definition at line 169 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCShutdownConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCShutdownConstruct ( const OpenACCShutdownConstruct & s)

Definition at line 176 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCUpdateConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCUpdateConstruct ( const OpenACCUpdateConstruct & s)

Definition at line 270 of file CIRGenStmtOpenACC.cpp.

References getLoc(), and s.

Referenced by emitStmt().

◆ emitOpenACCWaitConstruct()

mlir::LogicalResult CIRGenFunction::emitOpenACCWaitConstruct ( const OpenACCWaitConstruct & s)

◆ emitOpOnBoolExpr()

◆ emitPointerWithAlignment()

Address CIRGenFunction::emitPointerWithAlignment ( const clang::Expr * expr,
LValueBaseInfo * baseInfo = nullptr )

Given an expression with a pointer type, emit the value and compute our best estimate of the alignment of the pointee.

Given an expression of pointer type, try to derive a more accurate bound on the alignment of the pointer.

One reasonable way to use this information is when there's a language guarantee that the pointer must be aligned to some stricter value, and we're simply trying to ensure that sufficiently obvious uses of under- aligned objects don't get miscompiled; for example, a placement new into the address of a local variable. In such a case, it's quite reasonable to just ignore the returned alignment when it isn't from an explicit source.

Definition at line 67 of file CIRGenExpr.cpp.

References cir::MissingFeatures::addressIsKnownNonNull(), cir::MissingFeatures::addressSpace(), cgm, convertTypeForMem(), clang::CIRGen::CIRGenBuilderTy::createElementBitCast(), clang::CIRGen::Decl, emitArrayToPointerDecay(), emitLValue(), emitPointerWithAlignment(), emitScalarExpr(), clang::ast_matchers::expr, clang::CIRGen::LValue::getAddress(), getAddressOfBaseClass(), clang::CIRGen::LValueBaseInfo::getAlignmentSource(), clang::CIRGen::LValue::getBaseInfo(), getBuilder(), clang::CIRGen::Address::getElementType(), getLoc(), clang::CIRGen::Address::getPointer(), clang::CIRGen::Address::invalid(), clang::isa(), makeNaturalAddressForPointer(), clang::CIRGen::LValueBaseInfo::mergeForCast(), cir::MissingFeatures::opTBAA(), cir::MissingFeatures::sanitizers(), and shouldNullCheckClassCastValue().

Referenced by emitArraySubscriptExpr(), emitAtomicExpr(), emitCXXDeleteExpr(), emitCXXMemberOrOperatorMemberCallExpr(), emitMemberExpr(), emitPointerWithAlignment(), emitUnaryOpLValue(), and emitVAListRef().

◆ emitPredefinedLValue()

◆ emitPromotedComplexExpr()

mlir::Value CIRGenFunction::emitPromotedComplexExpr ( const Expr * e,
QualType promotionType )

Definition at line 775 of file CIRGenExprComplex.cpp.

◆ emitPromotedScalarExpr()

mlir::Value CIRGenFunction::emitPromotedScalarExpr ( const Expr * e,
QualType promotionType )

Definition at line 1414 of file CIRGenExprScalar.cpp.

References ::ScalarExprEmitter, and clang::QualType::isNull().

◆ emitPromotedValue()

mlir::Value CIRGenFunction::emitPromotedValue ( mlir::Value result,
QualType promotionType )

Definition at line 731 of file CIRGenExprComplex.cpp.

References convertType().

◆ emitReferenceBindingToExpr()

RValue CIRGenFunction::emitReferenceBindingToExpr ( const Expr * e)

◆ emitReturnOfRValue()

◆ emitReturnStmt()

◆ emitRotate()

RValue CIRGenFunction::emitRotate ( const CallExpr * e,
bool isRotateLeft )

◆ emitScalarCompoundAssignWithComplex()

LValue CIRGenFunction::emitScalarCompoundAssignWithComplex ( const CompoundAssignOperator * e,
mlir::Value & result )

◆ emitScalarConstant()

◆ emitScalarConversion()

mlir::Value CIRGenFunction::emitScalarConversion ( mlir::Value src,
clang::QualType srcType,
clang::QualType dstType,
clang::SourceLocation loc )

Emit a conversion from the specified type to the specified destination type, both of which are CIR scalar types.

Definition at line 2086 of file CIRGenExprScalar.cpp.

References ::ScalarExprEmitter, and hasScalarEvaluationKind().

Referenced by emitComplexToScalarConversion(), emitOpOnBoolExpr(), and evaluateExprAsBool().

◆ emitScalarExpr()

◆ emitScalarInit()

void CIRGenFunction::emitScalarInit ( const clang::Expr * init,
mlir::Location loc,
LValue lvalue,
bool capturedByInit = false )

◆ emitScalarPrePostIncDec()

mlir::Value CIRGenFunction::emitScalarPrePostIncDec ( const UnaryOperator * e,
LValue lv,
cir::UnaryOpKind kind,
bool isPre )

Definition at line 2400 of file CIRGenExprScalar.cpp.

References ::ScalarExprEmitter.

Referenced by emitUnaryOpLValue().

◆ emitSimpleStmt()

mlir::LogicalResult CIRGenFunction::emitSimpleStmt ( const clang::Stmt * s,
bool useCurrentScope )

◆ emitStaticVarDecl()

◆ emitStmt()

◆ emitStopPoint()

void CIRGenFunction::emitStopPoint ( const Stmt * s)

Build a debug stoppoint if we are emitting debug info.

Definition at line 104 of file CIRGenStmt.cpp.

References cir::MissingFeatures::generateDebugInfo(), and s.

Referenced by emitForStmt().

◆ emitStoreOfComplex()

void CIRGenFunction::emitStoreOfComplex ( mlir::Location loc,
mlir::Value v,
LValue dest,
bool isInit )

EmitStoreOfComplex - Store a complex number into the specified l-value.

Definition at line 1039 of file CIRGenExprComplex.cpp.

Referenced by clang::CIRGen::CallArg::copyInto(), emitComplexPrePostIncDec(), and emitExprAsInit().

◆ emitStoreOfScalar() [1/2]

◆ emitStoreOfScalar() [2/2]

void CIRGenFunction::emitStoreOfScalar ( mlir::Value value,
LValue lvalue,
bool isInit )

◆ emitStoreThroughBitfieldLValue()

mlir::Value CIRGenFunction::emitStoreThroughBitfieldLValue ( RValue src,
LValue dstresult )

◆ emitStoreThroughLValue()

void CIRGenFunction::emitStoreThroughLValue ( RValue src,
LValue dst,
bool isInit = false )

Store the specified rvalue into the specified lvalue, where both are guaranteed to the have the same type, and that type is 'Ty'.

Definition at line 246 of file CIRGenExpr.cpp.

References cgm, emitStoreOfScalar(), emitStoreThroughBitfieldLValue(), clang::CIRGen::RValue::getValue(), clang::CIRGen::RValue::isScalar(), and cir::MissingFeatures::opLoadStoreObjC().

Referenced by emitAnyExprToMem(), emitAutoVarInit(), emitBinaryOperatorLValue(), emitExprAsInit(), emitInitializerForField(), and emitScalarInit().

◆ emitStringLiteralLValue()

LValue CIRGenFunction::emitStringLiteralLValue ( const StringLiteral * e,
llvm::StringRef name = ".str" )

◆ emitSwitchBody()

mlir::LogicalResult CIRGenFunction::emitSwitchBody ( const clang::Stmt * s)

◆ emitSwitchCase()

mlir::LogicalResult CIRGenFunction::emitSwitchCase ( const clang::SwitchCase & s,
bool buildingTopLevelCase )

Definition at line 682 of file CIRGenStmt.cpp.

References clang::cast(), condTypeStack, emitCaseStmt(), emitDefaultStmt(), and s.

Referenced by emitSimpleStmt(), and emitSwitchBody().

◆ emitSwitchStmt()

◆ emitTernaryOnBoolExpr()

mlir::Value clang::CIRGen::CIRGenFunction::emitTernaryOnBoolExpr ( const clang::Expr * cond,
mlir::Location loc,
const clang::Stmt * thenS,
const clang::Stmt * elseS )

◆ emitToMemory()

mlir::Value CIRGenFunction::emitToMemory ( mlir::Value value,
clang::QualType ty )

Given a value and its clang type, returns the value casted to its memory representation.

Note: CIR defers most of the special casting to the final lowering passes to conserve the high level information.

Definition at line 538 of file CIRGenExpr.cpp.

Referenced by emitStoreOfScalar().

◆ emitTrap()

void CIRGenFunction::emitTrap ( mlir::Location loc,
bool createNewBlock )

Emit a trap instruction, which is used to abort the program in an abnormal way, usually for debugging purposes.

createNewBlock indicates whether to create a new block for the IR builder. Since the cir.trap operation is a terminator, operations that follow a trap cannot be emitted after cir.trap in the same block. To ensure these operations get emitted successfully, you need to create a new dummy block and set the insertion point there before continuing from the trap operation.

Definition at line 2218 of file CIRGenExpr.cpp.

Referenced by emitBuiltinExpr().

◆ emitUnaryOpLValue()

◆ emitUnPromotedValue()

mlir::Value CIRGenFunction::emitUnPromotedValue ( mlir::Value result,
QualType unPromotionType )

Definition at line 723 of file CIRGenExprComplex.cpp.

References convertType().

◆ emitUnreachable()

void CIRGenFunction::emitUnreachable ( clang::SourceLocation loc,
bool createNewBlock )

Emit a reached-unreachable diagnostic if loc is valid and runtime checking is enabled.

Otherwise, just emit an unreachable instruction. createNewBlock indicates whether to create a new block for the IR builder. Since the cir.unreachable operation is a terminator, operations that follow an unreachable point cannot be emitted after cir.unreachable in the same block. To ensure these operations get emitted successfully, you need to create a dummy block and set the insertion point there before continuing from the unreachable point.

Definition at line 2224 of file CIRGenExpr.cpp.

References getLoc(), and cir::MissingFeatures::sanitizers().

Referenced by emitBuiltinExpr().

◆ emitVAArg()

mlir::Value CIRGenFunction::emitVAArg ( VAArgExpr * ve)

Generate code to get an argument from the passed in pointer and update it accordingly.

Parameters
veThe VAArgExpr for which to generate code.
vaListAddrReceives a reference to the va_list as emitted by either emitVAListRef or emitMSVAListRef.
Returns
SSA value with the argument.

Definition at line 513 of file CIRGenBuiltin.cpp.

References cgm, convertType(), emitVAListRef(), clang::Expr::getExprLoc(), clang::CIRGen::Address::getPointer(), clang::VAArgExpr::getSubExpr(), clang::Expr::getType(), cir::MissingFeatures::msabi(), clang::ast_matchers::type, and cir::MissingFeatures::vlas().

◆ emitVAEnd()

void CIRGenFunction::emitVAEnd ( mlir::Value vaList)

Emits the end of a CIR variable-argument operation (cir.va_start)

Parameters
vaListA reference to the va_list as emitted by either emitVAListRef or emitMSVAListRef.

Definition at line 506 of file CIRGenBuiltin.cpp.

Referenced by emitBuiltinExpr().

◆ emitVAListRef()

Address clang::CIRGen::CIRGenFunction::emitVAListRef ( const Expr * e)

Build a "reference" to a va_list; this is either the address or the value of the expression, depending on how va_list is defined.

Definition at line 1188 of file CIRGenFunction.cpp.

References emitLValue(), emitPointerWithAlignment(), clang::CIRGen::LValue::getAddress(), and getContext().

Referenced by emitBuiltinExpr(), and emitVAArg().

◆ emitVarDecl()

◆ emitVariablyModifiedType()

◆ emitVAStart()

void CIRGenFunction::emitVAStart ( mlir::Value vaList,
mlir::Value count )

Emits the start of a CIR variable-argument operation (cir.va_start)

Parameters
vaListA reference to the va_list as emitted by either emitVAListRef or emitMSVAListRef.
countThe number of arguments in vaList

Definition at line 500 of file CIRGenBuiltin.cpp.

Referenced by emitBuiltinExpr().

◆ emitWhileStmt()

mlir::LogicalResult CIRGenFunction::emitWhileStmt ( const clang::WhileStmt & s)

◆ enterDtorCleanups()

void CIRGenFunction::enterDtorCleanups ( const CXXDestructorDecl * dd,
CXXDtorType dtorType )

Enter the cleanups necessary to complete the given phase of destruction for a destructor.

Emit all code that comes at the end of class's destructor.

The end result should call destructors on members and base classes in reverse order of their construction.

This is to call destructors on members and base classes in reverse order of their construction.

For a deleting destructor, this also handles the case where a destroying operator delete completely overrides the definition.

Definition at line 946 of file CIRGenClass.cpp.

References clang::CXXRecordDecl::bases(), cgm, cxxStructorImplicitParamValue, clang::Dtor_Base, clang::Dtor_Complete, clang::Dtor_Deleting, cir::MissingFeatures::ehCleanupFlags(), ehStack, clang::RecordDecl::fields(), getCleanupKind(), getDestroyer(), clang::CXXDestructorDecl::getOperatorDelete(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getSourceRange(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::FunctionDecl::isDestroyingOperatorDelete(), clang::FunctionDecl::isTrivial(), clang::TagDecl::isUnion(), clang::CIRGen::NormalAndEHCleanup, cir::MissingFeatures::sanitizers(), clang::ast_matchers::type, and clang::CXXRecordDecl::vbases().

Referenced by emitDestructorBody().

◆ evaluateExprAsBool()

mlir::Value CIRGenFunction::evaluateExprAsBool ( const clang::Expr * e)

◆ finishFunction()

void clang::CIRGen::CIRGenFunction::finishFunction ( SourceLocation endLoc)

◆ generateCode()

◆ getAddressOfBaseClass()

◆ getAddressOfDirectBaseInCompleteClass()

Address CIRGenFunction::getAddressOfDirectBaseInCompleteClass ( mlir::Location loc,
Address thisAddr,
const CXXRecordDecl * derived,
const CXXRecordDecl * base,
bool baseIsVirtual )

Convert the given pointer to a complete class to the given direct base.

Gets the address of a direct base class within a complete object.

This should only be used for (1) non-virtual bases or (2) virtual bases when the type is known to be complete (e.g. in complete destructors).

The object pointed to by 'thisAddr' is assumed to be non-null.

Definition at line 183 of file CIRGenClass.cpp.

References convertType(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), getContext(), clang::CIRGen::Address::getElementType(), clang::CharUnits::getQuantity(), and clang::ASTRecordLayout::getVBaseClassOffset().

Referenced by emitBaseInitializer().

◆ getAddrOfBitFieldStorage()

◆ getAddrOfLocalVar()

Address clang::CIRGen::CIRGenFunction::getAddrOfLocalVar ( const clang::VarDecl * vd)
inline

Return the address of a local variable.

Definition at line 780 of file CIRGenFunction.h.

References localDeclMap.

Referenced by emitDelegateCallArg(), and clang::CIRGen::CIRGenCXXABI::loadIncomingCXXThis().

◆ getBuilder()

◆ getCIRGenModule() [1/2]

CIRGenModule & clang::CIRGen::CIRGenFunction::getCIRGenModule ( )
inline

◆ getCIRGenModule() [2/2]

const CIRGenModule & clang::CIRGen::CIRGenFunction::getCIRGenModule ( ) const
inline

Definition at line 133 of file CIRGenFunction.h.

References cgm.

◆ getCleanupKind()

CleanupKind clang::CIRGen::CIRGenFunction::getCleanupKind ( QualType::DestructionKind kind)
inline

◆ getContext()

clang::ASTContext & clang::CIRGen::CIRGenFunction::getContext ( ) const
inline

Definition at line 128 of file CIRGenFunction.h.

References cgm.

Referenced by addInitializerToStaticVarDecl(), canEmitSpuriousReferenceToVariable(), constantFoldsToSimpleInteger(), convertType(), createDummyValue(), createMemTemp(), emitAddrOfFieldStorage(), emitAggregateCopy(), emitArrayLength(), emitArraySubscriptExpr(), emitArraySubscriptPtr(), emitAsmStmt(), emitAtomicCmpXchgFailureSet(), emitAtomicExpr(), emitAtomicOp(), emitAutoVarAlloca(), emitAutoVarCleanups(), emitAutoVarInit(), emitBaseInitializer(), emitBuiltinExpr(), emitCall(), emitCallExprLValue(), emitCaseStmt(), emitCXXAggrConstructorCall(), emitCXXConstructExpr(), emitCXXDeleteExpr(), emitCXXNewAllocSize(), emitCXXNewExpr(), emitDeclDestroy(), emitDeclInit(), emitDeclRefLValue(), emitDelegateCallArg(), emitDeleteCall(), emitDestroy(), emitDynamicCastInfo(), emitFunctionDeclLValue(), emitGlobalVarDeclLValue(), emitLabelStmt(), emitLambdaDelegatingInvokeBody(), emitLValueForLambdaField(), emitMemberInitializer(), emitNullInitialization(), emitOpenACCIntExpr(), emitOpenACCWaitConstruct(), emitOpOnBoolExpr(), emitPointerArithmetic(), emitReturnStmt(), emitStaticVarDecl(), emitUnaryOpLValue(), emitVAListRef(), emitVariablyModifiedType(), evaluateExprAsBool(), getAddressOfBaseClass(), getAddressOfDirectBaseInCompleteClass(), getItaniumDynamicCastFn(), getLoc(), getOpenACCDataOperandInfo(), getOverlapForBaseInit(), getOverlapForFieldInit(), getVLASize(), getVTablePointers(), getVTTParameter(), initializeVTablePointer(), isCheapEnoughToEvaluateUnconditionally(), startFunction(), tryEmitAsConstant(), and tryToConvertMemberExprToDeclRefExpr().

◆ getCounterAggTmpAsString()

std::string clang::CIRGen::CIRGenFunction::getCounterAggTmpAsString ( )

◆ getCounterRefTmpAsString()

std::string clang::CIRGen::CIRGenFunction::getCounterRefTmpAsString ( )

Definition at line 881 of file CIRGenFunction.cpp.

References counterRefTmp, and clang::CIRGen::getVersionedTmpName().

Referenced by createReferenceTemporary().

◆ getCurFunctionEntryBlock()

mlir::Block * clang::CIRGen::CIRGenFunction::getCurFunctionEntryBlock ( )
inline

Definition at line 135 of file CIRGenFunction.h.

References curFn.

◆ getDestroyer()

◆ getEvaluationKind()

◆ getLangOpts()

◆ getLoc() [1/3]

mlir::Location clang::CIRGen::CIRGenFunction::getLoc ( clang::SourceLocation srcLoc)

Helpers to convert Clang's SourceLocation to a MLIR Location.

Definition at line 103 of file CIRGenFunction.cpp.

References currSrcLoc, clang::PresumedLoc::getColumn(), getContext(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), and clang::SourceLocation::isValid().

Referenced by clang::CIRGen::CIRGenFunction::LexicalScope::cleanup(), createReferenceTemporary(), emitAddrOfFieldStorage(), emitAggExprToLValue(), emitAlignmentAssumption(), emitAnyExpr(), emitAnyExprToTemp(), emitAsmStmt(), emitAtomicCmpXchg(), emitAtomicExpr(), emitAtomicInit(), emitAtomicOp(), emitAutoVarAlloca(), emitAutoVarInit(), emitBinaryOperatorLValue(), emitBreakStmt(), emitBuiltinBitOp(), emitBuiltinExpr(), emitCall(), emitCaseDefaultCascade(), emitComplexExprIntoLValue(), emitComplexPrePostIncDec(), emitComplexToScalarConversion(), emitCompoundLiteralLValue(), emitCompoundStmt(), emitContinueStmt(), emitCoroutineBody(), emitCtorPrologue(), emitCXXConstructExpr(), emitCXXConstructorCall(), emitCXXDestructorCall(), emitCXXForRangeStmt(), emitCXXMemberOrOperatorCall(), emitCXXNewAllocSize(), emitCXXNewExpr(), emitDeclDestroy(), emitDeclInit(), emitDeclRefLValue(), emitDelegateCallArg(), emitDoStmt(), emitDynamicCast(), emitExprAsInit(), emitForStmt(), emitFunctionDeclLValue(), emitGotoStmt(), emitIfOnBoolExpr(), emitIfStmt(), emitLabel(), emitLambdaDelegatingInvokeBody(), emitLoadOfBitfieldLValue(), emitLoadOfLValue(), emitLoadOfScalar(), emitLValueForBitField(), emitLValueForField(), emitLValueForFieldInitialization(), emitOpenACCCombinedConstruct(), emitOpenACCComputeConstruct(), emitOpenACCDataConstruct(), emitOpenACCEnterDataConstruct(), emitOpenACCExitDataConstruct(), emitOpenACCHostDataConstruct(), emitOpenACCInitConstruct(), emitOpenACCLoopConstruct(), emitOpenACCSetConstruct(), emitOpenACCShutdownConstruct(), emitOpenACCUpdateConstruct(), emitOpenACCWaitConstruct(), emitPointerArithmetic(), emitPointerWithAlignment(), emitReturnStmt(), emitRotate(), emitScalarConstant(), emitStringLiteralLValue(), emitSwitchStmt(), emitUnaryOpLValue(), emitUnreachable(), emitValToTemp(), emitWhileStmt(), evaluateExprAsBool(), generateCode(), getAddressOfBaseClass(), getAddrOfBitFieldStorage(), getLoc(), clang::CIRGen::CIRGenCXXABI::loadIncomingCXXThis(), startFunction(), and storeAnyExprIntoOneUnit().

◆ getLoc() [2/3]

mlir::Location clang::CIRGen::CIRGenFunction::getLoc ( clang::SourceRange srcLoc)

◆ getLoc() [3/3]

mlir::Location clang::CIRGen::CIRGenFunction::getLoc ( mlir::Location lhs,
mlir::Location rhs )

Definition at line 135 of file CIRGenFunction.cpp.

References getMLIRContext().

◆ getMLIRContext()

mlir::MLIRContext & clang::CIRGen::CIRGenFunction::getMLIRContext ( )
inline

◆ getOpenACCDataOperandInfo()

◆ getOrCreateOpaqueLValueMapping()

LValue CIRGenFunction::getOrCreateOpaqueLValueMapping ( const OpaqueValueExpr * e)

Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.

Definition at line 1504 of file CIRGenExpr.cpp.

References emitLValue(), clang::OpaqueValueExpr::getSourceExpr(), clang::OpaqueValueExpr::isUnique(), opaqueLValues, and clang::CIRGen::CIRGenFunction::OpaqueValueMapping::shouldBindAsLValue().

◆ getOrCreateOpaqueRValueMapping()

RValue CIRGenFunction::getOrCreateOpaqueRValueMapping ( const OpaqueValueExpr * e)

Given an opaque value expression, return its RValue mapping if it exists, otherwise create one.

Definition at line 1516 of file CIRGenExpr.cpp.

References emitAnyExpr(), clang::OpaqueValueExpr::getSourceExpr(), clang::OpaqueValueExpr::isUnique(), opaqueRValues, and clang::CIRGen::CIRGenFunction::OpaqueValueMapping::shouldBindAsLValue().

◆ getOverlapForBaseInit()

AggValueSlot::Overlap_t CIRGenFunction::getOverlapForBaseInit ( const CXXRecordDecl * rd,
const CXXRecordDecl * baseRD,
bool isVirtual )

◆ getOverlapForFieldInit()

◆ getOverlapForReturnValue()

AggValueSlot::Overlap_t clang::CIRGen::CIRGenFunction::getOverlapForReturnValue ( )
inline

Determine whether a return value slot may overlap some other object.

Definition at line 823 of file CIRGenFunction.h.

References clang::CIRGen::AggValueSlot::DoesNotOverlap.

Referenced by emitReturnOfRValue(), and emitReturnStmt().

◆ getTarget()

const TargetInfo & clang::CIRGen::CIRGenFunction::getTarget ( ) const
inline

Definition at line 184 of file CIRGenFunction.h.

References cgm.

Referenced by collectClobbers(), emitCXXThrowExpr(), and emitDestructorBody().

◆ getTypes()

CIRGenTypes & clang::CIRGen::CIRGenFunction::getTypes ( ) const
inline

Definition at line 182 of file CIRGenFunction.h.

References cgm.

Referenced by commonBuildCXXMemberOrOperatorCall(), emitCall(), and emitCall().

◆ getUndefRValue()

RValue CIRGenFunction::getUndefRValue ( clang::QualType ty)

Get an appropriate 'undef' rvalue for the given type.

TODO: What's the equivalent for MLIR? Currently we're only using this for void types so it just returns RValue::get(nullptr) but it'll need addressed later.

Definition at line 1697 of file CIRGenExpr.cpp.

References cgm, clang::CIRGen::RValue::get(), and clang::Type::isVoidType().

Referenced by emitBuiltinExpr(), and emitCall().

◆ getVLASize() [1/2]

CIRGenFunction::VlaSizePair clang::CIRGen::CIRGenFunction::getVLASize ( const VariableArrayType * type)

Returns an MLIR::Value+QualType pair that corresponds to the size, in non-variably-sized elements, of a variable length array type, plus that largest non-variably-sized element type.

Assumes that the type has already been emitted with emitVariablyModifiedType.

Definition at line 1019 of file CIRGenFunction.cpp.

References getContext(), cir::NoUnsignedWrap, clang::CIRGen::CIRGenTypeCache::SizeTy, clang::ast_matchers::type, and vlaSizeMap.

Referenced by emitAutoVarAlloca(), and getVLASize().

◆ getVLASize() [2/2]

CIRGenFunction::VlaSizePair clang::CIRGen::CIRGenFunction::getVLASize ( QualType type)

Definition at line 1011 of file CIRGenFunction.cpp.

References cgm, getVLASize(), and clang::ast_matchers::type.

◆ getVTablePointers() [1/2]

◆ getVTablePointers() [2/2]

CIRGenFunction::VPtrsVector CIRGenFunction::getVTablePointers ( const clang::CXXRecordDecl * vtableClass)

◆ getVTablePtr()

mlir::Value CIRGenFunction::getVTablePtr ( mlir::Location loc,
Address thisAddr,
const clang::CXXRecordDecl * vtableClass )

Return the Value of the vtable pointer member pointed to by thisAddr.

Definition at line 1188 of file CIRGenClass.cpp.

References cgm, cir::MissingFeatures::createInvariantGroup(), clang::CIRGen::Address::getAlignment(), clang::CIRGen::Address::getPointer(), and cir::MissingFeatures::opTBAA().

◆ getVTTParameter()

mlir::Value CIRGenFunction::getVTTParameter ( GlobalDecl gd,
bool forVirtualBase,
bool delegating )

Return the VTT parameter that should be passed to a base constructor/destructor with virtual bases.

FIXME: VTTs are Itanium ABI-specific, so the definition should move to ItaniumCXXABI.cpp together with all the references to VTT.

Definition at line 1068 of file CIRGenClass.cpp.

References clang::cast(), cgm, curCodeDecl, curGD, clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::TypeDecl::getBeginLoc(), getContext(), clang::GlobalDecl::getDecl(), clang::ASTRecordLayout::getVBaseClassOffset(), and loadCXXVTT().

◆ hasAggregateEvaluationKind()

◆ hasScalarEvaluationKind()

bool clang::CIRGen::CIRGenFunction::hasScalarEvaluationKind ( clang::QualType type)
inlinestatic

◆ haveInsertPoint()

bool clang::CIRGen::CIRGenFunction::haveInsertPoint ( ) const
inline

True if an insertion point is defined.

If not, this indicates that the current code being emitted is unreachable. FIXME(cir): we need to inspect this and perhaps use a cleaner mechanism since we don't yet force null insertion point to designate behavior (like LLVM's codegen does) and we probably shouldn't.

Definition at line 407 of file CIRGenFunction.h.

Referenced by emitCleanup(), and emitDestructorBody().

◆ initializeVTablePointer()

◆ initializeVTablePointers()

void CIRGenFunction::initializeVTablePointers ( mlir::Location loc,
const clang::CXXRecordDecl * rd )

◆ isConstructorDelegationValid()

bool CIRGenFunction::isConstructorDelegationValid ( const clang::CXXConstructorDecl * ctor)
static

Checks whether the given constructor is a valid subject for the complete-to-base constructor delegation optimization, i.e.

emitting the complete constructor as a simple call to the base constructor.

Definition at line 29 of file CIRGenClass.cpp.

References clang::Type::castAs(), clang::CXXRecordDecl::getNumVBases(), clang::CXXMethodDecl::getParent(), clang::ValueDecl::getType(), clang::CXXConstructorDecl::isDelegatingConstructor(), and clang::FunctionProtoType::isVariadic().

Referenced by emitConstructorBody().

◆ isCoroutine()

bool clang::CIRGen::CIRGenFunction::isCoroutine ( ) const
inline

Definition at line 81 of file CIRGenFunction.h.

References curCoro.

◆ isInConditionalBranch()

bool clang::CIRGen::CIRGenFunction::isInConditionalBranch ( ) const
inline

Definition at line 1656 of file CIRGenFunction.h.

References outermostConditional.

Referenced by pushFullExprCleanup(), and setBeforeOutermostConditional().

◆ isLValueSuitableForInlineAtomic()

bool CIRGenFunction::isLValueSuitableForInlineAtomic ( LValue lv)

An LValue is a candidate for having its loads and stores be made atomic if we are operating under /volatile:ms and the LValue itself is volatile and performing such an operation can be performed without a libcall.

Definition at line 2400 of file CIRGenExpr.cpp.

References cgm.

Referenced by emitLoadOfScalar().

◆ isTrivialInitializer()

bool CIRGenFunction::isTrivialInitializer ( const Expr * init)

Determine whether the given initializer is trivial in the sense that it requires no code to be generated.

Definition at line 121 of file CIRGenDecl.cpp.

Referenced by emitAutoVarInit().

◆ loadCXXThis()

mlir::Value clang::CIRGen::CIRGenFunction::loadCXXThis ( )
inline

Load the value for 'this'.

This function is only valid while generating code for an C++ member function. FIXME(cir): this should return a mlir::Value!

Definition at line 801 of file CIRGenFunction.h.

References cxxThisValue.

Referenced by emitMemberInitializer(), and loadCXXThisAddress().

◆ loadCXXThisAddress()

◆ loadCXXVTT()

mlir::Value clang::CIRGen::CIRGenFunction::loadCXXVTT ( )
inline

Load the VTT parameter to base constructors/destructors have virtual bases.

FIXME: Every place that calls LoadCXXVTT is something that needs to be abstracted properly.

Definition at line 810 of file CIRGenFunction.h.

References cxxStructorImplicitParamValue.

Referenced by getVTTParameter().

◆ makeAddrLValue() [1/2]

◆ makeAddrLValue() [2/2]

LValue clang::CIRGen::CIRGenFunction::makeAddrLValue ( Address addr,
QualType ty,
LValueBaseInfo baseInfo )
inline

Definition at line 769 of file CIRGenFunction.h.

References clang::CIRGen::LValue::makeAddr().

◆ makeNaturalAddressForPointer()

Address clang::CIRGen::CIRGenFunction::makeNaturalAddressForPointer ( mlir::Value ptr,
QualType t,
CharUnits alignment,
bool forPointeeType = false,
LValueBaseInfo * baseInfo = nullptr )
inline

Construct an address with the natural alignment of T.

If a pointer to T is expected to be signed, the pointer passed to this function must have been signed, and the returned Address will have the pointer authentication information needed to authenticate the signed pointer.

Definition at line 743 of file CIRGenFunction.h.

References cgm, convertTypeForMem(), and clang::CharUnits::isZero().

Referenced by emitPointerWithAlignment().

◆ makeNaturalAlignAddrLValue()

LValue clang::CIRGen::CIRGenFunction::makeNaturalAlignAddrLValue ( mlir::Value val,
QualType ty )

◆ makeNaturalAlignPointeeAddrLValue()

LValue clang::CIRGen::CIRGenFunction::makeNaturalAlignPointeeAddrLValue ( mlir::Value v,
clang::QualType t )

Given a value of type T* that may not be to a complete object, construct an l-vlaue withi the natural pointee alignment of T.

Definition at line 767 of file CIRGenFunction.cpp.

References cgm, makeAddrLValue(), and cir::MissingFeatures::opTBAA().

Referenced by emitCallExprLValue(), and emitMemberInitializer().

◆ maybeEmitDeferredVarDeclInit()

void CIRGenFunction::maybeEmitDeferredVarDeclInit ( const VarDecl * vd)

Definition at line 900 of file CIRGenDecl.cpp.

References b, and emitVarDecl().

Referenced by emitDecl().

◆ needsEHCleanup()

bool clang::CIRGen::CIRGenFunction::needsEHCleanup ( QualType::DestructionKind kind)
inline

Determines whether an EH cleanup is required to destroy a type with the given destruction kind.

TODO(cir): could be shared with Clang LLVM codegen

Definition at line 593 of file CIRGenFunction.h.

References cgm, clang::QualType::DK_cxx_destructor, clang::QualType::DK_none, clang::QualType::DK_nontrivial_c_struct, clang::QualType::DK_objc_strong_lifetime, clang::QualType::DK_objc_weak_lifetime, and getLangOpts().

Referenced by getCleanupKind().

◆ popCleanupBlock()

◆ popCleanupBlocks()

void CIRGenFunction::popCleanupBlocks ( EHScopeStack::stable_iterator oldCleanupStackDepth)

Takes the old cleanup stack size and emits the cleanup blocks that have been added.

Pops cleanup blocks until the given savepoint is reached.

Definition at line 177 of file CIRGenCleanup.cpp.

References ehStack, cir::MissingFeatures::ehstackBranches(), and popCleanupBlock().

Referenced by finishFunction().

◆ pushDestroy()

void CIRGenFunction::pushDestroy ( CleanupKind kind,
Address addr,
QualType type,
Destroyer * destroyer )

Definition at line 743 of file CIRGenDecl.cpp.

References pushFullExprCleanup(), and clang::ast_matchers::type.

Referenced by emitCXXTemporary(), and pushTemporaryCleanup().

◆ pushFullExprCleanup()

template<class T, class... As>
void clang::CIRGen::CIRGenFunction::pushFullExprCleanup ( CleanupKind kind,
As... a )
inline

Push a cleanup to be run at the end of the current full-expression.

Safe against the possibility that we're currently inside a conditionally-evaluated expression.

Definition at line 869 of file CIRGenFunction.h.

References cgm, ehStack, isInConditionalBranch(), and clang::T.

Referenced by pushDestroy().

◆ pushStackRestore()

void CIRGenFunction::pushStackRestore ( CleanupKind kind,
Address spMem )

Definition at line 850 of file CIRGenDecl.cpp.

References ehStack.

Referenced by emitAutoVarAlloca().

◆ setAddrOfLocalVar()

void clang::CIRGen::CIRGenFunction::setAddrOfLocalVar ( const clang::VarDecl * vd,
Address addr )
inline

Set the address of a local variable.

Definition at line 615 of file CIRGenFunction.h.

References clang::CIRGen::Address::getPointer(), localDeclMap, and symbolTable.

Referenced by emitAutoVarAlloca(), emitStaticVarDecl(), and startFunction().

◆ setBeforeOutermostConditional()

void clang::CIRGen::CIRGenFunction::setBeforeOutermostConditional ( mlir::Value value,
Address addr )
inline

◆ shouldEmitVTableTypeCheckedLoad()

bool CIRGenFunction::shouldEmitVTableTypeCheckedLoad ( const CXXRecordDecl * rd)

Returns whether we should perform a type checked load when loading a virtual function for virtual calls to members of RD.

This is generally true when both vcall CFI and whole-program-vtables are enabled.

Definition at line 1175 of file CIRGenClass.cpp.

References cgm, cir::MissingFeatures::hiddenVisibility(), and cir::MissingFeatures::sanitizers().

◆ shouldNullCheckClassCastValue()

bool clang::CIRGen::CIRGenFunction::shouldNullCheckClassCastValue ( const CastExpr * ce)

◆ startFunction()

◆ tryEmitAsConstant() [1/2]

CIRGenFunction::ConstantEmission CIRGenFunction::tryEmitAsConstant ( const DeclRefExpr * refExpr)

Try to emit a reference to the given value without producing it as an l-value.

For many cases, this is just an optimization, but it avoids us needing to emit global copies of variables if they're named without triggering a formal use in a context where we can't emit a direct reference to them, for instance if a block or lambda or a member of a local class uses a const int variable or constexpr variable from an enclosing function.

For named members of enums, this is the only way they are emitted.

Definition at line 2331 of file CIRGenExpr.cpp.

References c, clang::CIRGen::ConstantEmitter::emitAbstract(), clang::Expr::EvaluateAsRValue(), clang::CIRGen::CIRGenFunction::ConstantEmission::forValue(), cir::MissingFeatures::generateDebugInfo(), getContext(), clang::DeclRefExpr::getDecl(), clang::DeclRefExpr::getLocation(), clang::Expr::getType(), clang::Expr::EvalStatus::HasSideEffects, clang::isa(), cir::MissingFeatures::tryEmitAsConstant(), and clang::Expr::EvalResult::Val.

Referenced by tryEmitAsConstant().

◆ tryEmitAsConstant() [2/2]

CIRGenFunction::ConstantEmission CIRGenFunction::tryEmitAsConstant ( const MemberExpr * me)

Definition at line 2366 of file CIRGenExpr.cpp.

References tryEmitAsConstant(), and tryToConvertMemberExprToDeclRefExpr().

◆ ::ScalarExprEmitter

friend class ::ScalarExprEmitter
friend

Member Data Documentation

◆ cgm

CIRGenModule& clang::CIRGen::CIRGenFunction::cgm

Definition at line 54 of file CIRGenFunction.h.

Referenced by addInitializerToStaticVarDecl(), buildFunctionArgList(), calculateCookiePadding(), canEmitSpuriousReferenceToVariable(), CIRGenFunction(), commonBuildCXXMemberOrOperatorCall(), convertTempToRValue(), convertType(), convertTypeForMem(), clang::CIRGen::CallArg::copyInto(), createMemTemp(), createReferenceTemporary(), createTempAllocaWithoutCast(), emitAddrOfFieldStorage(), emitAggregateCopy(), emitArrayDestroy(), emitArrayLength(), emitArraySubscriptExpr(), emitArrayToPointerDecay(), emitAsmStmt(), emitAtomicCmpXchgFailureSet(), emitAtomicExpr(), emitAtomicOp(), emitAutoVarAlloca(), emitAutoVarCleanups(), emitAutoVarInit(), emitAutoVarTypeCleanup(), emitBinaryOperatorLValue(), emitBuiltinExpr(), emitCall(), emitCall(), emitCallArg(), emitCallArgs(), emitCallee(), emitCallExpr(), emitCallExprLValue(), emitCastLValue(), emitCheckedArgForAssume(), emitComplexAssignmentLValue(), emitComplexPrePostIncDec(), emitCompoundLiteralLValue(), emitConstructorBody(), emitCoroIDBuiltinCall(), emitCtorPrologue(), emitCXXAggrConstructorCall(), emitCXXConstructExpr(), emitCXXConstructorCall(), emitCXXDeleteExpr(), emitCXXDestructorCall(), emitCXXDestructorCall(), emitCXXMemberCallExpr(), emitCXXMemberOrOperatorCall(), emitCXXMemberOrOperatorMemberCallExpr(), emitCXXNewAllocSize(), emitCXXNewExpr(), emitCXXPseudoDestructorExpr(), emitCXXThrowExpr(), emitCXXTryStmt(), emitDecl(), emitDeclDestroy(), emitDeclInit(), emitDeclRefLValue(), emitDelegateCallArg(), emitDelegateCXXConstructorCall(), emitDelegatingCXXConstructorCall(), emitDeleteCall(), emitDestroy(), emitDestructorBody(), emitDynamicCast(), emitDynamicCastInfo(), emitExprAsInit(), emitForwardingCallToLambda(), emitFunctionDeclLValue(), emitGlobalVarDeclLValue(), emitImplicitAssignmentOperatorBody(), emitLambdaStaticInvokeBody(), emitLoadOfBitfieldLValue(), emitLoadOfLValue(), emitLoadOfReference(), emitLoadOfScalar(), emitLValue(), emitLValueForBitField(), emitLValueForField(), emitLValueForFieldInitialization(), emitLValueForLambdaField(), emitMaterializeTemporaryExpr(), emitMemberExpr(), emitMemberInitializer(), emitNewArrayInitializer(), emitNewDeleteCall(), emitNullInitialization(), emitObjectDelete(), emitOpenACCAtomicConstruct(), emitOpenACCIntExpr(), emitOpenACCWaitConstruct(), emitOpOnBoolExpr(), emitPointerArithmetic(), emitPointerWithAlignment(), emitPredefinedLValue(), emitReturnOfRValue(), emitReturnStmt(), emitScalarConstant(), emitScalarInit(), emitStaticVarDecl(), emitStmt(), emitStoreOfScalar(), emitStoreThroughBitfieldLValue(), emitStoreThroughLValue(), emitStringLiteralLValue(), emitVAArg(), emitVarDecl(), emitVariablyModifiedType(), enterDtorCleanups(), evaluateExprAsBool(), getAddressOfBaseClass(), getAddrOfBitFieldStorage(), getBadCastFn(), getCIRGenModule(), getCIRGenModule(), getContext(), getDestroyer(), getItaniumDynamicCastFn(), getLangOpts(), getMLIRContext(), getOpenACCDataOperandInfo(), clang::CIRGen::CIRGenFunction::ConstantEmission::getReferenceLValue(), getTarget(), getTypes(), getUndefRValue(), getVLASize(), getVTablePtr(), getVTTParameter(), initializeVTablePointer(), initializeVTablePointers(), isLValueSuitableForInlineAtomic(), loadCXXThisAddress(), makeNaturalAddressForPointer(), makeNaturalAlignAddrLValue(), makeNaturalAlignPointeeAddrLValue(), needsEHCleanup(), clang::CIRGen::CIRGenCallee::prepareConcreteCallee(), pushFullExprCleanup(), pushTemporaryCleanup(), shouldEmitVTableTypeCheckedLoad(), and startFunction().

◆ condTypeStack

llvm::SmallVector<mlir::Type, 2> clang::CIRGen::CIRGenFunction::condTypeStack

The type of the condition for the emitting switch statement.

Definition at line 126 of file CIRGenFunction.h.

Referenced by emitSwitchCase(), and emitSwitchStmt().

◆ counterAggTmp

unsigned clang::CIRGen::CIRGenFunction::counterAggTmp = 0

Definition at line 391 of file CIRGenFunction.h.

Referenced by getCounterAggTmpAsString().

◆ counterRefTmp

unsigned clang::CIRGen::CIRGenFunction::counterRefTmp = 0

Hold counters for incrementally naming temporaries.

Definition at line 390 of file CIRGenFunction.h.

Referenced by getCounterRefTmpAsString().

◆ curCodeDecl

const clang::Decl* clang::CIRGen::CIRGenFunction::curCodeDecl = nullptr

This is the inner-most code context, which includes blocks.

Definition at line 113 of file CIRGenFunction.h.

Referenced by canEmitSpuriousReferenceToVariable(), emitLValueForLambdaField(), emitPredefinedLValue(), getVTTParameter(), and startFunction().

◆ curCoro

CGCoroInfo clang::CIRGen::CIRGenFunction::curCoro

Definition at line 79 of file CIRGenFunction.h.

Referenced by createCoroData(), emitCoroutineBody(), and isCoroutine().

◆ curFn

mlir::Operation* clang::CIRGen::CIRGenFunction::curFn = nullptr

The current function or global initializer that is generated code for.

This is usually a cir::FuncOp, but it can also be a cir::GlobalOp for global initializers.

Definition at line 118 of file CIRGenFunction.h.

Referenced by clang::CIRGen::CIRGenModule::createCIRFunction(), emitCoroutineBody(), emitPredefinedLValue(), getCurFunctionEntryBlock(), and startFunction().

◆ curFuncDecl

const clang::Decl* clang::CIRGen::CIRGenFunction::curFuncDecl = nullptr

Definition at line 111 of file CIRGenFunction.h.

Referenced by emitBaseInitializer(), loadCXXThisAddress(), and startFunction().

◆ curGD

clang::GlobalDecl clang::CIRGen::CIRGenFunction::curGD

◆ curLexScope

LexicalScope* clang::CIRGen::CIRGenFunction::curLexScope = nullptr

◆ currentCleanupStackDepth

EHScopeStack::stable_iterator clang::CIRGen::CIRGenFunction::currentCleanupStackDepth = ehStack.stable_end()

Definition at line 926 of file CIRGenFunction.h.

Referenced by emitReturnOfRValue(), and emitReturnStmt().

◆ currSrcLoc

std::optional<mlir::Location> clang::CIRGen::CIRGenFunction::currSrcLoc

Use to track source locations across nested visitor traversals.

Always use a SourceLocRAIIObject to change currSrcLoc.

Definition at line 368 of file CIRGenFunction.h.

Referenced by emitAggregateStore(), emitArrayDestroy(), emitArrayLength(), emitCall(), emitCXXAggrConstructorCall(), emitCXXMemberOrOperatorCall(), emitDeleteCall(), emitForwardingCallToLambda(), emitStoreOfScalar(), getLoc(), and getLoc().

◆ curSourceLocExprScope

clang::CurrentSourceLocExprScope clang::CIRGen::CIRGenFunction::curSourceLocExprScope

Source location information about the default argument or member initializer expression we're evaluating, if any.

Definition at line 691 of file CIRGenFunction.h.

Referenced by clang::CIRGen::CIRGenFunction::CXXDefaultInitExprScope::CXXDefaultInitExprScope().

◆ cxxabiThisDecl

ImplicitParamDecl* clang::CIRGen::CIRGenFunction::cxxabiThisDecl = nullptr

CXXThisDecl - When generating code for a C++ member function, this will hold the implicit 'this' declaration.

Definition at line 96 of file CIRGenFunction.h.

Referenced by clang::CIRGen::CIRGenCXXABI::buildThisParam(), and clang::CIRGen::CIRGenCXXABI::getThisDecl().

◆ cxxabiThisValue

mlir::Value clang::CIRGen::CIRGenFunction::cxxabiThisValue = nullptr

◆ cxxDefaultInitExprThis

Address clang::CIRGen::CIRGenFunction::cxxDefaultInitExprThis = Address::invalid()

The value of 'this' to sue when evaluating CXXDefaultInitExprs within this expression.

Definition at line 108 of file CIRGenFunction.h.

Referenced by clang::CIRGen::CIRGenFunction::FieldConstructionScope::FieldConstructionScope().

◆ cxxStructorImplicitParamDecl

ImplicitParamDecl* clang::CIRGen::CIRGenFunction::cxxStructorImplicitParamDecl {}

When generating code for a constructor or destructor, this will hold the implicit argument (e.g.

VTT).

Definition at line 103 of file CIRGenFunction.h.

Referenced by clang::CIRGen::CIRGenCXXABI::getStructorImplicitParamDecl().

◆ cxxStructorImplicitParamValue

mlir::Value clang::CIRGen::CIRGenFunction::cxxStructorImplicitParamValue {}

◆ cxxThisAlignment

clang::CharUnits clang::CIRGen::CIRGenFunction::cxxThisAlignment

◆ cxxThisValue

mlir::Value clang::CIRGen::CIRGenFunction::cxxThisValue = nullptr

◆ destroyCXXObject

void CIRGenFunction::destroyCXXObject
static

Definition at line 1078 of file CIRGenFunction.h.

Referenced by emitCXXTemporary(), getDestroyer(), and pushTemporaryCleanup().

◆ didCallStackSave

bool clang::CIRGen::CIRGenFunction::didCallStackSave = false

Whether a cir.stacksave operation has been added.

Used to avoid inserting cir.stacksave for multiple VLAs in the same scope.

Definition at line 154 of file CIRGenFunction.h.

Referenced by emitAutoVarAlloca(), and startFunction().

◆ ehStack

◆ fnRetAlloca

std::optional<mlir::Value> clang::CIRGen::CIRGenFunction::fnRetAlloca

The compiler-generated variable that holds the return value.

Definition at line 69 of file CIRGenFunction.h.

Referenced by emitReturnStmt().

◆ lambdaCaptureFields

llvm::DenseMap<const clang::ValueDecl *, clang::FieldDecl *> clang::CIRGen::CIRGenFunction::lambdaCaptureFields

Definition at line 91 of file CIRGenFunction.h.

Referenced by emitDeclRefLValue(), and startFunction().

◆ lambdaThisCaptureField

clang::FieldDecl* clang::CIRGen::CIRGenFunction::lambdaThisCaptureField = nullptr

Definition at line 92 of file CIRGenFunction.h.

Referenced by startFunction().

◆ localDeclMap

DeclMapTy clang::CIRGen::CIRGenFunction::localDeclMap

This keeps track of the CIR allocas or globals for local C declarations.

Definition at line 123 of file CIRGenFunction.h.

Referenced by createReferenceTemporary(), emitDeclRefLValue(), emitStaticVarDecl(), getAddrOfLocalVar(), and setAddrOfLocalVar().

◆ opaqueLValues

llvm::DenseMap<const OpaqueValueExpr *, LValue> clang::CIRGen::CIRGenFunction::opaqueLValues

◆ opaqueRValues

◆ outermostConditional

◆ prologueCleanupDepth

EHScopeStack::stable_iterator clang::CIRGen::CIRGenFunction::prologueCleanupDepth

The cleanup depth enclosing all the cleanups associated with the parameters.

Definition at line 858 of file CIRGenFunction.h.

Referenced by finishFunction(), and startFunction().

◆ returnValue

Address clang::CIRGen::CIRGenFunction::returnValue = Address::invalid()

◆ sanOpts

clang::SanitizerSet clang::CIRGen::CIRGenFunction::sanOpts

Sanitizers enabled for this function.

Definition at line 142 of file CIRGenFunction.h.

Referenced by emitCheckedArgForAssume(), and emitNullabilityCheck().

◆ sawAsmBlock

bool clang::CIRGen::CIRGenFunction::sawAsmBlock = false

Whether or not a Microsoft-style asm block has been processed within this fuction.

These can potentially set the return value.

Definition at line 158 of file CIRGenFunction.h.

◆ symbolTable

SymTableTy clang::CIRGen::CIRGenFunction::symbolTable

◆ vlaSizeMap

llvm::DenseMap<const Expr *, mlir::Value> clang::CIRGen::CIRGenFunction::vlaSizeMap

Definition at line 201 of file CIRGenFunction.h.

Referenced by emitVariablyModifiedType(), and getVLASize().


The documentation for this class was generated from the following files: