clang  6.0.0svn
Functions
CGDecl.cpp File Reference
#include "CGBlocks.h"
#include "CGCXXABI.h"
#include "CGCleanup.h"
#include "CGDebugInfo.h"
#include "CGOpenCLRuntime.h"
#include "CGOpenMPRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "ConstantEmitter.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Type.h"
Include dependency graph for CGDecl.cpp:

Go to the source code of this file.

Functions

static std::string getStaticDeclName (CodeGenModule &CGM, const VarDecl &D)
 
static bool hasNontrivialDestruction (QualType T)
 hasNontrivialDestruction - Determine whether a type's destruction is non-trivial. More...
 
static void EmitAutoVarWithLifetime (CodeGenFunction &CGF, const VarDecl &var, Address addr, Qualifiers::ObjCLifetime lifetime)
 EmitAutoVarWithLifetime - Does the setup required for an automatic variable with lifetime. More...
 
static bool isAccessedBy (const VarDecl &var, const Stmt *s)
 
static bool isAccessedBy (const ValueDecl *decl, const Expr *e)
 
static bool tryEmitARCCopyWeakInit (CodeGenFunction &CGF, const LValue &destLV, const Expr *init)
 
static void drillIntoBlockVariable (CodeGenFunction &CGF, LValue &lvalue, const VarDecl *var)
 
static bool canEmitInitWithFewStoresAfterMemset (llvm::Constant *Init, unsigned &NumStores)
 canEmitInitWithFewStoresAfterMemset - Decide whether we can emit the non-zero parts of the specified initializer with equal or fewer than NumStores scalar stores. More...
 
static void emitStoresForInitAfterMemset (llvm::Constant *Init, llvm::Value *Loc, bool isVolatile, CGBuilderTy &Builder)
 emitStoresForInitAfterMemset - For inits that canEmitInitWithFewStoresAfterMemset returned true for, emit the scalar stores that would be required. More...
 
static bool shouldUseMemSetPlusStoresToInitialize (llvm::Constant *Init, uint64_t GlobalSize)
 shouldUseMemSetPlusStoresToInitialize - Decide whether we should use memset plus some stores to initialize a local variable instead of using a memcpy from a constant global. More...
 
static bool isCapturedBy (const VarDecl &var, const Expr *e)
 Determines whether the given __block variable is potentially captured by the given expression. More...
 
static void emitPartialArrayDestroy (CodeGenFunction &CGF, llvm::Value *begin, llvm::Value *end, QualType type, CharUnits elementAlign, CodeGenFunction::Destroyer *destroyer)
 Perform partial array destruction as if in an EH cleanup. More...
 

Function Documentation

◆ canEmitInitWithFewStoresAfterMemset()

static bool canEmitInitWithFewStoresAfterMemset ( llvm::Constant *  Init,
unsigned &  NumStores 
)
static

canEmitInitWithFewStoresAfterMemset - Decide whether we can emit the non-zero parts of the specified initializer with equal or fewer than NumStores scalar stores.

Definition at line 827 of file CGDecl.cpp.

Referenced by shouldUseMemSetPlusStoresToInitialize().

◆ drillIntoBlockVariable()

static void drillIntoBlockVariable ( CodeGenFunction CGF,
LValue lvalue,
const VarDecl var 
)
static

◆ EmitAutoVarWithLifetime()

static void EmitAutoVarWithLifetime ( CodeGenFunction CGF,
const VarDecl var,
Address  addr,
Qualifiers::ObjCLifetime  lifetime 
)
static

◆ emitPartialArrayDestroy()

static void emitPartialArrayDestroy ( CodeGenFunction CGF,
llvm::Value begin,
llvm::Value end,
QualType  type,
CharUnits  elementAlign,
CodeGenFunction::Destroyer *  destroyer 
)
static

◆ emitStoresForInitAfterMemset()

static void emitStoresForInitAfterMemset ( llvm::Constant *  Init,
llvm::Value Loc,
bool  isVolatile,
CGBuilderTy Builder 
)
static

emitStoresForInitAfterMemset - For inits that canEmitInitWithFewStoresAfterMemset returned true for, emit the scalar stores that would be required.

Definition at line 866 of file CGDecl.cpp.

References clang::CodeGen::CGBuilderTy::CreateDefaultAlignedStore().

Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().

◆ getStaticDeclName()

static std::string getStaticDeclName ( CodeGenModule CGM,
const VarDecl D 
)
static

◆ hasNontrivialDestruction()

static bool hasNontrivialDestruction ( QualType  T)
static

hasNontrivialDestruction - Determine whether a type's destruction is non-trivial.

If so, and the variable uses static initialization, we must register its destructor to run on exit.

Definition at line 303 of file CGDecl.cpp.

References clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), and clang::CXXRecordDecl::hasTrivialDestructor().

Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl().

◆ isAccessedBy() [1/2]

static bool isAccessedBy ( const VarDecl var,
const Stmt s 
)
static

Definition at line 604 of file CGDecl.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitScalarInit(), and isAccessedBy().

◆ isAccessedBy() [2/2]

static bool isAccessedBy ( const ValueDecl decl,
const Expr e 
)
static

Definition at line 629 of file CGDecl.cpp.

References clang::ast_matchers::decl, and isAccessedBy().

◆ isCapturedBy()

static bool isCapturedBy ( const VarDecl var,
const Expr e 
)
static

Determines whether the given __block variable is potentially captured by the given expression.

Definition at line 1148 of file CGDecl.cpp.

References clang::Expr::IgnoreParenCasts().

Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().

◆ shouldUseMemSetPlusStoresToInitialize()

static bool shouldUseMemSetPlusStoresToInitialize ( llvm::Constant *  Init,
uint64_t  GlobalSize 
)
static

shouldUseMemSetPlusStoresToInitialize - Decide whether we should use memset plus some stores to initialize a local variable instead of using a memcpy from a constant global.

It is beneficial to use memset if the global is all zeros, or mostly zeros and large.

Definition at line 910 of file CGDecl.cpp.

References canEmitInitWithFewStoresAfterMemset().

Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().

◆ tryEmitARCCopyWeakInit()

static bool tryEmitARCCopyWeakInit ( CodeGenFunction CGF,
const LValue destLV,
const Expr init 
)
static