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);
108 bool EnablePtrAuthFunctionTypeDiscrimination =
true);
144 bool EnablePtrAuthFunctionTypeDiscrimination =
true);
162 llvm::GlobalValue *placeholder);
165 void initializeNonAbstract(
LangAS destAS) {
166 assert(!InitializedNonAbstract);
167 InitializedNonAbstract =
true;
168 DestAddressSpace = destAS;
170 llvm::Constant *markIfFailed(llvm::Constant *init) {
176 struct AbstractState {
178 size_t OldPlaceholdersSize;
180 AbstractState pushAbstract() {
181 AbstractState saved = { Abstract, PlaceholderAddresses.size() };
185 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
llvm::Constant * tryEmitConstantSignedPointer(llvm::Constant *Ptr, PointerAuthQualifier Auth)
Try to emit a constant signed pointer, given a raw pointer and the destination ptrauth qualifier.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
This represents one expression.
Pointer-authentication qualifiers.
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