clang 23.0.0git
clang::CIRGen::ConstantEmitter Class Reference

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

Public Member Functions

 ConstantEmitter (CIRGenFunction &cgf)
 Initialize this emission in the context of the given function.
 ConstantEmitter (CIRGenModule &cgm, CIRGenFunction *cgf=nullptr)
 ConstantEmitter (const ConstantEmitter &other)=delete
ConstantEmitteroperator= (const ConstantEmitter &other)=delete
 ~ConstantEmitter ()
mlir::Attribute tryEmitForInitializer (const VarDecl &d)
 Try to emit the initializer of the given declaration as an abstract constant.
mlir::Attribute emitForInitializer (const APValue &value, QualType destType)
void finalize (cir::GlobalOp gv)
mlir::Attribute emitForMemory (mlir::Attribute c, QualType destType)
mlir::Attribute emitNullForMemory (mlir::Location loc, QualType t)
mlir::Attribute tryEmitAbstractForInitializer (const VarDecl &d)
 Try to emit the initializer of the given declaration as an abstract constant.
mlir::Attribute emitAbstract (const Expr *e, QualType destType)
 Emit the result of the given expression as an abstract constant, asserting that it succeeded.
mlir::Attribute emitAbstract (SourceLocation loc, const APValue &value, QualType destType)
mlir::Attribute tryEmitConstantExpr (const ConstantExpr *ce)
mlir::Attribute tryEmitPrivateForVarInit (const VarDecl &d)
mlir::TypedAttr tryEmitPrivate (const Expr *e, QualType destType)
mlir::Attribute tryEmitPrivate (const APValue &value, QualType destType)
mlir::Attribute tryEmitPrivateForMemory (const Expr *e, QualType destTy)
mlir::Attribute tryEmitPrivateForMemory (const APValue &value, QualType destTy)
mlir::Attribute tryEmitAbstract (const Expr *e, QualType destType)

Static Public Member Functions

static mlir::Attribute emitForMemory (CIRGenModule &cgm, mlir::Attribute c, clang::QualType destTy)
static mlir::Attribute emitNullForMemory (mlir::Location loc, CIRGenModule &cgm, QualType t)

Public Attributes

CIRGenModulecgm
const CIRGenFunctioncgf

Detailed Description

Definition at line 26 of file CIRGenConstantEmitter.h.

Constructor & Destructor Documentation

◆ ConstantEmitter() [1/3]

clang::CIRGen::ConstantEmitter::ConstantEmitter ( CIRGenFunction & cgf)
inline

Initialize this emission in the context of the given function.

Use this if the expression might contain contextual references like block addresses or PredefinedExprs.

Definition at line 54 of file CIRGenConstantEmitter.h.

References cgf, and cgm.

Referenced by ConstantEmitter(), and operator=().

◆ ConstantEmitter() [2/3]

clang::CIRGen::ConstantEmitter::ConstantEmitter ( CIRGenModule & cgm,
CIRGenFunction * cgf = nullptr )
inline

Definition at line 56 of file CIRGenConstantEmitter.h.

References cgf, and cgm.

◆ ConstantEmitter() [3/3]

clang::CIRGen::ConstantEmitter::ConstantEmitter ( const ConstantEmitter & other)
delete

References ConstantEmitter().

◆ ~ConstantEmitter()

ConstantEmitter::~ConstantEmitter ( )

Definition at line 1532 of file CIRGenExprConstant.cpp.

Member Function Documentation

◆ emitAbstract() [1/2]

mlir::Attribute ConstantEmitter::emitAbstract ( const Expr * e,
QualType destType )

Emit the result of the given expression as an abstract constant, asserting that it succeeded.

This is only safe to do when the expression is known to be a constant expression with either a fairly simple type or a known simple form.

Definition at line 1722 of file CIRGenExprConstant.cpp.

References c, cgm, clang::Stmt::getSourceRange(), and tryEmitPrivate().

Referenced by clang::CIRGen::CIRGenFunction::emitDeclRefLValue(), clang::CIRGen::CIRGenFunction::tryEmitAsConstant(), and tryEmitConstantExpr().

