#include "Support/STLExtras.h"
#include <algorithm>
-namespace llvm {
+using namespace llvm;
// DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are
// created and later destroyed, all in an effort to make sure that there is only
// created on any given run of the compiler... note that this involves updating
// our map if an abstract type gets refined somehow...
//
+namespace llvm {
template<class ValType, class TypeClass>
class TypeMap {
typedef std::map<ValType, TypeClass *> MapTy;
void dump() const { print("dump output"); }
};
-
+}
//===----------------------------------------------------------------------===//
// FunctionValType - Define a class to hold the key that goes into the TypeMap
//
+namespace llvm {
class FunctionValType {
const Type *RetTy;
std::vector<const Type*> ArgTypes;
return ArgTypes == MTV.ArgTypes && isVarArg < MTV.isVarArg;
}
};
+}
// Define the actual map itself now...
static TypeMap<FunctionValType, FunctionType> FunctionTypes;
//===----------------------------------------------------------------------===//
// Array Type Factory...
//
+namespace llvm {
class ArrayValType {
const Type *ValTy;
unsigned Size;
return Size == MTV.Size && ValTy < MTV.ValTy;
}
};
-
+}
static TypeMap<ArrayValType, ArrayType> ArrayTypes;
// Struct Type Factory...
//
+namespace llvm {
// StructValType - Define a class to hold the key that goes into the TypeMap
//
class StructValType {
return ElTypes < STV.ElTypes;
}
};
+}
static TypeMap<StructValType, StructType> StructTypes;
// PointerValType - Define a class to hold the key that goes into the TypeMap
//
+namespace llvm {
class PointerValType {
const Type *ValTy;
public:
return ValTy < MTV.ValTy;
}
};
+}
static TypeMap<PointerValType, PointerType> PointerTypes;
return PT;
}
+namespace llvm {
void debug_type_tables() {
FunctionTypes.dump();
ArrayTypes.dump();
StructTypes.dump();
PointerTypes.dump();
}
-
+}
//===----------------------------------------------------------------------===//
// Derived Type Refinement Functions
void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
refineAbstractType(AbsTy, AbsTy);
}
-
-} // End llvm namespace