aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-14 01:29:45 +0000
committerChris Lattner <sabre@nondot.org>2007-07-14 01:29:45 +0000
commitd2d2a11a91d7ddf468bfb70f66362d24806ed601 (patch)
tree1920f1ccb6fc00b05bbd9d884dd821601d906626 /CodeGen/CodeGenModule.cpp
parent8f32f7189b12f67aa4a19bc7c3855b599980eca0 (diff)
A significant refactoring of the type size stuff to also
compute type alignment. This info is needed for struct layout. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenModule.cpp')
-rw-r--r--CodeGen/CodeGenModule.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp
index d091dd73eb..262469e34b 100644
--- a/CodeGen/CodeGenModule.cpp
+++ b/CodeGen/CodeGenModule.cpp
@@ -26,7 +26,7 @@ using namespace CodeGen;
CodeGenModule::CodeGenModule(ASTContext &C, llvm::Module &M)
- : Context(C), TheModule(M), Types(C.Target) {}
+ : Context(C), TheModule(M), Types(C) {}
llvm::Constant *CodeGenModule::GetAddrOfGlobalDecl(const Decl *D) {
// See if it is already in the map.
@@ -68,7 +68,8 @@ void CodeGenModule::EmitGlobalVar(const FileVarDecl *D) {
if (D->getInit() == 0) {
Init = llvm::Constant::getNullValue(GV->getType()->getElementType());
} else if (D->getType()->isIntegerType()) {
- llvm::APSInt Value(getContext().getTypeSize(D->getInit()->getType()));
+ llvm::APSInt Value(getContext().getTypeSize(D->getInit()->getType(),
+ SourceLocation()));
if (D->getInit()->isIntegerConstantExpr(Value))
Init = llvm::ConstantInt::get(Value);
}
@@ -103,7 +104,9 @@ void CodeGenModule::EmitGlobalVarDeclarator(const FileVarDecl *D) {
llvm::Function *CodeGenModule::getMemCpyFn() {
if (MemCpyFn) return MemCpyFn;
llvm::Intrinsic::ID IID;
- switch (Context.Target.getPointerWidth(SourceLocation())) {
+ uint64_t Size; unsigned Align;
+ Context.Target.getPointerInfo(Size, Align, SourceLocation());
+ switch (Size) {
default: assert(0 && "Unknown ptr width");
case 32: IID = llvm::Intrinsic::memcpy_i32; break;
case 64: IID = llvm::Intrinsic::memcpy_i64; break;