#include "src/compiler/turboshaft/wasm-revec-reducer.h"
#include <optional>
#include "src/base/logging.h"
#include "src/compiler/turboshaft/opmasks.h"
#include "src/wasm/simd-shuffle.h"
#define TRACE(...) …
namespace v8::internal::compiler::turboshaft {
bool IsSameOpAndKind(const Operation& op0, const Operation& op1) { … }
std::string GetSimdOpcodeName(Operation const& op) { … }
template <typename Op,
typename = std::enable_if_t<
std::is_same_v<Op, StoreOp> || std::is_same_v<Op, LoadOp> ||
std::is_same_v<Op, Simd128LoadTransformOp>>>
class StoreLoadInfo {
public:
StoreLoadInfo(const Graph* graph, const Op* op)
: … { … }
std::optional<int> operator-(const StoreLoadInfo<Op>& rhs) const { … }
bool IsValid() const { … }
const Operation* index() const { … }
int offset() const { … }
const Op* op() const { … }
private:
void SetInvalid() { … }
const Op* op_;
const Operation* base_ = nullptr;
const Operation* index_ = nullptr;
int offset_;
};
struct StoreInfoCompare { … };
using StoreInfoSet = ZoneSet<StoreLoadInfo<StoreOp>, StoreInfoCompare>;
template <class Op, class Info>
bool LoadStrideEqualTo(const Graph& graph, const NodeGroup& node_group,
int stride) { … }
template <typename T>
bool IsSplat(const T& node_group) { … }
void PackNode::Print(Graph* graph) const { … }
PackNode* SLPTree::GetPackNode(OpIndex node) { … }
template <typename FunctionType>
void ForEach(FunctionType callback,
ZoneUnorderedMap<OpIndex, PackNode*>& node_map) { … }
void SLPTree::Print(const char* info) { … }
PackNode* SLPTree::NewPackNode(const NodeGroup& node_group) { … }
PackNode* SLPTree::NewForcePackNode(const NodeGroup& node_group,
PackNode::ForcePackType type,
const Graph& graph) { … }
PackNode* SLPTree::NewCommutativePackNodeAndRecurs(const NodeGroup& node_group,
unsigned depth) { … }
PackNode* SLPTree::NewPackNodeAndRecurs(const NodeGroup& node_group,
int start_index, int count,
unsigned depth) { … }
ShufflePackNode* SLPTree::NewShufflePackNode(
const NodeGroup& node_group, ShufflePackNode::SpecificInfo::Kind kind) { … }
#ifdef V8_TARGET_ARCH_X64
ShufflePackNode* SLPTree::X64TryMatch256Shuffle(const NodeGroup& node_group,
const uint8_t* shuffle0,
const uint8_t* shuffle1) { … }
#endif
void SLPTree::DeleteTree() { … }
bool CannotSwapProtectedLoads(OpEffects first, OpEffects second) { … }
bool IsProtectedLoad(Operation& op) { … }
bool SLPTree::IsSideEffectFree(OpIndex first, OpIndex second) { … }
bool IsSignExtensionOp(Operation& op) { … }
bool SLPTree::CanBePacked(const NodeGroup& node_group) { … }
bool SLPTree::IsEqual(const OpIndex node0, const OpIndex node1) { … }
PackNode* SLPTree::BuildTree(const NodeGroup& roots) { … }
bool IsLoadExtend(const Simd128LoadTransformOp& op) { … }
bool IsLoadSplat(const Simd128LoadTransformOp& op) { … }
PackNode* SLPTree::BuildTreeRec(const NodeGroup& node_group,
unsigned recursion_depth) { … }
bool WasmRevecAnalyzer::CanMergeSLPTrees() { … }
bool WasmRevecAnalyzer::IsSupportedReduceSeed(const Operation& op) { … }
void WasmRevecAnalyzer::ProcessBlock(const Block& block) { … }
void WasmRevecAnalyzer::Run() { … }
bool WasmRevecAnalyzer::DecideVectorize() { … }
}