*** empty log message ***

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-08-28 22:35:21 +00:00
parent 71fc67c4b1
commit 402ace79fc

View File

@ -6,6 +6,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Support/StringExtras.h"
#include "llvm/CodeGen/TargetMachine.h"
//===----------------------------------------------------------------------===//
// Type Class Implementation
@ -138,6 +139,49 @@ const Type *Type::VoidTy = new Type("void" , VoidTyID),
#include "llvm/Assembly/Writer.h"
#endif
#undef RESURRECT_OLD_LAYOUT_CODE
#ifdef RESURRECT_OLD_LAYOUT_CODE
unsigned int
StructType::getStorageSize(const TargetMachine& tmi) const
{
if (layoutCache->targetInfo && layoutCache->targetInfo != &tmi)
{// target machine has changed (hey it could happen). discard cached info.
ResetCachedInfo();
layoutCache->targetInfo = &tmi;
}
if (layoutCache->storageSize < 0) {
layoutCache->storageSize = tmi.findOptimalStorageSize(this);
assert(layoutCache->storageSize >= 0);
}
return layoutCache->storageSize;
}
unsigned int
StructType::getElementOffset(int i, const TargetMachine& tmi) const
{
// target machine has changed (hey it could happen). discard cached info.
if (layoutCache->targetInfo && layoutCache->targetInfo != &tmi)
ResetCachedInfo();
if (layoutCache->memberOffsets[i] < 0) {
layoutCache->targetInfo = &tmi; // remember which target was used
unsigned int *offsetVec = tmi.findOptimalMemberOffsets(this);
for (unsigned i=0, N=layoutCache->memberOffsets.size(); i < N; ++i) {
layoutCache->memberOffsets[i] = offsetVec[i];
assert(layoutCache->memberOffsets[i] >= 0);
}
delete[] offsetVec;
}
return layoutCache->memberOffsets[i];
}
#endif
//===----------------------------------------------------------------------===//
// Derived Type Constructors
//===----------------------------------------------------------------------===//