◆ emitAbstract() [2/2]

mlir::Attribute ConstantEmitter::emitAbstract ( SourceLocation loc,
const APValue & value,
QualType destType )

Definition at line 1732 of file CIRGenExprConstant.cpp.

References c, cgm, and tryEmitPrivate().

◆ emitForInitializer()

mlir::Attribute ConstantEmitter::emitForInitializer ( const APValue & value,
QualType destType )

Definition at line 1507 of file CIRGenExprConstant.cpp.

References c, and tryEmitPrivateForMemory().

◆ emitForMemory() [1/2]

mlir::Attribute ConstantEmitter::emitForMemory ( CIRGenModule & cgm,
mlir::Attribute c,
clang::QualType destTy )
static

Definition at line 1762 of file CIRGenExprConstant.cpp.

References c, cgm, and clang::Type::getAs().

◆ emitForMemory() [2/2]

mlir::Attribute ConstantEmitter::emitForMemory ( mlir::Attribute c,
QualType destType )

◆ emitNullForMemory() [1/2]

mlir::Attribute ConstantEmitter::emitNullForMemory ( mlir::Location loc,
CIRGenModule & cgm,
QualType t )
static

Definition at line 1742 of file CIRGenExprConstant.cpp.

References cgm, and emitForMemory().

◆ emitNullForMemory() [2/2]

mlir::Attribute clang::CIRGen::ConstantEmitter::emitNullForMemory ( mlir::Location loc,
QualType t )
inline

Definition at line 89 of file CIRGenConstantEmitter.h.

References cgm, and emitNullForMemory().

Referenced by emitNullForMemory().

◆ finalize()

void ConstantEmitter::finalize ( cir::GlobalOp gv)

◆ operator=()

ConstantEmitter & clang::CIRGen::ConstantEmitter::operator= ( const ConstantEmitter & other)
delete

References c, cgm, and ConstantEmitter().

◆ tryEmitAbstract()

mlir::Attribute ConstantEmitter::tryEmitAbstract ( const Expr * e,
QualType destType )

Definition at line 1687 of file CIRGenExprConstant.cpp.

References tryEmitPrivate().

Referenced by emitCXXNewAllocSize().

◆ tryEmitAbstractForInitializer()

mlir::Attribute ConstantEmitter::tryEmitAbstractForInitializer ( const VarDecl & d)

Try to emit the initializer of the given declaration as an abstract constant.

Definition at line 1527 of file CIRGenExprConstant.cpp.

References tryEmitPrivateForVarInit().

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

◆ tryEmitConstantExpr()

◆ tryEmitForInitializer()

mlir::Attribute ConstantEmitter::tryEmitForInitializer ( const VarDecl & d)

Try to emit the initializer of the given declaration as an abstract constant.

If this succeeds, the emission must be finalized.

Definition at line 1502 of file CIRGenExprConstant.cpp.

References tryEmitPrivateForVarInit().

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

◆ tryEmitPrivate() [1/2]

mlir::Attribute ConstantEmitter::tryEmitPrivate ( const APValue & value,
QualType destType )

◆ tryEmitPrivate() [2/2]

◆ tryEmitPrivateForMemory() [1/2]

mlir::Attribute ConstantEmitter::tryEmitPrivateForMemory ( const APValue & value,
QualType destTy )

Definition at line 1715 of file CIRGenExprConstant.cpp.

References c, cgm, emitForMemory(), getNonMemoryType(), and tryEmitPrivate().

◆ tryEmitPrivateForMemory() [2/2]

mlir::Attribute ConstantEmitter::tryEmitPrivateForMemory ( const Expr * e,
QualType destTy )

◆ tryEmitPrivateForVarInit()

Member Data Documentation

◆ cgf

const CIRGenFunction* clang::CIRGen::ConstantEmitter::cgf

Definition at line 29 of file CIRGenConstantEmitter.h.

Referenced by ConstantEmitter(), and ConstantEmitter().

◆ cgm


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