5#ifndef V8_COMPILER_TURBOSHAFT_DUPLICATION_OPTIMIZATION_REDUCER_H_
6#define V8_COMPILER_TURBOSHAFT_DUPLICATION_OPTIMIZATION_REDUCER_H_
79 return Next::ReduceInputGraphBranch(ig_index, branch);
83 const Operation& cond =
__ input_graph().Get(branch.condition());
90 __ Branch(new_cond,
__ MapToNewGraph(branch.if_true),
91 __ MapToNewGraph(branch.if_false), branch.hint);
97 return Next::ReduceInputGraphSelect(ig_index, select);
101 const Operation& cond =
__ input_graph().Get(select.cond());
106 return __ Select(new_cond,
__ MapToNewGraph(select.vtrue()),
107 __ MapToNewGraph(select.vfalse()), select.
rep, select.hint,
111#if V8_TARGET_ARCH_ARM64
119 uint8_t element_size_log2) {
120 if (
offset == 0 && element_size_log2 == 0 && index.valid()) {
123 return Next::ReduceLoad(base, index,
kind, loaded_rep, result_rep,
offset,
130 uint8_t element_size_log2,
131 bool maybe_initializing_or_transitioning,
133 if (
offset == 0 && element_size_log2 == 0 && index.valid()) {
136 return Next::ReduceStore(base, index, value,
kind, stored_rep,
137 write_barrier,
offset, element_size_log2,
138 maybe_initializing_or_transitioning,
139 maybe_indirect_pointer_tag);
149 case Opcode::kComparison:
153 case Opcode::kWordBinop:
163 return new_cond->
valid();
168 if (
__ input_graph().
Get(left).saturated_use_count.IsOne() &&
169 __ input_graph().
Get(right).saturated_use_count.IsOne()) {
175 OpIndex binop_output_idx =
__ MapToNewGraph(input_idx);
176 if (
__ Get(binop_output_idx).saturated_use_count.IsZero()) {
190 switch (binop.
kind) {
203 return __ WordBinop(
__ MapToNewGraph(binop.
left()),
214 return __ Comparison(
__ MapToNewGraph(comp.
left()),
232 ShiftOp::Kind shift_kind;
234 if (
__ matcher().MatchConstantShift(index, &shifted, &shift_kind,
235 &shift_rep, &shifted_by) &&
236 !
__ matcher().
Get(index).saturated_use_count.IsZero()) {
240 return __ Shift(shifted,
__ Word32Constant(shifted_by), shift_kind,
#define REDUCE(operation)
#define REDUCE_INPUT_GRAPH(operation)
bool MaybeDuplicateCond(const Operation &cond, OpIndex input_idx, V< Word32 > *new_cond)
OpIndex MaybeDuplicateWordBinop(const WordBinopOp &binop, OpIndex input_idx)
V< Any > REDUCE_INPUT_GRAPH Select(V< Any > ig_index, const SelectOp &select)
V< Word32 > MaybeDuplicateComparison(const ComparisonOp &comp, OpIndex input_idx)
OpIndex MaybeDuplicateOutputGraphShift(OpIndex index)
OpIndex MaybeDuplicateShift(const ShiftOp &shift, OpIndex input_idx)
bool MaybeCanDuplicateGenericBinop(OpIndex input_idx, OpIndex left, OpIndex right)
V< None > REDUCE_INPUT_GRAPH Branch(V< None > ig_index, const BranchOp &branch)
static constexpr OpIndex Invalid()
constexpr bool valid() const
static constexpr auto rep
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
#define LABEL_BLOCK(label)
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
V8_EXPORT_PRIVATE bool ShouldSkipOptimizationStep()
i::Address Load(i::Address address)
#define DCHECK(condition)
RegisterRepresentation rep
SaturatedUint8 saturated_use_count
underlying_operation_t< Op > & Cast()
V< Word32 > right() const
V< WordType > left() const
V< WordType > right() const