chromium/v8/src/compiler/turboshaft/wasm-revec-reducer.cc

// Copyright 2023 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// Returns true if op in node_group have same kind.
bool IsSameOpAndKind(const Operation& op0, const Operation& op1) {}

std::string GetSimdOpcodeName(Operation const& op) {}

//  This class is the wrapper for StoreOp/LoadOp, which is helpful to calcualte
//  the relative offset between two StoreOp/LoadOp.
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>;

// Return whether the stride of node_group equal to a specific value
template <class Op, class Info>
bool LoadStrideEqualTo(const Graph& graph, const NodeGroup& node_group,
                       int stride) {}

// Returns true if all of the nodes in node_group are identical.
// Splat opcode in WASM SIMD is used to create vector with identical lanes.
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  // V8_TARGET_ARCH_X64

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() {}

}  // namespace v8::internal::compiler::turboshaft