Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size

of LLVM types in character units.

llvm-svn: 94542
This commit is contained in:
Ken Dyck
2010-01-26 13:48:07 +00:00
parent de018dcfad
commit 98ca79435a
4 changed files with 16 additions and 7 deletions

View File

@@ -20,6 +20,7 @@
#include "TargetInfo.h"
#include "clang/CodeGen/CodeGenOptions.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/RecordLayout.h"
@@ -968,6 +969,11 @@ GetLinkageForVariable(ASTContext &Context, const VarDecl *VD) {
return CodeGenModule::GVA_StrongExternal;
}
CharUnits CodeGenModule::GetTargetTypeStoreSize(const llvm::Type *Ty) const {
return CharUnits::fromQuantity(
TheTargetData.getTypeStoreSizeInBits(Ty) / Context.getCharWidth());
}
void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
llvm::Constant *Init = 0;
QualType ASTTy = D->getType();