//===-- TargetData.cpp - Data size & alignment routines --------------------==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file defines target properties related to datatype size/offset/alignment
// information. It uses lazy annotations to cache information about how
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
-// Handle the Pass registration stuff neccesary to use TargetData's.
+// Handle the Pass registration stuff necessary to use TargetData's.
namespace {
// Register the default SparcV9 implementation...
RegisterPass<TargetData> X("targetdata", "Target Data Layout");
getTypeInfo(Ty, &TD, TySize, A);
TyAlign = A;
- // Add padding if neccesary to make the data element aligned properly...
+ // Add padding if necessary to make the data element aligned properly...
if (StructSize % TyAlign != 0)
StructSize = (StructSize/TyAlign + 1) * TyAlign; // Add padding...
void *D) {
const TargetData &TD = *(const TargetData*)D;
assert(AID == TD.AID && "Target data annotation ID mismatch!");
- const Type *Ty = cast<const Type>((const Value *)T);
+ const Type *Ty = cast<Type>((const Value *)T);
assert(isa<StructType>(Ty) &&
"Can only create StructLayout annotation on structs!");
- return new StructLayout((const StructType *)Ty, TD);
+ return new StructLayout(cast<StructType>(Ty), TD);
}
//===----------------------------------------------------------------------===//
: AID(AnnotationManager::getID("TargetData::" + ToolName)) {
AnnotationManager::registerAnnotationFactory(AID, TypeAnFactory, this);
- LittleEndian = M->isLittleEndian();
- PointerSize = M->has32BitPointers() ? 4 : 8;
+ LittleEndian = M->getEndianness() != Module::BigEndian;
+ PointerSize = M->getPointerSize() != Module::Pointer64 ? 4 : 8;
PointerAlignment = PointerSize;
DoubleAlignment = PointerSize;
FloatAlignment = 4;