aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/DerivedTypes.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-08-27 15:49:16 +0000
committerChris Lattner <sabre@nondot.org>2001-08-27 15:49:16 +0000
commit231022954fbdc6514814af6721eb81b229325a49 (patch)
treea0b7ffaad2d55f3aa41ccd031e474488de4fd99a /include/llvm/DerivedTypes.h
parentda8f004cdbf268d4906f0e42e21b76f1da6beb91 (diff)
downloadexternal_llvm-231022954fbdc6514814af6721eb81b229325a49.zip
external_llvm-231022954fbdc6514814af6721eb81b229325a49.tar.gz
external_llvm-231022954fbdc6514814af6721eb81b229325a49.tar.bz2
Remove target specific code, move to TargetData.cpp file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/DerivedTypes.h')
-rw-r--r--include/llvm/DerivedTypes.h51
1 files changed, 1 insertions, 50 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 6b3fd1f..eae4b73 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -12,12 +12,10 @@
#define LLVM_DERIVED_TYPES_H
#include "llvm/Type.h"
-#include "llvm/CodeGen/TargetMachine.h"
#include <vector>
// Future derived types: SIMD packed format
-
class MethodType : public Type {
public:
typedef vector<const Type*> ParamTypes;
@@ -87,13 +85,7 @@ public:
private:
ElementTypes ETypes;
- struct StructSizeAndOffsetInfo {
- int storageSize; // -1 until the value is computd
- vector<int> memberOffsets; // -1 until values are computed
- const TargetMachine* targetInfo;
- } *layoutCache;
-
-private:
+
StructType(const StructType &); // Do not implement
const StructType &operator=(const StructType &); // Do not implement
@@ -105,53 +97,12 @@ protected:
// Private ctor - Only can be created by a static member...
StructType(const vector<const Type*> &Types, const string &Name);
- // Reset cached info so it will be computed when first requested
- void ResetCachedInfo() const {
- layoutCache->storageSize = -1;
- layoutCache->memberOffsets.insert(layoutCache->memberOffsets.begin(),
- ETypes.size(), -1);
- layoutCache->targetInfo = 0;
- }
-
public:
inline const ElementTypes &getElementTypes() const { return ETypes; }
static const StructType *getStructType(const ElementTypes &Params);
static const StructType *get(const ElementTypes &Params) {
return getStructType(Params);
}
-
-
- unsigned int 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 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];
- }
};