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;
81 void finalize(llvm::GlobalVariable *global);
156 llvm::GlobalValue *placeholder);
159 void initializeNonAbstract(
LangAS destAS) {
160 assert(!InitializedNonAbstract);
161 InitializedNonAbstract =
true;
162 DestAddressSpace = destAS;
164 llvm::Constant *markIfFailed(llvm::Constant *init) {
170 struct AbstractState {
172 size_t OldPlaceholdersSize;
174 AbstractState pushAbstract() {
175 AbstractState saved = { Abstract, PlaceholderAddresses.size() };
179 llvm::Constant *validateAndPopAbstract(llvm::Constant *
C, AbstractState save);
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
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.
void setInConstantContext(bool var)
llvm::Constant * tryEmitPrivateForMemory(const Expr *E, QualType T)
llvm::Constant * tryEmitForInitializer(const VarDecl &D)
Try to emit the initiaizer of the given declaration as an abstract constant.
llvm::Constant * tryEmitPrivateForVarInit(const VarDecl &D)
llvm::Constant * tryEmitPrivate(const Expr *E, QualType T)
void finalize(llvm::GlobalVariable *global)
llvm::Constant * tryEmitAbstractForInitializer(const VarDecl &D)
Try to emit the initializer of the given declaration as an abstract constant.
llvm::Constant * emitAbstract(const Expr *E, QualType T)
Emit the result of the given expression as an abstract constant, asserting that it succeeded.
llvm::GlobalValue * getCurrentAddrPrivate()
Get the address of the current location.
llvm::Constant * tryEmitConstantExpr(const ConstantExpr *CE)
llvm::Constant * emitForMemory(llvm::Constant *C, QualType T)
llvm::Constant * emitNullForMemory(QualType T)
ConstantEmitter(CodeGenFunction &CGF)
Initialize this emission in the context of the given function.
ConstantEmitter(CodeGenModule &CGM, CodeGenFunction *CGF=nullptr)
ConstantEmitter(const ConstantEmitter &other)=delete
bool isInConstantContext() const
llvm::Constant * tryEmitAbstract(const Expr *E, QualType T)
Try to emit the result of the given expression as an abstract constant.
CodeGenFunction *const CGF
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 * emitForInitializer(const APValue &value, LangAS destAddrSpace, QualType destType)
llvm::Constant * tryEmitAbstractForMemory(const Expr *E, QualType T)
bool isAbstract() const
Is the current emission context abstract?
ConstantEmitter & operator=(const ConstantEmitter &other)=delete
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.
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.
const FunctionProtoType * T