clang 22.0.0git
|
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 | |
ConstantEmitter & | operator= (const ConstantEmitter &other)=delete |
~ConstantEmitter () | |
mlir::Attribute | tryEmitForInitializer (const VarDecl &d) |
Try to emit the initializer of the given declaration as an abstract constant. | |
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) |
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 | |
CIRGenModule & | cgm |
const CIRGenFunction * | cgf |
Definition at line 26 of file CIRGenConstantEmitter.h.
|
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.
Referenced by ConstantEmitter(), and operator=().
|
inline |
Definition at line 56 of file CIRGenConstantEmitter.h.
|
delete |
References ConstantEmitter().
ConstantEmitter::~ConstantEmitter | ( | ) |
Definition at line 1491 of file CIRGenExprConstant.cpp.
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 1580 of file CIRGenExprConstant.cpp.
References c, cgm, clang::Stmt::getSourceRange(), and tryEmitPrivate().
Referenced by emitCXXNewAllocSize(), clang::CIRGen::CIRGenFunction::tryEmitAsConstant(), and tryEmitConstantExpr().
mlir::Attribute ConstantEmitter::emitAbstract | ( | SourceLocation | loc, |
const APValue & | value, | ||
QualType | destType ) |
Definition at line 1590 of file CIRGenExprConstant.cpp.
References c, cgm, and tryEmitPrivate().
|
static |
Definition at line 1620 of file CIRGenExprConstant.cpp.
References c, cgm, and clang::Type::getAs().
mlir::Attribute ConstantEmitter::emitForMemory | ( | mlir::Attribute | c, |
QualType | destType ) |
Definition at line 1609 of file CIRGenExprConstant.cpp.
References c, cgm, and clang::Type::getAs().
Referenced by emitNullForMemory(), tryEmitPrivateForMemory(), tryEmitPrivateForMemory(), and tryEmitPrivateForVarInit().
|
static |
Definition at line 1600 of file CIRGenExprConstant.cpp.
References cgm, and emitForMemory().
|
inline |
Definition at line 87 of file CIRGenConstantEmitter.h.
References cgm, and emitNullForMemory().
Referenced by emitNullForMemory().
void ConstantEmitter::finalize | ( | cir::GlobalOp | gv | ) |
Definition at line 1474 of file CIRGenExprConstant.cpp.
Referenced by clang::CIRGen::CIRGenFunction::addInitializerToStaticVarDecl().
|
delete |
References c, cgm, and ConstantEmitter().
mlir::Attribute ConstantEmitter::tryEmitAbstractForInitializer | ( | const VarDecl & | d | ) |
Try to emit the initializer of the given declaration as an abstract constant.
Definition at line 1486 of file CIRGenExprConstant.cpp.
References tryEmitPrivateForVarInit().
Referenced by clang::CIRGen::CIRGenFunction::emitAutoVarInit().
mlir::Attribute ConstantEmitter::tryEmitConstantExpr | ( | const ConstantExpr * | ce | ) |
Definition at line 1551 of file CIRGenExprConstant.cpp.
References cgm, emitAbstract(), clang::ConstantExpr::getAPValueResult(), clang::ConstantExpr::getBeginLoc(), clang::Expr::getType(), clang::ConstantExpr::hasAPValueResult(), and clang::Expr::isGLValue().
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 1469 of file CIRGenExprConstant.cpp.
References tryEmitPrivateForVarInit().
Referenced by clang::CIRGen::CIRGenFunction::addInitializerToStaticVarDecl().
Definition at line 1657 of file CIRGenExprConstant.cpp.
References clang::APValue::AddrLabelDiff, clang::APValue::Array, clang::Type::castAs(), cgm, clang::APValue::ComplexFloat, clang::APValue::ComplexInt, clang::ast_matchers::complexType, clang::APValue::FixedPoint, clang::APValue::Float, clang::APValue::getArrayFiller(), clang::APValue::getArrayInitializedElt(), clang::APValue::getArrayInitializedElts(), clang::APValue::getArraySize(), cir::CIRBaseBuilderTy::getCIRBoolAttr(), clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getComplexIntImag(), clang::APValue::getComplexIntReal(), clang::ArrayType::getElementType(), clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::hasArrayFiller(), clang::APValue::Indeterminate, clang::APValue::Int, clang::isa(), clang::CIRGen::CIRGenBuilderTy::isNullValue(), clang::APValue::LValue, clang::APValue::MemberPointer, clang::APValue::None, clang::APValue::Struct, tryEmitPrivate(), tryEmitPrivateForMemory(), clang::APValue::Union, and clang::APValue::Vector.
Definition at line 1631 of file CIRGenExprConstant.cpp.
References c, cgm, clang::Expr::EvaluateAsLValue(), clang::Expr::EvaluateAsRValue(), clang::Expr::EvalStatus::hasSideEffects(), clang::Type::isReferenceType(), clang::Type::isVoidType(), tryEmitPrivate(), and clang::Expr::EvalResult::Val.
Referenced by emitAbstract(), emitAbstract(), tryEmitPrivate(), tryEmitPrivate(), tryEmitPrivateForMemory(), and tryEmitPrivateForMemory().
Definition at line 1573 of file CIRGenExprConstant.cpp.
References c, cgm, emitForMemory(), getNonMemoryType(), and tryEmitPrivate().
Definition at line 1562 of file CIRGenExprConstant.cpp.
References c, cgm, emitForMemory(), getNonMemoryType(), and tryEmitPrivate().
Referenced by tryEmitPrivate(), and tryEmitPrivateForVarInit().
mlir::Attribute ConstantEmitter::tryEmitPrivateForVarInit | ( | const VarDecl & | d | ) |
Definition at line 1496 of file CIRGenExprConstant.cpp.
References c, clang::Type::castAsCXXRecordDecl(), cgm, emitForMemory(), clang::VarDecl::evaluateValue(), clang::VarDecl::getInit(), getNonMemoryType(), clang::ValueDecl::getType(), clang::VarDecl::hasConstantInitialization(), clang::VarDecl::hasLocalStorage(), clang::CXXConstructorDecl::isDefaultConstructor(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::FunctionDecl::isTrivial(), and tryEmitPrivateForMemory().
Referenced by tryEmitAbstractForInitializer(), and tryEmitForInitializer().
const CIRGenFunction* clang::CIRGen::ConstantEmitter::cgf |
Definition at line 29 of file CIRGenConstantEmitter.h.
Referenced by ConstantEmitter(), and ConstantEmitter().
CIRGenModule& clang::CIRGen::ConstantEmitter::cgm |
Definition at line 28 of file CIRGenConstantEmitter.h.
Referenced by ConstantEmitter(), ConstantEmitter(), emitAbstract(), emitAbstract(), emitForMemory(), emitForMemory(), emitNullForMemory(), emitNullForMemory(), operator=(), tryEmitConstantExpr(), tryEmitPrivate(), tryEmitPrivate(), tryEmitPrivateForMemory(), tryEmitPrivateForMemory(), and tryEmitPrivateForVarInit().