5#ifndef V8_COMPILER_TURBOSHAFT_LOAD_STORE_SIMPLIFICATION_REDUCER_H_
6#define V8_COMPILER_TURBOSHAFT_LOAD_STORE_SIMPLIFICATION_REDUCER_H_
20#if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_RISCV64 || \
21 V8_TARGET_ARCH_LOONG64 || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64 || \
22 V8_TARGET_ARCH_RISCV32
34#elif V8_TARGET_ARCH_S390X
38 static constexpr int32_t kDisplacementBits = 20;
40 -(
static_cast<int32_t
>(1) << (kDisplacementBits - 1));
42 (
static_cast<int32_t
>(1) << (kDisplacementBits - 1)) - 1;
48 static constexpr int32_t
kMinOffset = std::numeric_limits<int32_t>::min() + 1;
49 static constexpr int32_t
kMaxOffset = std::numeric_limits<int32_t>::max();
68 uint8_t element_size_log2) {
70 return Next::ReduceLoad(
base, index,
kind, loaded_rep, result_rep,
offset,
77 uint8_t element_size_log2,
78 bool maybe_initializing_or_transitioning,
95 return Next::ReduceStore(
base, index, value,
kind, stored_rep,
96 write_barrier,
offset, element_size_log2,
97 maybe_initializing_or_transitioning,
98 maybe_indirect_pointer_tag);
110 if (!index.valid()) {
114 index =
__ WordPtrAdd(index.value(),
offset);
118 return Next::ReduceAtomicWord32Pair(
base, index, value_low, value_high,
119 expected_low, expected_high,
kind,
137 if (element_size_log2 != 0)
return false;
138 return !(index.has_value() &&
offset != 0);
143 uint8_t& element_size_log2) {
146 index =
__ WordPtrShiftLeft(index.value(), element_size_log2);
147 element_size_log2 = 0;
151 if (
kind.tagged_base) {
152 kind.tagged_base =
false;
172 element_size_log2 = 0;
174 }
else if (element_size_log2 != 0) {
175 index =
__ WordPtrShiftLeft(index.value(), element_size_log2);
176 element_size_log2 = 0;
179 index =
__ WordPtrAdd(index.value(),
offset);
#define REDUCE(operation)
bool CanEncodeOffset(int32_t offset, bool tagged_base) const
bool CanEncodeAtomic(OptionalOpIndex index, uint8_t element_size_log2, int32_t offset) const
void SimplifyLoadStore(OpIndex &base, OptionalOpIndex &index, LoadOp::Kind &kind, int32_t &offset, uint8_t &element_size_log2)
OperationMatcher matcher_
OpIndex REDUCE Load(OpIndex base, OptionalOpIndex index, LoadOp::Kind kind, MemoryRepresentation loaded_rep, RegisterRepresentation result_rep, int32_t offset, uint8_t element_size_log2)
OpIndex REDUCE AtomicWord32Pair(V< WordPtr > base, OptionalV< WordPtr > index, OptionalV< Word32 > value_low, OptionalV< Word32 > value_high, OptionalV< Word32 > expected_low, OptionalV< Word32 > expected_high, AtomicWord32PairOp::Kind kind, int32_t offset)
OpIndex REDUCE Store(OpIndex base, OptionalOpIndex index, OpIndex value, StoreOp::Kind kind, MemoryRepresentation stored_rep, WriteBarrierKind write_barrier, int32_t offset, uint8_t element_size_log2, bool maybe_initializing_or_transitioning, IndirectPointerTag maybe_indirect_pointer_tag)
static constexpr OpIndex Invalid()
bool MatchIntegralZero(V< Any > matched) const
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
static const Operator * IntPtrConstant(CommonOperatorBuilder *common, intptr_t value)
bool Is(IndirectHandle< U > value)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
static constexpr bool OffsetIsValid(int32_t offset, bool tagged_base)
static constexpr bool kNeedsUntaggedBase
static constexpr int kMaxElementSizeLog2
static constexpr int32_t kMinOffset
static constexpr int32_t kMaxOffset