Go to the documentation of this file.
14 #ifndef LLVM_CLANG_LIB_CODEGEN_CONSTANTEMITTER_H
15 #define LLVM_CLANG_LIB_CODEGEN_CONSTANTEMITTER_H
29 bool Abstract =
false;
32 bool InitializedNonAbstract =
false;
35 bool Finalized =
false;
41 bool InConstantContext =
false;
78 void finalize(llvm::GlobalVariable *global);
153 llvm::GlobalValue *placeholder);
156 void initializeNonAbstract(
LangAS destAS) {
157 assert(!InitializedNonAbstract);
158 InitializedNonAbstract =
true;
159 DestAddressSpace = destAS;
161 llvm::Constant *markIfFailed(llvm::Constant *init) {
167 struct AbstractState {
169 size_t OldPlaceholdersSize;
171 AbstractState pushAbstract() {
172 AbstractState saved = { Abstract, PlaceholderAddresses.size() };
176 llvm::Constant *validateAndPopAbstract(llvm::Constant *C, AbstractState save);
llvm::Constant * emitForInitializer(const APValue &value, LangAS destAddrSpace, QualType destType)
CodeGenFunction *const CGF
llvm::Constant * tryEmitForInitializer(const VarDecl &D)
Try to emit the initiaizer of the given declaration as an abstract constant.
Encodes a location in the source.
llvm::Constant * emitForMemory(llvm::Constant *C, QualType T)
A (possibly-)qualified type.
llvm::Constant * tryEmitPrivateForVarInit(const VarDecl &D)
ConstantEmitter & operator=(const ConstantEmitter &other)=delete
llvm::Constant * tryEmitAbstractForInitializer(const VarDecl &D)
Try to emit the initializer of the given declaration as an abstract constant.
llvm::Constant * tryEmitPrivate(const Expr *E, QualType T)
ConstantEmitter(CodeGenModule &CGM, CodeGenFunction *CGF=nullptr)
llvm::GlobalValue * getCurrentAddrPrivate()
Get the address of the current location.
ConstantEmitter(CodeGenFunction &CGF)
Initialize this emission in the context of the given function.
Represents a variable declaration or definition.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
LangAS
Defines the address space values used by the address space qualifier of QualType.
llvm::Constant * tryEmitConstantExpr(const ConstantExpr *CE)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Constant * emitAbstract(const Expr *E, QualType T)
Emit the result of the given expression as an abstract constant, asserting that it succeeded.
void registerCurrentAddrPrivate(llvm::Constant *signal, llvm::GlobalValue *placeholder)
Register a 'signal' value with the emitter to inform it where to resolve a placeholder.
llvm::Constant * emitNullForMemory(QualType T)
llvm::Constant * tryEmitPrivateForMemory(const Expr *E, QualType T)
bool isAbstract() const
Is the current emission context abstract?
llvm::Constant * tryEmitAbstract(const Expr *E, QualType T)
Try to emit the result of the given expression as an abstract constant.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
This represents one expression.
void finalize(llvm::GlobalVariable *global)
llvm::Constant * tryEmitAbstractForMemory(const Expr *E, QualType T)