Convert several more passes to use getAnalysisIfAvailable<TargetData>()
[oota-llvm.git] / include / llvm / OperandTraits.h
index a4b634c76238a07eed9fd8fdf4a62cc9d5565652..3702a01b80983d75b9b5599ba0849ecb2d17639a 100644 (file)
@@ -48,7 +48,6 @@ struct FixedNumOperandTraits {
       overlay(); // DO NOT IMPLEMENT
     };
   };
-  static inline void *allocate(unsigned); // FIXME
 };
 
 //===----------------------------------------------------------------------===//
@@ -81,7 +80,6 @@ struct VariadicOperandTraits {
   static unsigned operands(const User *U) {
     return U->getNumOperands();
   }
-  static inline void *allocate(unsigned); // FIXME
 };
 
 //===----------------------------------------------------------------------===//
@@ -109,7 +107,6 @@ struct HungoffOperandTraits {
   static unsigned operands(const User *U) {
     return U->getNumOperands();
   }
-  static inline void *allocate(unsigned); // FIXME
 };
 
 /// Macro for generating in-class operand accessor declarations.
@@ -124,8 +121,8 @@ struct HungoffOperandTraits {
   inline op_iterator op_end(); \
   inline const_op_iterator op_end() const; \
   protected: \
-  template <unsigned> inline Use &Op(); \
-  template <unsigned> inline const Use &Op() const; \
+  template <int> inline Use &Op(); \
+  template <int> inline const Use &Op() const; \
   public: \
   inline unsigned getNumOperands() const
 
@@ -157,12 +154,11 @@ void CLASS::setOperand(unsigned i_nocapture, VALUECLASS *Val_nocapture) { \
 unsigned CLASS::getNumOperands() const { \
   return OperandTraits<CLASS>::operands(this);  \
 } \
-template <unsigned Idx_nocapture> Use &CLASS::Op() { \
-  return OperandTraits<CLASS>::op_begin(this)[Idx_nocapture]; \
+template <int Idx_nocapture> Use &CLASS::Op() { \
+  return this->OpFrom<Idx_nocapture>(this); \
 } \
-template <unsigned Idx_nocapture> const Use &CLASS::Op() const { \
-  return OperandTraits<CLASS>::op_begin( \
-    const_cast<CLASS*>(this))[Idx_nocapture]; \
+template <int Idx_nocapture> const Use &CLASS::Op() const { \
+  return this->OpFrom<Idx_nocapture>(this); \
 }
 
 
@@ -195,12 +191,11 @@ void CLASS::setOperand(unsigned i_nocapture, VALUECLASS *Val_nocapture) { \
 unsigned CLASS::getNumOperands() const { \
   return OperandTraits<CLASS>::operands(this); \
 } \
-template <unsigned Idx_nocapture> Use &CLASS::Op() { \
-  return OperandTraits<CLASS>::op_begin(this)[Idx_nocapture]; \
+template <int Idx_nocapture> Use &CLASS::Op() { \
+  return this->OpFrom<Idx_nocapture>(this); \
 } \
-template <unsigned Idx_nocapture> const Use &CLASS::Op() const { \
-  return OperandTraits<CLASS>::op_begin( \
-    const_cast<CLASS*>(this))[Idx_nocapture]; \
+template <int Idx_nocapture> const Use &CLASS::Op() const { \
+  return this->OpFrom<Idx_nocapture>(this); \
 }