Make the levelraise pass be well behaved w.r.t the TargetData that the current
PassMAnager provides.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5896 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h
index 867dd5d..9f6eb79 100644
--- a/lib/Transforms/TransformInternals.h
+++ b/lib/Transforms/TransformInternals.h
@@ -15,14 +15,6 @@
 #include <map>
 #include <set>
 
-// TargetData Hack: Eventually we will have annotations given to us by the
-// backend so that we know stuff about type size and alignments.  For now
-// though, just use this, because it happens to match the model that GCC uses.
-//
-// FIXME: This should use annotations
-//
-extern const TargetData TD;
-
 static inline int64_t getConstantValue(const ConstantInt *CPI) {
   if (const ConstantSInt *CSI = dyn_cast<ConstantSInt>(CPI))
     return CSI->getValue();
@@ -49,6 +41,7 @@
 //
 const Type *ConvertableToGEP(const Type *Ty, Value *V,
                              std::vector<Value*> &Indices,
+                             const TargetData &TD,
                              BasicBlock::iterator *BI = 0);
 
 
@@ -112,14 +105,18 @@
 };
 
 
-bool ExpressionConvertableToType(Value *V, const Type *Ty, ValueTypeCache &Map);
-Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC);
+bool ExpressionConvertableToType(Value *V, const Type *Ty, ValueTypeCache &Map,
+                                 const TargetData &TD);
+Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC,
+                               const TargetData &TD);
 
 // ValueConvertableToType - Return true if it is possible
 bool ValueConvertableToType(Value *V, const Type *Ty,
-                            ValueTypeCache &ConvertedTypes);
+                            ValueTypeCache &ConvertedTypes,
+                            const TargetData &TD);
 
-void ConvertValueToNewType(Value *V, Value *NewVal, ValueMapCache &VMC);
+void ConvertValueToNewType(Value *V, Value *NewVal, ValueMapCache &VMC,
+                           const TargetData &TD);
 
 
 // getStructOffsetType - Return a vector of offsets that are to be used to index
@@ -135,6 +132,6 @@
 //
 const Type *getStructOffsetType(const Type *Ty, unsigned &Offset,
                                 std::vector<Value*> &Offsets,
-                                bool StopEarly = true);
+                                const TargetData &TD, bool StopEarly = true);
 
 #endif