-/// This POD struct holds information about a potential recurrence operation.
-class RecurrenceInstDesc {
-
-public:
- // This enum represents the kind of minmax recurrence.
- enum MinMaxRecurrenceKind {
- MRK_Invalid,
- MRK_UIntMin,
- MRK_UIntMax,
- MRK_SIntMin,
- MRK_SIntMax,
- MRK_FloatMin,
- MRK_FloatMax
- };
- RecurrenceInstDesc(bool IsRecur, Instruction *I)
- : IsRecurrence(IsRecur), PatternLastInst(I), MinMaxKind(MRK_Invalid) {}
-
- RecurrenceInstDesc(Instruction *I, MinMaxRecurrenceKind K)
- : IsRecurrence(true), PatternLastInst(I), MinMaxKind(K) {}
-
- bool isRecurrence() { return IsRecurrence; }
-
- MinMaxRecurrenceKind getMinMaxKind() { return MinMaxKind; }
-
- Instruction *getPatternInst() { return PatternLastInst; }
-
-private:
- // Is this instruction a recurrence candidate.
- bool IsRecurrence;
- // The last instruction in a min/max pattern (select of the select(icmp())
- // pattern), or the current recurrence instruction otherwise.
- Instruction *PatternLastInst;
- // If this is a min/max pattern the comparison predicate.
- MinMaxRecurrenceKind MinMaxKind;
-};
-