diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Constants.h | 15 | ||||
-rw-r--r-- | include/llvm/GlobalAlias.h | 3 | ||||
-rw-r--r-- | include/llvm/GlobalVariable.h | 3 | ||||
-rw-r--r-- | include/llvm/InstrTypes.h | 8 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 28 | ||||
-rw-r--r-- | include/llvm/OperandTraits.h | 18 |
6 files changed, 45 insertions, 30 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 0fe9358..229ef9c 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -405,7 +405,8 @@ public: }; template <> -struct OperandTraits<ConstantArray> : public VariadicOperandTraits<> { +struct OperandTraits<ConstantArray> : + public VariadicOperandTraits<ConstantArray> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantArray, Constant) @@ -454,7 +455,8 @@ public: }; template <> -struct OperandTraits<ConstantStruct> : public VariadicOperandTraits<> { +struct OperandTraits<ConstantStruct> : + public VariadicOperandTraits<ConstantStruct> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantStruct, Constant) @@ -511,7 +513,8 @@ public: }; template <> -struct OperandTraits<ConstantVector> : public VariadicOperandTraits<> { +struct OperandTraits<ConstantVector> : + public VariadicOperandTraits<ConstantVector> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantVector, Constant) @@ -592,7 +595,8 @@ public: }; template <> -struct OperandTraits<BlockAddress> : public FixedNumOperandTraits<2> { +struct OperandTraits<BlockAddress> : + public FixedNumOperandTraits<BlockAddress, 2> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(BlockAddress, Value) @@ -871,7 +875,8 @@ private: }; template <> -struct OperandTraits<ConstantExpr> : public VariadicOperandTraits<1> { +struct OperandTraits<ConstantExpr> : + public VariadicOperandTraits<ConstantExpr, 1> { }; DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantExpr, Constant) diff --git a/include/llvm/GlobalAlias.h b/include/llvm/GlobalAlias.h index 9867c51..f4af5b1 100644 --- a/include/llvm/GlobalAlias.h +++ b/include/llvm/GlobalAlias.h @@ -89,7 +89,8 @@ public: }; template <> -struct OperandTraits<GlobalAlias> : public FixedNumOperandTraits<1> { +struct OperandTraits<GlobalAlias> : + public FixedNumOperandTraits<GlobalAlias, 1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalAlias, Value) diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index 597583b..1769c66 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -169,7 +169,8 @@ public: }; template <> -struct OperandTraits<GlobalVariable> : public OptionalOperandTraits<> { +struct OperandTraits<GlobalVariable> : + public OptionalOperandTraits<GlobalVariable> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GlobalVariable, Value) diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 25b63a5..9dcf688 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -128,7 +128,8 @@ public: }; template <> -struct OperandTraits<UnaryInstruction> : public FixedNumOperandTraits<1> { +struct OperandTraits<UnaryInstruction> : + public FixedNumOperandTraits<UnaryInstruction, 1> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryInstruction, Value) @@ -432,7 +433,8 @@ public: }; template <> -struct OperandTraits<BinaryOperator> : public FixedNumOperandTraits<2> { +struct OperandTraits<BinaryOperator> : + public FixedNumOperandTraits<BinaryOperator, 2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryOperator, Value) @@ -903,7 +905,7 @@ private: // FIXME: these are redundant if CmpInst < BinaryOperator template <> -struct OperandTraits<CmpInst> : public FixedNumOperandTraits<2> { +struct OperandTraits<CmpInst> : public FixedNumOperandTraits<CmpInst, 2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CmpInst, Value) diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 7a53c42..941227f 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -262,7 +262,7 @@ private: }; template <> -struct OperandTraits<StoreInst> : public FixedNumOperandTraits<2> { +struct OperandTraits<StoreInst> : public FixedNumOperandTraits<StoreInst, 2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(StoreInst, Value) @@ -524,7 +524,8 @@ public: }; template <> -struct OperandTraits<GetElementPtrInst> : public VariadicOperandTraits<1> { +struct OperandTraits<GetElementPtrInst> : + public VariadicOperandTraits<GetElementPtrInst, 1> { }; template<typename RandomAccessIterator> @@ -1087,7 +1088,7 @@ private: }; template <> -struct OperandTraits<CallInst> : public VariadicOperandTraits<1> { +struct OperandTraits<CallInst> : public VariadicOperandTraits<CallInst, 1> { }; template<typename RandomAccessIterator> @@ -1195,7 +1196,7 @@ public: }; template <> -struct OperandTraits<SelectInst> : public FixedNumOperandTraits<3> { +struct OperandTraits<SelectInst> : public FixedNumOperandTraits<SelectInst, 3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectInst, Value) @@ -1292,7 +1293,8 @@ public: }; template <> -struct OperandTraits<ExtractElementInst> : public FixedNumOperandTraits<2> { +struct OperandTraits<ExtractElementInst> : + public FixedNumOperandTraits<ExtractElementInst, 2> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value) @@ -1350,7 +1352,8 @@ public: }; template <> -struct OperandTraits<InsertElementInst> : public FixedNumOperandTraits<3> { +struct OperandTraits<InsertElementInst> : + public FixedNumOperandTraits<InsertElementInst, 3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementInst, Value) @@ -1407,7 +1410,8 @@ public: }; template <> -struct OperandTraits<ShuffleVectorInst> : public FixedNumOperandTraits<3> { +struct OperandTraits<ShuffleVectorInst> : + public FixedNumOperandTraits<ShuffleVectorInst, 3> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorInst, Value) @@ -1751,7 +1755,8 @@ public: }; template <> -struct OperandTraits<InsertValueInst> : public FixedNumOperandTraits<2> { +struct OperandTraits<InsertValueInst> : + public FixedNumOperandTraits<InsertValueInst, 2> { }; template<typename RandomAccessIterator> @@ -2032,7 +2037,7 @@ public: }; template <> -struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> { +struct OperandTraits<ReturnInst> : public VariadicOperandTraits<ReturnInst> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value) @@ -2125,7 +2130,8 @@ private: }; template <> -struct OperandTraits<BranchInst> : public VariadicOperandTraits<1> {}; +struct OperandTraits<BranchInst> : public VariadicOperandTraits<BranchInst, 1> { +}; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BranchInst, Value) @@ -2616,7 +2622,7 @@ private: }; template <> -struct OperandTraits<InvokeInst> : public VariadicOperandTraits<3> { +struct OperandTraits<InvokeInst> : public VariadicOperandTraits<InvokeInst, 3> { }; template<typename RandomAccessIterator> diff --git a/include/llvm/OperandTraits.h b/include/llvm/OperandTraits.h index b614ccb..dbdb1a1 100644 --- a/include/llvm/OperandTraits.h +++ b/include/llvm/OperandTraits.h @@ -27,12 +27,12 @@ namespace llvm { /// when it is a prefix to the User object, and the number of Use objects is /// known at compile time. -template <unsigned ARITY> +template <typename SubClass, unsigned ARITY> struct FixedNumOperandTraits { - static Use *op_begin(User* U) { + static Use *op_begin(SubClass* U) { return reinterpret_cast<Use*>(U) - ARITY; } - static Use *op_end(User* U) { + static Use *op_end(SubClass* U) { return reinterpret_cast<Use*>(U); } static unsigned operands(const User*) { @@ -57,8 +57,8 @@ struct FixedNumOperandTraits { /// OptionalOperandTraits - when the number of operands may change at runtime. /// Naturally it may only decrease, because the allocations may not change. -template <unsigned ARITY = 1> -struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> { +template <typename SubClass, unsigned ARITY = 1> +struct OptionalOperandTraits : public FixedNumOperandTraits<SubClass, ARITY> { static unsigned operands(const User *U) { return U->getNumOperands(); } @@ -72,12 +72,12 @@ struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> { /// when it is a prefix to the User object, and the number of Use objects is /// only known at allocation time. -template <unsigned MINARITY = 0> +template <typename SubClass, unsigned MINARITY = 0> struct VariadicOperandTraits { - static Use *op_begin(User* U) { - return reinterpret_cast<Use*>(U) - U->getNumOperands(); + static Use *op_begin(SubClass* U) { + return reinterpret_cast<Use*>(U) - static_cast<User*>(U)->getNumOperands(); } - static Use *op_end(User* U) { + static Use *op_end(SubClass* U) { return reinterpret_cast<Use*>(U); } static unsigned operands(const User *U) { |