clang: lib/CodeGen/CGDecl.cpp File Reference (original) (raw)
#include "[CGBlocks.h](CGBlocks%5F8h%5Fsource.html)"
#include "[CGCXXABI.h](CGCXXABI%5F8h%5Fsource.html)"
#include "[CGCleanup.h](CGCleanup%5F8h%5Fsource.html)"
#include "[CGDebugInfo.h](CGDebugInfo%5F8h%5Fsource.html)"
#include "[CGOpenCLRuntime.h](CGOpenCLRuntime%5F8h%5Fsource.html)"
#include "[CGOpenMPRuntime.h](CGOpenMPRuntime%5F8h%5Fsource.html)"
#include "[CodeGenFunction.h](CodeGenFunction%5F8h%5Fsource.html)"
#include "[CodeGenModule.h](CodeGenModule%5F8h%5Fsource.html)"
#include "[ConstantEmitter.h](ConstantEmitter%5F8h%5Fsource.html)"
#include "[EHScopeStack.h](EHScopeStack%5F8h%5Fsource.html)"
#include "[PatternInit.h](PatternInit%5F8h%5Fsource.html)"
#include "[TargetInfo.h](lib%5F2CodeGen%5F2TargetInfo%5F8h%5Fsource.html)"
#include "[clang/AST/ASTContext.h](ASTContext%5F8h%5Fsource.html)"
#include "[clang/AST/Attr.h](AST%5F2Attr%5F8h%5Fsource.html)"
#include "[clang/AST/CharUnits.h](CharUnits%5F8h%5Fsource.html)"
#include "[clang/AST/Decl.h](Decl%5F8h%5Fsource.html)"
#include "[clang/AST/DeclObjC.h](DeclObjC%5F8h%5Fsource.html)"
#include "[clang/AST/DeclOpenMP.h](DeclOpenMP%5F8h%5Fsource.html)"
#include "[clang/Basic/CodeGenOptions.h](CodeGenOptions%5F8h%5Fsource.html)"
#include "[clang/Basic/TargetInfo.h](include%5F2clang%5F2Basic%5F2TargetInfo%5F8h%5Fsource.html)"
#include "[clang/CodeGen/CGFunctionInfo.h](CGFunctionInfo%5F8h%5Fsource.html)"
#include "[clang/Sema/Sema.h](Sema%5F8h%5Fsource.html)"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Type.h"
#include <optional>
Go to the source code of this file.
Functions | |
---|---|
static std::string | getStaticDeclName (CodeGenModule &CGM, const VarDecl &D) |
static void | EmitAutoVarWithLifetime (CodeGenFunction &CGF, const VarDecl &var, Address addr, Qualifiers::ObjCLifetime lifetime) |
EmitAutoVarWithLifetime - Does the setup required for an automatic variable with lifetime. | |
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 | canEmitInitWithFewStoresAfterBZero (llvm::Constant *Init, unsigned &NumStores) |
Decide whether we can emit the non-zero parts of the specified initializer with equal or fewer than NumStores scalar stores. | |
static void | emitStoresForInitAfterBZero (CodeGenModule &CGM, llvm::Constant *Init, Address Loc, bool isVolatile, CGBuilderTy &Builder, bool IsAutoInit) |
For inits that canEmitInitWithFewStoresAfterBZero returned true for, emit the scalar stores that would be required. | |
static bool | shouldUseBZeroPlusStoresToInitialize (llvm::Constant *Init, uint64_t GlobalSize) |
Decide whether we should use bzero plus some stores to initialize a local variable instead of using a memcpy from a constant global. | |
static llvm::Value * | shouldUseMemSetToInitialize (llvm::Constant *Init, uint64_t GlobalSize, const llvm::DataLayout &DL) |
Decide whether we should use memset to initialize a local variable instead of using a memcpy from a constant global. | |
static bool | shouldSplitConstantStore (CodeGenModule &CGM, uint64_t GlobalByteSize) |
Decide whether we want to split a constant structure or array store into a sequence of its fields' stores. | |
static llvm::Constant * | patternOrZeroFor (CodeGenModule &CGM, IsPattern isPattern, llvm::Type *Ty) |
Generate a constant filled with either a pattern or zeroes. | |
static llvm::Constant * | constWithPadding (CodeGenModule &CGM, IsPattern isPattern, llvm::Constant *constant) |
Replace all padding bytes in a given constant with either a pattern byte or 0x00. | |
static llvm::Constant * | constStructWithPadding (CodeGenModule &CGM, IsPattern isPattern, llvm::StructType *STy, llvm::Constant *constant) |
Helper function for constWithPadding() to deal with padding in structures. | |
static Address | createUnnamedGlobalForMemcpyFrom (CodeGenModule &CGM, const VarDecl &D, CGBuilderTy &Builder, llvm::Constant *Constant, CharUnits Align) |
static void | emitStoresForConstant (CodeGenModule &CGM, const VarDecl &D, Address Loc, bool isVolatile, CGBuilderTy &Builder, llvm::Constant *constant, bool IsAutoInit) |
static void | emitStoresForZeroInit (CodeGenModule &CGM, const VarDecl &D, Address Loc, bool isVolatile, CGBuilderTy &Builder) |
static void | emitStoresForPatternInit (CodeGenModule &CGM, const VarDecl &D, Address Loc, bool isVolatile, CGBuilderTy &Builder) |
static bool | containsUndef (llvm::Constant *constant) |
static llvm::Constant * | replaceUndef (CodeGenModule &CGM, IsPattern isPattern, llvm::Constant *constant) |
static bool | isCapturedBy (const VarDecl &Var, const Expr *E) |
Determines whether the given __block variable is potentially captured by the given expression. | |
static bool | isCapturedBy (const VarDecl &Var, const Stmt *S) |
Determines whether the given __block variable is potentially captured by the given statement. | |
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. | |
◆ IsPattern
◆ canEmitInitWithFewStoresAfterBZero()
static bool canEmitInitWithFewStoresAfterBZero ( llvm::Constant * Init, unsigned & NumStores ) | static |
---|
◆ constStructWithPadding()
static llvm::Constant * constStructWithPadding ( CodeGenModule & CGM, IsPattern isPattern, llvm::StructType * STy, llvm::Constant * constant ) | static |
---|
◆ constWithPadding()
static llvm::Constant * constWithPadding ( CodeGenModule & CGM, IsPattern isPattern, llvm::Constant * constant ) | static |
---|
◆ containsUndef()
static bool containsUndef ( llvm::Constant * constant) | static |
---|
◆ createUnnamedGlobalForMemcpyFrom()
◆ drillIntoBlockVariable()
◆ EmitAutoVarWithLifetime()
EmitAutoVarWithLifetime - Does the setup required for an automatic variable with lifetime.
Definition at line 626 of file CGDecl.cpp.
References clang::CodeGen::CodeGenFunction::destroyARCStrongImprecise, clang::CodeGen::CodeGenFunction::destroyARCStrongPrecise, clang::CodeGen::CodeGenFunction::destroyARCWeak, clang::CodeGen::EHCleanup, clang::CodeGen::CodeGenFunction::getARCCleanupKind(), clang::CodeGen::NormalAndEHCleanup, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, and clang::CodeGen::CodeGenFunction::pushDestroy().
◆ emitPartialArrayDestroy()
◆ emitStoresForConstant()
Definition at line 1167 of file CGDecl.cpp.
References createUnnamedGlobalForMemcpyFrom(), D, emitStoresForConstant(), emitStoresForInitAfterBZero(), clang::CharUnits::fromQuantity(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getDataLayout(), clang::ASTContext::getLangOpts(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntPtrTy, Loc, clang::LangOptionsBase::Pattern, shouldSplitConstantStore(), shouldUseBZeroPlusStoresToInitialize(), and shouldUseMemSetToInitialize().
Referenced by emitStoresForConstant(), emitStoresForPatternInit(), and emitStoresForZeroInit().
◆ emitStoresForInitAfterBZero()
◆ emitStoresForPatternInit()
◆ emitStoresForZeroInit()
◆ getStaticDeclName()
◆ isAccessedBy() [1/2]
◆ isAccessedBy() [2/2]
◆ isCapturedBy() [1/2]
◆ isCapturedBy() [2/2]
Determines whether the given __block variable is potentially captured by the given statement.
Definition at line 1676 of file CGDecl.cpp.
References E, and isCapturedBy().
◆ patternOrZeroFor()
◆ replaceUndef()
static llvm::Constant * replaceUndef ( CodeGenModule & CGM, IsPattern isPattern, llvm::Constant * constant ) | static |
---|
◆ shouldSplitConstantStore()
static bool shouldSplitConstantStore ( CodeGenModule & CGM, uint64_t GlobalByteSize ) | static |
---|
◆ shouldUseBZeroPlusStoresToInitialize()
static bool shouldUseBZeroPlusStoresToInitialize ( llvm::Constant * Init, uint64_t GlobalSize ) | static |
---|
◆ shouldUseMemSetToInitialize()
static llvm::Value * shouldUseMemSetToInitialize ( llvm::Constant * Init, uint64_t GlobalSize, const llvm::DataLayout & DL ) | static |
---|
Decide whether we should use memset to initialize a local variable instead of using a memcpy from a constant global.
Assumes we've already decided to not user bzero. FIXME We could be more clever, as we are for bzero above, and generate memset followed by stores. It's unclear that's worth the effort.
Definition at line 994 of file CGDecl.cpp.
References clang::Init.
Referenced by emitStoresForConstant().
◆ tryEmitARCCopyWeakInit()
Definition at line 694 of file CGDecl.cpp.
References clang::ast_matchers::castExpr, clang::CodeGen::CodeGenFunction::EmitARCCopyWeak(), clang::CodeGen::CodeGenFunction::EmitARCMoveWeak(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::Address::getElementType(), clang::QualType::getObjCLifetime(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Expr::isLValue(), clang::Expr::isXValue(), clang::Qualifiers::OCL_Weak, and clang::CodeGen::Address::withElementType().