18#ifndef CLANG_LIB_CIR_CODEGEN_CIRGENCONSTANTEMITTER_H
19#define CLANG_LIB_CIR_CODEGEN_CIRGENCONSTANTEMITTER_H
32 bool abstract =
false;
38 bool initializedNonAbstract =
false;
41 bool finalized =
false;
48 bool inConstantContext =
false;
111 void initializeNonAbstract() {
112 assert(!initializedNonAbstract);
113 initializedNonAbstract =
true;
116 mlir::Attribute markIfFailed(mlir::Attribute init) {
122 void initializeNonAbstract() {}
123 mlir::Attribute markIfFailed(mlir::Attribute init) {
return init; }
126 class AbstractStateRAII {
127 ConstantEmitter &emitter;
131 AbstractStateRAII(ConstantEmitter &emitter,
bool value)
132 : emitter(emitter), oldValue(emitter.abstract) {
133 emitter.abstract = value;
135 ~AbstractStateRAII() { emitter.abstract = oldValue; }
__device__ __2f16 float c
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
This class organizes the cross-function state that is used while generating CIR code.
void finalize(cir::GlobalOp gv)
mlir::Attribute emitForMemory(mlir::Attribute c, QualType destType)
ConstantEmitter(const ConstantEmitter &other)=delete
ConstantEmitter & operator=(const ConstantEmitter &other)=delete
mlir::TypedAttr tryEmitPrivate(const Expr *e, QualType destType)
mlir::Attribute tryEmitPrivateForVarInit(const VarDecl &d)
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 tryEmitPrivateForMemory(const APValue &value, QualType t)
const CIRGenFunction * cgf
mlir::Attribute tryEmitForInitializer(const VarDecl &d)
Try to emit the initializer of the given declaration as an abstract constant.
ConstantEmitter(CIRGenFunction &cgf)
Initialize this emission in the context of the given function.
mlir::Attribute tryEmitAbstractForInitializer(const VarDecl &d)
Try to emit the initializer of the given declaration as an abstract constant.
ConstantEmitter(CIRGenModule &cgm, CIRGenFunction *cgf=nullptr)
mlir::Attribute tryEmitConstantExpr(const ConstantExpr *ce)
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
This represents one expression.
A (possibly-)qualified type.
Encodes a location in the source.
Represents a variable declaration or definition.
static bool addressSpace()