+
+// ------------- Expression Conversion ---------------------
+
+typedef std::map<const Value*, const Type*> ValueTypeCache;
+
+struct ValueMapCache {
+ // Operands mapped - Contains an entry if the first value (the user) has had
+ // the second value (the operand) mapped already.
+ //
+ std::set<const User*> OperandsMapped;
+
+ // Expression Map - Contains an entry from the old value to the new value of
+ // an expression that has been converted over.
+ //
+ std::map<const Value *, Value *> ExprMap;
+ typedef std::map<const Value *, Value *> ExprMapTy;
+
+ // Cast Map - Cast instructions can have their source and destination values
+ // changed independently for each part. Because of this, our old naive
+ // implementation would create a TWO new cast instructions, which would cause
+ // all kinds of problems. Here we keep track of the newly allocated casts, so
+ // that we only create one for a particular instruction.
+ //
+ std::set<ValueHandle> NewCasts;
+};
+
+
+bool ExpressionConvertibleToType(Value *V, const Type *Ty, ValueTypeCache &Map,
+ const TargetData &TD);
+Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC,
+ const TargetData &TD);
+
+// ValueConvertibleToType - Return true if it is possible
+bool ValueConvertibleToType(Value *V, const Type *Ty,
+ ValueTypeCache &ConvertedTypes,
+ const TargetData &TD);
+
+void ConvertValueToNewType(Value *V, Value *NewVal, ValueMapCache &VMC,
+ const TargetData &TD);
+
+