11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#if !V8_ENABLE_WEBASSEMBLY
61cb0ef41Sopenharmony_ci#error This header should only be included if WebAssembly is enabled.
71cb0ef41Sopenharmony_ci#endif  // !V8_ENABLE_WEBASSEMBLY
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci#ifndef V8_COMPILER_WASM_LOOP_PEELING_H_
101cb0ef41Sopenharmony_ci#define V8_COMPILER_WASM_LOOP_PEELING_H_
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci#include "src/compiler/common-operator.h"
131cb0ef41Sopenharmony_ci#include "src/compiler/loop-analysis.h"
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cinamespace v8 {
161cb0ef41Sopenharmony_cinamespace internal {
171cb0ef41Sopenharmony_cinamespace compiler {
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci// Loop peeling is an optimization that copies the body of a loop, creating
201cb0ef41Sopenharmony_ci// a new copy of the body called the "peeled iteration" that represents the
211cb0ef41Sopenharmony_ci// first iteration. It enables a kind of loop hoisting: repeated computations
221cb0ef41Sopenharmony_ci// without side-effects in the body of the loop can be computed in the first
231cb0ef41Sopenharmony_ci// iteration only and reused in the next iterations.
241cb0ef41Sopenharmony_civoid PeelWasmLoop(Node* loop_node, ZoneUnorderedSet<Node*>* loop, Graph* graph,
251cb0ef41Sopenharmony_ci                  CommonOperatorBuilder* common, Zone* tmp_zone,
261cb0ef41Sopenharmony_ci                  SourcePositionTable* source_positions,
271cb0ef41Sopenharmony_ci                  NodeOriginTable* node_origins);
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci}  // namespace compiler
301cb0ef41Sopenharmony_ci}  // namespace internal
311cb0ef41Sopenharmony_ci}  // namespace v8
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci#endif  // V8_COMPILER_WASM_LOOP_PEELING_H_
34