Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Analysis/TargetTransformInfo.h
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
class SCEV; | class SCEV; | ||||
class ScalarEvolution; | class ScalarEvolution; | ||||
class StoreInst; | class StoreInst; | ||||
class SwitchInst; | class SwitchInst; | ||||
class TargetLibraryInfo; | class TargetLibraryInfo; | ||||
class Type; | class Type; | ||||
class User; | class User; | ||||
class Value; | class Value; | ||||
class VPIntrinsic; | |||||
struct KnownBits; | struct KnownBits; | ||||
template <typename T> class Optional; | template <typename T> class Optional; | ||||
/// Information about a load/store intrinsic defined by the target. | /// Information about a load/store intrinsic defined by the target. | ||||
struct MemIntrinsicInfo { | struct MemIntrinsicInfo { | ||||
/// This is the pointer that the intrinsic is loading from or storing to. | /// This is the pointer that the intrinsic is loading from or storing to. | ||||
/// If this is non-null, then analysis/optimization passes can assume that | /// If this is non-null, then analysis/optimization passes can assume that | ||||
/// this intrinsic is functionally equivalent to a load/store from this | /// this intrinsic is functionally equivalent to a load/store from this | ||||
▲ Show 20 Lines • Show All 1,302 Lines • ▼ Show 20 Lines | |||||
/// \name Vector Predication Information | /// \name Vector Predication Information | ||||
/// @{ | /// @{ | ||||
/// Whether the target supports the %evl parameter of VP intrinsic efficiently | /// Whether the target supports the %evl parameter of VP intrinsic efficiently | ||||
/// in hardware. (see LLVM Language Reference - "Vector Predication | /// in hardware. (see LLVM Language Reference - "Vector Predication | ||||
/// Intrinsics") Use of %evl is discouraged when that is not the case. | /// Intrinsics") Use of %evl is discouraged when that is not the case. | ||||
bool hasActiveVectorLength() const; | bool hasActiveVectorLength() const; | ||||
struct VPLegalization { | |||||
enum VPTransform { | |||||
// keep the predicating parameter | |||||
Legal = 0, | |||||
// where legal, discard the predicate parameter | |||||
Discard = 1, | |||||
// transform into something else that is also predicating | |||||
Convert = 2 | |||||
}; | |||||
// How to transform the EVL parameter. | |||||
// Legal: keep the EVL parameter as it is. | |||||
// Discard: Ignore the EVL parameter where it is safe to do so. | |||||
// Convert: Fold the EVL into the mask parameter. | |||||
VPTransform EVLParamStrategy; | |||||
// How to transform the operator. | |||||
// Legal: The target supports this operator. | |||||
// Convert: Convert this to a non-VP operation. | |||||
// The 'Discard' strategy is invalid. | |||||
VPTransform OpStrategy; | |||||
bool shouldDoNothing() const { | |||||
ctetreau: BIKESHED: "doNothing" sounds like a nop, not a test | |||||
return (EVLParamStrategy == Legal) && (OpStrategy == Legal); | |||||
} | |||||
VPLegalization(VPTransform EVLParamStrategy, VPTransform OpStrategy) | |||||
: EVLParamStrategy(EVLParamStrategy), OpStrategy(OpStrategy) {} | |||||
}; | |||||
/// \returns How the target needs this vector-predicated operation to be | |||||
/// transformed. | |||||
VPLegalization getVPLegalizationStrategy(const VPIntrinsic &PI) const; | |||||
/// @} | /// @} | ||||
/// @} | /// @} | ||||
private: | private: | ||||
/// Estimate the latency of specified instruction. | /// Estimate the latency of specified instruction. | ||||
/// Returns 1 as the default value. | /// Returns 1 as the default value. | ||||
InstructionCost getInstructionLatency(const Instruction *I) const; | InstructionCost getInstructionLatency(const Instruction *I) const; | ||||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty, | ||||
ReductionFlags) const = 0; | ReductionFlags) const = 0; | ||||
virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty, | virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty, | ||||
ReductionFlags) const = 0; | ReductionFlags) const = 0; | ||||
virtual bool shouldExpandReduction(const IntrinsicInst *II) const = 0; | virtual bool shouldExpandReduction(const IntrinsicInst *II) const = 0; | ||||
virtual unsigned getGISelRematGlobalCost() const = 0; | virtual unsigned getGISelRematGlobalCost() const = 0; | ||||
virtual bool supportsScalableVectors() const = 0; | virtual bool supportsScalableVectors() const = 0; | ||||
virtual bool hasActiveVectorLength() const = 0; | virtual bool hasActiveVectorLength() const = 0; | ||||
virtual InstructionCost getInstructionLatency(const Instruction *I) = 0; | virtual InstructionCost getInstructionLatency(const Instruction *I) = 0; | ||||
virtual VPLegalization | |||||
getVPLegalizationStrategy(const VPIntrinsic &PI) const = 0; | |||||
}; | }; | ||||
template <typename T> | template <typename T> | ||||
class TargetTransformInfo::Model final : public TargetTransformInfo::Concept { | class TargetTransformInfo::Model final : public TargetTransformInfo::Concept { | ||||
T Impl; | T Impl; | ||||
public: | public: | ||||
Model(T Impl) : Impl(std::move(Impl)) {} | Model(T Impl) : Impl(std::move(Impl)) {} | ||||
▲ Show 20 Lines • Show All 555 Lines • ▼ Show 20 Lines | public: | ||||
bool hasActiveVectorLength() const override { | bool hasActiveVectorLength() const override { | ||||
return Impl.hasActiveVectorLength(); | return Impl.hasActiveVectorLength(); | ||||
} | } | ||||
InstructionCost getInstructionLatency(const Instruction *I) override { | InstructionCost getInstructionLatency(const Instruction *I) override { | ||||
return Impl.getInstructionLatency(I); | return Impl.getInstructionLatency(I); | ||||
} | } | ||||
VPLegalization | |||||
getVPLegalizationStrategy(const VPIntrinsic &PI) const override { | |||||
return Impl.getVPLegalizationStrategy(PI); | |||||
} | |||||
}; | }; | ||||
template <typename T> | template <typename T> | ||||
TargetTransformInfo::TargetTransformInfo(T Impl) | TargetTransformInfo::TargetTransformInfo(T Impl) | ||||
: TTIImpl(new Model<T>(Impl)) {} | : TTIImpl(new Model<T>(Impl)) {} | ||||
/// Analysis pass providing the \c TargetTransformInfo. | /// Analysis pass providing the \c TargetTransformInfo. | ||||
/// | /// | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |
BIKESHED: "doNothing" sounds like a nop, not a test