aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantsContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/ConstantsContext.h')
-rw-r--r--lib/VMCore/ConstantsContext.h31
1 files changed, 12 insertions, 19 deletions
diff --git a/lib/VMCore/ConstantsContext.h b/lib/VMCore/ConstantsContext.h
index f4a2cde..718470a 100644
--- a/lib/VMCore/ConstantsContext.h
+++ b/lib/VMCore/ConstantsContext.h
@@ -16,7 +16,6 @@
#define LLVM_CONSTANTSCONTEXT_H
#include "llvm/Instructions.h"
-#include "llvm/Metadata.h"
#include "llvm/Operator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -341,7 +340,7 @@ struct ConstantCreator {
};
template<class ConstantClass, class TypeClass>
-struct ConvertConstant {
+struct ConvertConstantType {
static void convert(ConstantClass *OldC, const TypeClass *NewTy) {
llvm_unreachable("This type cannot be converted!");
}
@@ -392,7 +391,7 @@ struct ConstantCreator<ConstantExpr, Type, ExprMapKeyType> {
};
template<>
-struct ConvertConstant<ConstantExpr, Type> {
+struct ConvertConstantType<ConstantExpr, Type> {
static void convert(ConstantExpr *OldC, const Type *NewTy) {
Constant *New;
switch (OldC->getOpcode()) {
@@ -445,14 +444,7 @@ struct ConstantCreator<ConstantAggregateZero, Type, ValType> {
};
template<>
-struct ConstantCreator<MDNode, Type, std::vector<Value*> > {
- static MDNode *create(const Type* Ty, const std::vector<Value*> &V) {
- return new MDNode(Ty->getContext(), &V[0], V.size());
- }
-};
-
-template<>
-struct ConvertConstant<ConstantVector, VectorType> {
+struct ConvertConstantType<ConstantVector, VectorType> {
static void convert(ConstantVector *OldC, const VectorType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector<Constant*> C;
@@ -466,7 +458,7 @@ struct ConvertConstant<ConstantVector, VectorType> {
};
template<>
-struct ConvertConstant<ConstantAggregateZero, Type> {
+struct ConvertConstantType<ConstantAggregateZero, Type> {
static void convert(ConstantAggregateZero *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantAggregateZero::get(NewTy);
@@ -477,7 +469,7 @@ struct ConvertConstant<ConstantAggregateZero, Type> {
};
template<>
-struct ConvertConstant<ConstantArray, ArrayType> {
+struct ConvertConstantType<ConstantArray, ArrayType> {
static void convert(ConstantArray *OldC, const ArrayType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector<Constant*> C;
@@ -491,7 +483,7 @@ struct ConvertConstant<ConstantArray, ArrayType> {
};
template<>
-struct ConvertConstant<ConstantStruct, StructType> {
+struct ConvertConstantType<ConstantStruct, StructType> {
static void convert(ConstantStruct *OldC, const StructType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector<Constant*> C;
@@ -514,7 +506,7 @@ struct ConstantCreator<ConstantPointerNull, PointerType, ValType> {
};
template<>
-struct ConvertConstant<ConstantPointerNull, PointerType> {
+struct ConvertConstantType<ConstantPointerNull, PointerType> {
static void convert(ConstantPointerNull *OldC, const PointerType *NewTy) {
// Make everyone now use a constant of the new type...
Constant *New = ConstantPointerNull::get(NewTy);
@@ -533,7 +525,7 @@ struct ConstantCreator<UndefValue, Type, ValType> {
};
template<>
-struct ConvertConstant<UndefValue, Type> {
+struct ConvertConstantType<UndefValue, Type> {
static void convert(UndefValue *OldC, const Type *NewTy) {
// Make everyone now use a constant of the new type.
Constant *New = UndefValue::get(NewTy);
@@ -548,8 +540,8 @@ template<class ValType, class TypeClass, class ConstantClass,
class ValueMap : public AbstractTypeUser {
public:
typedef std::pair<const Type*, ValType> MapKey;
- typedef std::map<MapKey, Value *> MapTy;
- typedef std::map<Value*, typename MapTy::iterator> InverseMapTy;
+ typedef std::map<MapKey, Constant *> MapTy;
+ typedef std::map<Constant*, typename MapTy::iterator> InverseMapTy;
typedef std::map<const Type*, typename MapTy::iterator> AbstractTypeMapTy;
private:
/// Map - This is the main map from the element descriptor to the Constants.
@@ -767,7 +759,8 @@ public:
// leaving will remove() itself, causing the AbstractTypeMapEntry to be
// eliminated eventually.
do {
- ConvertConstant<ConstantClass, TypeClass>::convert(
+ ConvertConstantType<ConstantClass,
+ TypeClass>::convert(
static_cast<ConstantClass *>(I->second->second),
cast<TypeClass>(NewTy));