clang
8.0.0
|
#include "/work/www-prereleases/8.0.0/rc1/builddocs/llvm.src/tools/clang/lib/CodeGen/ConstantEmitter.h"
Public Member Functions | |
ConstantEmitter (CodeGenModule &CGM, CodeGenFunction *CGF=nullptr) | |
ConstantEmitter (CodeGenFunction &CGF) | |
Initialize this emission in the context of the given function. More... | |
ConstantEmitter (const ConstantEmitter &other)=delete | |
ConstantEmitter & | operator= (const ConstantEmitter &other)=delete |
~ConstantEmitter () | |
bool | isAbstract () const |
Is the current emission context abstract? More... | |
llvm::Constant * | tryEmitForInitializer (const VarDecl &D) |
Try to emit the initiaizer of the given declaration as an abstract constant. More... | |
llvm::Constant * | tryEmitForInitializer (const Expr *E, LangAS destAddrSpace, QualType destType) |
llvm::Constant * | emitForInitializer (const APValue &value, LangAS destAddrSpace, QualType destType) |
void | finalize (llvm::GlobalVariable *global) |
llvm::Constant * | tryEmitAbstractForInitializer (const VarDecl &D) |
Try to emit the initializer of the given declaration as an abstract constant. More... | |
llvm::Constant * | emitAbstract (const Expr *E, QualType T) |
Emit the result of the given expression as an abstract constant, asserting that it succeeded. More... | |
llvm::Constant * | emitAbstract (SourceLocation loc, const APValue &value, QualType T) |
llvm::Constant * | tryEmitAbstract (const Expr *E, QualType T) |
Try to emit the result of the given expression as an abstract constant. More... | |
llvm::Constant * | tryEmitAbstractForMemory (const Expr *E, QualType T) |
llvm::Constant * | tryEmitAbstract (const APValue &value, QualType T) |
llvm::Constant * | tryEmitAbstractForMemory (const APValue &value, QualType T) |
llvm::Constant * | emitNullForMemory (QualType T) |
llvm::Constant * | emitForMemory (llvm::Constant *C, QualType T) |
llvm::Constant * | tryEmitPrivateForVarInit (const VarDecl &D) |
llvm::Constant * | tryEmitPrivate (const Expr *E, QualType T) |
llvm::Constant * | tryEmitPrivateForMemory (const Expr *E, QualType T) |
llvm::Constant * | tryEmitPrivate (const APValue &value, QualType T) |
llvm::Constant * | tryEmitPrivateForMemory (const APValue &value, QualType T) |
llvm::GlobalValue * | getCurrentAddrPrivate () |
Get the address of the current location. More... | |
void | registerCurrentAddrPrivate (llvm::Constant *signal, llvm::GlobalValue *placeholder) |
Register a 'signal' value with the emitter to inform it where to resolve a placeholder. More... | |
Static Public Member Functions | |
static llvm::Constant * | emitNullForMemory (CodeGenModule &CGM, QualType T) |
static llvm::Constant * | emitForMemory (CodeGenModule &CGM, llvm::Constant *C, QualType T) |
Public Attributes | |
CodeGenModule & | CGM |
CodeGenFunction * | CGF |
Definition at line 24 of file ConstantEmitter.h.
|
inline |
Definition at line 52 of file ConstantEmitter.h.
Referenced by ConstantEmitter().
|
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 58 of file ConstantEmitter.h.
References ConstantEmitter(), operator=(), and ~ConstantEmitter().
|
delete |
ConstantEmitter::~ConstantEmitter | ( | ) |
Definition at line 1431 of file CGExprConstant.cpp.
Referenced by ConstantEmitter().
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 1213 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenModule::EmitNullConstant(), clang::CodeGen::CodeGenModule::Error(), clang::Expr::getExprLoc(), and clang::CodeGen::state.
Referenced by clang::CodeGen::CodeGenModule::createOpenCLIntToSamplerConversion(), clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), isAbstract(), and clang::CodeGen::CodeGenFunction::tryEmitAsConstant().
llvm::Constant * ConstantEmitter::emitAbstract | ( | SourceLocation | loc, |
const APValue & | value, | ||
QualType | T | ||
) |
Definition at line 1226 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenModule::EmitNullConstant(), clang::CodeGen::CodeGenModule::Error(), and clang::CodeGen::state.
llvm::Constant * ConstantEmitter::emitForInitializer | ( | const APValue & | value, |
LangAS | destAddrSpace, | ||
QualType | destType | ||
) |
Definition at line 1251 of file CGExprConstant.cpp.
Referenced by isAbstract().
|
inline |
Definition at line 117 of file ConstantEmitter.h.
References emitNullForMemory(), getCurrentAddrPrivate(), registerCurrentAddrPrivate(), tryEmitPrivate(), tryEmitPrivateForMemory(), and tryEmitPrivateForVarInit().
|
static |
Definition at line 1516 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenTypes::ConvertTypeForMem(), clang::Type::getAs(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getTypes(), clang::ASTContext::getTypeSize(), clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::CodeGen::Type.
|
inline |
Definition at line 114 of file ConstantEmitter.h.
Referenced by emitForMemory(), and clang::CodeGen::CodeGenModule::EmitNullConstant().
|
static |
Definition at line 2138 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenModule::EmitNullConstant().
void ConstantEmitter::finalize | ( | llvm::GlobalVariable * | global | ) |
Definition at line 1415 of file CGExprConstant.cpp.
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(), isAbstract(), isTrivialFiller(), and clang::CodeGen::CodeGenModule::isTypeConstant().
llvm::GlobalValue * ConstantEmitter::getCurrentAddrPrivate | ( | ) |
Get the address of the current location.
This is a constant that will resolve, after finalization, to the address of the 'signal' value that is registered with the emitter later.
Definition at line 1260 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getModule(), clang::ASTContext::getTargetAddressSpace(), and clang::CodeGen::CodeGenTypeCache::Int8Ty.
Referenced by emitForMemory().
|
inline |
Is the current emission context abstract?
Definition at line 67 of file ConstantEmitter.h.
References emitAbstract(), emitForInitializer(), finalize(), tryEmitAbstract(), tryEmitAbstractForInitializer(), tryEmitAbstractForMemory(), and tryEmitForInitializer().
|
delete |
Referenced by ConstantEmitter().
void ConstantEmitter::registerCurrentAddrPrivate | ( | llvm::Constant * | signal, |
llvm::GlobalValue * | placeholder | ||
) |
Register a 'signal' value with the emitter to inform it where to resolve a placeholder.
The signal value must be unique in the initializer; it might, for example, be the address of a global that refers to the current-address value in its own initializer.
Uses of the placeholder must be properly anchored before finalizing the emitter, e.g. by being installed as the initializer of a global variable. That is, it must be possible to replaceAllUsesWith the placeholder with the proper address of the signal.
Definition at line 1280 of file CGExprConstant.cpp.
References clang::CodeGen::Base, clang::ast_matchers::expr, clang::CodeGen::CodeGenTypeCache::Int32Ty, and clang::CodeGen::Type.
Referenced by emitForMemory().
Try to emit the result of the given expression as an abstract constant.
Definition at line 1199 of file CGExprConstant.cpp.
References clang::CodeGen::state.
Referenced by EmitCXXNewAllocSize(), and isAbstract().
Definition at line 1206 of file CGExprConstant.cpp.
References clang::CodeGen::state.
llvm::Constant * ConstantEmitter::tryEmitAbstractForInitializer | ( | const VarDecl & | D | ) |
Try to emit the initializer of the given declaration as an abstract constant.
Definition at line 1192 of file CGExprConstant.cpp.
References clang::CodeGen::state.
Referenced by isAbstract(), and tryCaptureAsConstant().
Definition at line 1488 of file CGExprConstant.cpp.
References getNonMemoryType().
Referenced by isAbstract().
Definition at line 1495 of file CGExprConstant.cpp.
References getNonMemoryType().
llvm::Constant * ConstantEmitter::tryEmitForInitializer | ( | const VarDecl & | D | ) |
Try to emit the initiaizer of the given declaration as an abstract constant.
If this succeeds, the emission must be finalized.
Definition at line 1239 of file CGExprConstant.cpp.
References clang::QualType::getAddressSpace(), and clang::ValueDecl::getType().
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(), isAbstract(), isTrivialFiller(), and clang::CodeGen::CodeGenModule::isTypeConstant().
llvm::Constant * ConstantEmitter::tryEmitForInitializer | ( | const Expr * | E, |
LangAS | destAddrSpace, | ||
QualType | destType | ||
) |
Definition at line 1244 of file CGExprConstant.cpp.
Definition at line 1547 of file CGExprConstant.cpp.
References clang::Expr::EvaluateAsLValue(), clang::Expr::EvaluateAsRValue(), clang::CodeGen::CodeGenModule::getContext(), clang::Expr::EvalStatus::HasSideEffects, clang::Type::isReferenceType(), and clang::Expr::EvalResult::Val.
Referenced by emitForMemory().
Definition at line 1867 of file CGExprConstant.cpp.
References clang::APValue::AddrLabelDiff, clang::APValue::Array, Complex, clang::APValue::ComplexFloat, clang::APValue::ComplexInt, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CGCXXABI::EmitMemberPointer(), clang::APValue::Float, clang::APValue::getAddrLabelDiffLHS(), clang::APValue::getAddrLabelDiffRHS(), clang::APValue::getArrayFiller(), clang::APValue::getArrayInitializedElt(), clang::APValue::getArrayInitializedElts(), clang::APValue::getArraySize(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getComplexIntImag(), clang::APValue::getComplexIntReal(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::ArrayType::getElementType(), clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), clang::ASTContext::getLangOpts(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::ASTContext::getTargetInfo(), clang::Expr::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::hasArrayFiller(), Inits, clang::APValue::Int, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::APValue::isFloat(), clang::APValue::isInt(), clang::APValue::LValue, clang::APValue::MemberPointer, clang::APValue::Struct, clang::CodeGen::Type, clang::APValue::Uninitialized, clang::APValue::Union, clang::TargetInfo::useFP16ConversionIntrinsics(), and clang::APValue::Vector.
Definition at line 1502 of file CGExprConstant.cpp.
References getNonMemoryType().
Referenced by emitForMemory().
Definition at line 1509 of file CGExprConstant.cpp.
References getNonMemoryType().
llvm::Constant * ConstantEmitter::tryEmitPrivateForVarInit | ( | const VarDecl & | D | ) |
Definition at line 1445 of file CGExprConstant.cpp.
References clang::CodeGen::CodeGenModule::EmitNullConstant(), clang::VarDecl::evaluateValue(), clang::ASTContext::getBaseElementType(), clang::CodeGen::CodeGenModule::getContext(), clang::VarDecl::getInit(), getNonMemoryType(), clang::ValueDecl::getType(), clang::VarDecl::hasLocalStorage(), clang::CXXConstructorDecl::isDefaultConstructor(), clang::Type::isRecordType(), clang::Type::isReferenceType(), and clang::FunctionDecl::isTrivial().
Referenced by emitForMemory().
CodeGenFunction* clang::CodeGen::ConstantEmitter::CGF |
Definition at line 27 of file ConstantEmitter.h.
CodeGenModule& clang::CodeGen::ConstantEmitter::CGM |
Definition at line 26 of file ConstantEmitter.h.
Referenced by clang::CodeGen::CodeGenModule::getNullPointer().