18#ifndef LLVM_SUPPORT_INSTRUCTIONCOST_H
19#define LLVM_SUPPORT_INSTRUCTIONCOST_H
61 static CostType getMaxValue() {
return std::numeric_limits<CostType>::max(); }
62 static CostType getMinValue() {
return std::numeric_limits<CostType>::min(); }
105 Result =
RHS.Value > 0 ? getMaxValue() : getMinValue();
123 Result =
RHS.Value > 0 ? getMinValue() : getMaxValue();
141 Result = getMaxValue();
143 Result = getMinValue();
196 if (State !=
RHS.State)
197 return State <
RHS.State;
204 return !(*
this <
RHS) && !(
RHS < *
this);
211 return *
this == RHS2;
234 return *
this <= RHS2;
239 return *
this >= RHS2;
244 template <
class Function>
InstructionCost & operator+=(const CostType RHS)
bool operator!=(const CostType RHS) const
bool operator==(const InstructionCost &RHS) const
InstructionCost & operator*=(const InstructionCost &RHS)
auto map(const Function &F) const -> InstructionCost
InstructionCost & operator--()
InstructionCost & operator++()
static InstructionCost getMin()
InstructionCost operator++(int)
static InstructionCost getInvalid(CostType Val=0)
InstructionCost & operator-=(const CostType RHS)
void print(raw_ostream &OS) const
bool operator>(const InstructionCost &RHS) const
InstructionCost operator--(int)
static InstructionCost getMax()
InstructionCost & operator+=(const InstructionCost &RHS)
For all of the arithmetic operators provided here any invalid state is perpetuated and cannot be remo...
bool operator>=(const CostType RHS) const
bool operator<=(const CostType RHS) const
bool operator!=(const InstructionCost &RHS) const
InstructionCost & operator-=(const InstructionCost &RHS)
CostState
CostState describes the state of a cost.
@ Invalid
< The cost value represents a valid cost, even when the cost-value is large.
InstructionCost & operator/=(const InstructionCost &RHS)
std::optional< CostType > getValue() const
This function is intended to be used as sparingly as possible, since the class provides the full rang...
bool operator>=(const InstructionCost &RHS) const
InstructionCost(CostType Val)
bool operator<(const InstructionCost &RHS) const
For the comparison operators we have chosen to use lexicographical ordering where valid costs are alw...
InstructionCost & operator*=(const CostType RHS)
InstructionCost(CostState)=delete
bool operator==(const CostType RHS) const
bool operator<=(const InstructionCost &RHS) const
bool operator<(const CostType RHS) const
bool operator>(const CostType RHS) const
CostState getState() const
InstructionCost()=default
InstructionCost & operator/=(const CostType RHS)
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
std::enable_if_t< std::is_signed_v< T >, T > MulOverflow(T X, T Y, T &Result)
Multiply two signed integers, computing the two's complement truncated result, returning true if an o...
APInt operator*(APInt a, uint64_t RHS)
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
std::enable_if_t< std::is_signed_v< T >, T > AddOverflow(T X, T Y, T &Result)
Add two signed integers, computing the two's complement truncated result, returning true if overflow ...
APInt operator+(APInt a, const APInt &b)
std::enable_if_t< std::is_signed_v< T >, T > SubOverflow(T X, T Y, T &Result)
Subtract two signed integers, computing the two's complement truncated result, returning true if an o...
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt operator/(const DynamicAPInt &A, int64_t B)