summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorKen Dyck <ken.dyck@onsemi.com>2010-01-26 13:48:07 +0000
committerKen Dyck <ken.dyck@onsemi.com>2010-01-26 13:48:07 +0000
commit98ca79435a2829b7486a316ad7b12a087472e87d (patch)
tree9fdca667bed17f35e0a0d0e4c4bdf003faa042db /clang/lib/CodeGen/CodeGenModule.cpp
parentde018dcfad6adda3687effec3d9ea86f246e4a14 (diff)
downloadbcm5719-llvm-98ca79435a2829b7486a316ad7b12a087472e87d.tar.gz
bcm5719-llvm-98ca79435a2829b7486a316ad7b12a087472e87d.zip
Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units. llvm-svn: 94542
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 65b29313c60..4eb8bd8d9ff 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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();
OpenPOWER on IntegriCloud