clang  6.0.0svn
Functions
CGExprAgg.cpp File Reference
#include "CodeGenFunction.h"
#include "CGObjCRuntime.h"
#include "CodeGenModule.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 dependency graph for CGExprAgg.cpp:

Go to the source code of this file.

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 ExprfindPeephole (Expr *op, CastKind kind)
 Attempt to look through various unimportant expressions to find a cast of the given kind. More...
 
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...
 

Function Documentation

◆ CheckAggExprForMemSetUse()

static void CheckAggExprForMemSetUse ( AggValueSlot Slot,
const Expr E,
CodeGenFunction CGF 
)
static

◆ findPeephole()

static Expr* findPeephole ( Expr op,
CastKind  kind 
)
static

◆ GetNumNonZeroBytesInInit()

static CharUnits GetNumNonZeroBytesInInit ( const Expr E,
CodeGenFunction CGF 
)
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 1419 of file CGExprAgg.cpp.

References clang::Expr::IgnoreParens(), isSimpleZero(), and clang::CharUnits::Zero().

Referenced by CheckAggExprForMemSetUse().

◆ isBlockVarRef()

static bool isBlockVarRef ( const Expr E)
static

Is the value of the given expression possibly a reference to or into a __block variable?

Definition at line 799 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::setExternallyDestructed(), clang::CodeGen::AggValueSlot::setVolatile(), and clang::CodeGen::CodeGenFunction::TCK_Store.

◆ isSimpleZero()

static bool isSimpleZero ( const Expr E,
CodeGenFunction CGF 
)
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 1039 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().

◆ isTrivialFiller()

static bool isTrivialFiller ( Expr E)
static

Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization.

Definition at line 372 of file CGExprAgg.cpp.

References clang::CharUnits::alignmentOfArrayElement(), 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::Address::getAlignment(), clang::InitListExpr::getArrayFiller(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::InitListExpr::getInit(), clang::CompoundLiteralExpr::getInitializer(), clang::InitListExpr::getNumInits(), clang::CodeGen::CodeGenFunction::getOpaqueLValueMapping(), clang::CodeGen::Address::getPointer(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::MaterializeTemporaryExpr::GetTemporaryExpr(), clang::Expr::getType(), clang::CodeGen::CodeGenFunction::getTypes(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::Address::invalid(), clang::QualType::isDestructedType(), clang::QualType::isPODType(), clang::CodeGen::AggValueSlot::isPotentiallyAliased(), 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, and clang::CodeGen::EHScopeStack::stable_begin().