clang API Documentation
#include "CodeGenFunction.h"
#include "CGDebugInfo.h"
#include "CGOpenCLRuntime.h"
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.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"
Go to the source code of this file.
Functions | |
static std::string | getStaticDeclName (CodeGenModule &CGM, const VarDecl &D) |
static bool | hasNontrivialDestruction (QualType T) |
static void | EmitAutoVarWithLifetime (CodeGenFunction &CGF, const VarDecl &var, llvm::Value *addr, Qualifiers::ObjCLifetime lifetime) |
static bool | isAccessedBy (const VarDecl &var, const Stmt *s) |
static bool | isAccessedBy (const ValueDecl *decl, const Expr *e) |
static void | drillIntoBlockVariable (CodeGenFunction &CGF, LValue &lvalue, const VarDecl *var) |
static bool | canEmitInitWithFewStoresAfterMemset (llvm::Constant *Init, unsigned &NumStores) |
static void | emitStoresForInitAfterMemset (llvm::Constant *Init, llvm::Value *Loc, bool isVolatile, CGBuilderTy &Builder) |
static bool | shouldUseMemSetPlusStoresToInitialize (llvm::Constant *Init, uint64_t GlobalSize) |
static bool | shouldUseLifetimeMarkers (CodeGenFunction &CGF, const VarDecl &D, unsigned Size) |
Should we use the LLVM lifetime intrinsics for the given local variable? | |
static bool | isCapturedBy (const VarDecl &var, const Expr *e) |
static void | emitPartialArrayDestroy (CodeGenFunction &CGF, llvm::Value *begin, llvm::Value *end, QualType type, CodeGenFunction::Destroyer *destroyer) |
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 740 of file CGDecl.cpp.
Referenced by shouldUseMemSetPlusStoresToInitialize().
static void drillIntoBlockVariable | ( | CodeGenFunction & | CGF, |
LValue & | lvalue, | ||
const VarDecl * | var | ||
) | [static] |
Definition at line 593 of file CGDecl.cpp.
References clang::CodeGen::CodeGenFunction::BuildBlockByrefAddress(), clang::CodeGen::LValue::getAddress(), and clang::CodeGen::LValue::setAddress().
Referenced by clang::CodeGen::CodeGenFunction::EmitExprAsInit(), and clang::CodeGen::CodeGenFunction::EmitScalarInit().
static void EmitAutoVarWithLifetime | ( | CodeGenFunction & | CGF, |
const VarDecl & | var, | ||
llvm::Value * | addr, | ||
Qualifiers::ObjCLifetime | lifetime | ||
) | [static] |
EmitAutoVarWithLifetime - Does the setup required for an automatic variable with lifetime.
Definition at line 525 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::ValueDecl::getType(), clang::Decl::hasAttr(), 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().
Referenced by clang::CodeGen::CodeGenFunction::EmitParmDecl().
static void emitPartialArrayDestroy | ( | CodeGenFunction & | CGF, |
llvm::Value * | begin, | ||
llvm::Value * | end, | ||
QualType | type, | ||
CodeGenFunction::Destroyer * | destroyer | ||
) | [static] |
Perform partial array destruction as if in an EH cleanup. Unlike emitArrayDestroy, the element type here may still be an array type.
Definition at line 1502 of file CGDecl.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::emitArrayDestroy(), clang::ASTContext::getAsArrayType(), clang::CodeGen::CodeGenFunction::getContext(), and clang::CodeGen::CodeGenTypeCache::SizeTy.
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 779 of file CGDecl.cpp.
References Builder.
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().
static std::string getStaticDeclName | ( | CodeGenModule & | CGM, |
const VarDecl & | D | ||
) | [static] |
Definition at line 149 of file CGDecl.cpp.
References clang::CodeGen::CodeGenModule::getBlockMangledName(), clang::Decl::getDeclContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::NamedDecl::getNameAsString(), and clang::NamedDecl::isExternallyVisible().
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit(), and clang::CodeGen::CodeGenModule::getOrCreateStaticVarDecl().
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 263 of file CGDecl.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), and clang::CXXRecordDecl::hasTrivialDestructor().
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl().
static bool isAccessedBy | ( | const VarDecl & | var, |
const Stmt * | s | ||
) | [static] |
Definition at line 561 of file CGDecl.cpp.
References clang::BlockDecl::captures(), and clang::Stmt::children().
Referenced by clang::CodeGen::CodeGenFunction::EmitScalarInit(), and isAccessedBy().
static bool isAccessedBy | ( | const ValueDecl * | decl, |
const Expr * | e | ||
) | [static] |
Definition at line 586 of file CGDecl.cpp.
References clang::ast_matchers::decl, and isAccessedBy().
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 1023 of file CGDecl.cpp.
References clang::CompoundStmt::body(), clang::BlockDecl::captures(), clang::Stmt::children(), and clang::Expr::IgnoreParenCasts().
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().
static bool shouldUseLifetimeMarkers | ( | CodeGenFunction & | CGF, |
const VarDecl & | D, | ||
unsigned | Size | ||
) | [static] |
Should we use the LLVM lifetime intrinsics for the given local variable?
Definition at line 839 of file CGDecl.cpp.
References clang::CodeGen::CodeGenFunction::CGM, and clang::CodeGen::CodeGenModule::getCodeGenOpts().
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca().
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 822 of file CGDecl.cpp.
References canEmitInitWithFewStoresAfterMemset().
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarInit().