clang
7.0.0
|
#include "CodeGenFunction.h"
#include "CGCXXABI.h"
#include "CGObjCRuntime.h"
#include "CodeGenModule.h"
#include "ConstantEmitter.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/StmtVisitor.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicInst.h"
Go to the source code of this file.
Enumerations | |
enum | CompareKind { CK_Less, CK_Greater, CK_Equal } |
Functions | |
static bool | isTrivialFiller (Expr *E) |
Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization. More... | |
static Expr * | findPeephole (Expr *op, CastKind kind) |
Attempt to look through various unimportant expressions to find a cast of the given kind. More... | |
static llvm::Value * | EmitCompare (CGBuilderTy &Builder, CodeGenFunction &CGF, const BinaryOperator *E, llvm::Value *LHS, llvm::Value *RHS, CompareKind Kind, const char *NameSuffix="") |
static bool | isBlockVarRef (const Expr *E) |
Is the value of the given expression possibly a reference to or into a __block variable? More... | |
static bool | isSimpleZero (const Expr *E, CodeGenFunction &CGF) |
isSimpleZero - If emitting this value will obviously just cause a store of zero to memory, return true. More... | |
static CharUnits | GetNumNonZeroBytesInInit (const Expr *E, CodeGenFunction &CGF) |
GetNumNonZeroBytesInInit - Get an approximate count of the number of non-zero bytes that will be stored when outputting the initializer for the specified initializer expression. More... | |
static void | CheckAggExprForMemSetUse (AggValueSlot &Slot, const Expr *E, CodeGenFunction &CGF) |
CheckAggExprForMemSetUse - If the initializer is large and has a lot of zeros in it, emit a memset and avoid storing the individual zeros. More... | |
enum CompareKind |
Enumerator | |
---|---|
CK_Less | |
CK_Greater | |
CK_Equal |
Definition at line 885 of file CGExprAgg.cpp.
|
static |
CheckAggExprForMemSetUse - If the initializer is large and has a lot of zeros in it, emit a memset and avoid storing the individual zeros.
Definition at line 1727 of file CGExprAgg.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::CGBuilderTy::CreateMemSet(), clang::CharUnits::fromQuantity(), clang::CodeGen::AggValueSlot::getAddress(), clang::ASTContext::getBaseElementType(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLangOpts(), GetNumNonZeroBytesInInit(), clang::CodeGen::AggValueSlot::getPreferredSize(), clang::CharUnits::getQuantity(), clang::Expr::getType(), clang::CXXRecordDecl::hasUserDeclaredConstructor(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::Address::isValid(), clang::CodeGen::AggValueSlot::isVolatile(), clang::CodeGen::AggValueSlot::isZeroed(), and clang::CodeGen::AggValueSlot::setZeroed().
Referenced by clang::CodeGen::CodeGenFunction::EmitAggExpr().
|
static |
Definition at line 891 of file CGExprAgg.cpp.
References clang::CodeGen::CodeGenFunction::CGM, CK_Equal, clang::CodeGen::CGCXXABI::EmitMemberPointerComparison(), clang::Type::getAs(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::BinaryOperator::getLHS(), and clang::Expr::getType().
Referenced by GetIntrinsic().
Attempt to look through various unimportant expressions to find a cast of the given kind.
Definition at line 660 of file CGExprAgg.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCheckedLValue(), clang::CodeGen::CodeGenFunction::EmitDynamicCast(), clang::CodeGen::CodeGenModule::EmitExplicitCastExprType(), clang::CodeGen::LValue::getAddress(), clang::CastExpr::getCastKind(), clang::CastExpr::getSubExpr(), clang::Expr::IgnoreParens(), clang::CodeGen::LValue::isSimple(), and clang::CodeGen::CodeGenFunction::TCK_Load.
|
static |
GetNumNonZeroBytesInInit - Get an approximate count of the number of non-zero bytes that will be stored when outputting the initializer for the specified initializer expression.
Definition at line 1667 of file CGExprAgg.cpp.
References clang::Expr::IgnoreParens(), isSimpleZero(), and clang::CharUnits::Zero().
Referenced by CheckAggExprForMemSetUse().
Is the value of the given expression possibly a reference to or into a __block variable?
Definition at line 1044 of file CGExprAgg.cpp.
References clang::CodeGen::AggValueSlot::asRValue(), clang::CodeGen::CodeGenFunction::ConditionalEvaluation::begin(), clang::CodeGen::CodeGenFunction::Builder, clang::cast(), clang::CXXInheritedCtorInitExpr::constructsVBase(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitAggExpr(), clang::CodeGen::CodeGenFunction::EmitAtomicStore(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), clang::CodeGen::CodeGenFunction::EmitCheckedLValue(), clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(), clang::CodeGen::CodeGenFunction::EmitCXXTemporary(), clang::CodeGen::CodeGenFunction::EmitInheritedCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitVAArg(), clang::CodeGen::CodeGenFunction::ConditionalEvaluation::end(), clang::CodeGen::CodeGenFunction::ErrorUnsupported(), clang::CodeGen::AggValueSlot::forLValue(), clang::CodeGen::AggValueSlot::getAddress(), clang::ChooseExpr::getChosenSubExpr(), clang::AbstractConditionalOperator::getCond(), clang::CXXInheritedCtorInitExpr::getConstructor(), clang::CodeGen::CodeGenFunction::getContext(), clang::AbstractConditionalOperator::getFalseExpr(), clang::BinaryOperator::getLHS(), clang::CodeGen::CodeGenFunction::getProfileCount(), clang::BinaryOperator::getRHS(), clang::CXXBindTemporaryExpr::getSubExpr(), clang::CXXBindTemporaryExpr::getTemporary(), clang::AbstractConditionalOperator::getTrueExpr(), clang::Expr::getType(), clang::CodeGen::LValue::getType(), clang::Decl::hasAttr(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::HasSideEffects(), clang::CodeGen::CodeGenFunction::hasVolatileMember(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::Expr::IgnoreParens(), clang::CodeGen::CodeGenFunction::incrementProfileCounter(), clang::CXXInheritedCtorInitExpr::inheritedFromVBase(), clang::CodeGen::Address::invalid(), clang::CodeGen::AggValueSlot::IsAliased, clang::Type::isAtomicType(), clang::CodeGen::AggValueSlot::IsDestructed, clang::CodeGen::AggValueSlot::isExternallyDestructed(), clang::CodeGen::Address::isValid(), clang::CodeGen::AggValueSlot::isVolatile(), clang::CodeGen::CodeGenFunction::LValueIsSuitableForInlineAtomic(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::AggValueSlot::MayOverlap, clang::CodeGen::AggValueSlot::setExternallyDestructed(), clang::CodeGen::AggValueSlot::setVolatile(), and clang::CodeGen::CodeGenFunction::TCK_Store.
|
static |
isSimpleZero - If emitting this value will obviously just cause a store of zero to memory, return true.
This can return false if uncertain, so it just handles simple cases.
Definition at line 1286 of file CGExprAgg.cpp.
References clang::Expr::getType(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::Expr::IgnoreParens(), clang::CodeGen::CodeGenTypes::isPointerZeroInitializable(), clang::CodeGen::AggValueSlot::isZeroed(), and clang::CodeGen::CodeGenTypes::isZeroInitializable().
Referenced by GetNumNonZeroBytesInInit().
Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization.
Definition at line 440 of file CGExprAgg.cpp.
References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenFunction::CGM, clang::format::cleanup(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::CodeGenFunction::CreateTempAlloca(), clang::CodeGen::CodeGenFunction::DeactivateCleanupBlock(), clang::QualType::DK_none, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitAggExpr(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::ConstantEmitter::finalize(), clang::QualType::getAddressSpace(), clang::CodeGen::Address::getAlignment(), clang::InitListExpr::getArrayFiller(), clang::ASTContext::getAsArrayType(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::ArrayType::getElementType(), clang::InitListExpr::getInit(), clang::CompoundLiteralExpr::getInitializer(), clang::CodeGen::CodeGenModule::getModule(), clang::InitListExpr::getNumInits(), clang::CodeGen::CodeGenFunction::getOrCreateOpaqueLValueMapping(), clang::CodeGen::Address::getPointer(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::CharUnits::getQuantity(), clang::OpaqueValueExpr::getSourceExpr(), clang::ASTContext::getTargetAddressSpace(), clang::MaterializeTemporaryExpr::GetTemporaryExpr(), clang::Expr::getType(), clang::ASTContext::getTypeAlignInChars(), clang::CodeGen::CodeGenFunction::getTypes(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::Address::invalid(), clang::QualType::isDestructedType(), clang::QualType::isPODType(), clang::CodeGen::AggValueSlot::isPotentiallyAliased(), clang::QualType::isTriviallyCopyableType(), clang::CodeGen::CodeGenModule::isTypeConstant(), clang::OpaqueValueExpr::isUnique(), clang::CodeGen::Address::isValid(), clang::CodeGen::AggValueSlot::isZeroed(), clang::CodeGen::CodeGenTypes::isZeroInitializable(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::needsEHCleanup(), clang::CodeGen::CodeGenFunction::pushIrregularPartialArrayCleanup(), clang::CodeGen::CodeGenTypeCache::SizeTy, clang::CodeGen::EHScopeStack::stable_begin(), and clang::CodeGen::ConstantEmitter::tryEmitForInitializer().