11cb0ef41Sopenharmony_ci// Copyright 2015 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#ifndef V8_COMPILER_BACKEND_FRAME_ELIDER_H_
61cb0ef41Sopenharmony_ci#define V8_COMPILER_BACKEND_FRAME_ELIDER_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/compiler/backend/instruction.h"
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cinamespace v8 {
111cb0ef41Sopenharmony_cinamespace internal {
121cb0ef41Sopenharmony_cinamespace compiler {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Determine which instruction blocks need a frame and where frames must be
151cb0ef41Sopenharmony_ci// constructed/deconstructed.
161cb0ef41Sopenharmony_ciclass FrameElider {
171cb0ef41Sopenharmony_ci public:
181cb0ef41Sopenharmony_ci  explicit FrameElider(InstructionSequence* code);
191cb0ef41Sopenharmony_ci  void Run();
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci private:
221cb0ef41Sopenharmony_ci  void MarkBlocks();
231cb0ef41Sopenharmony_ci  void PropagateMarks();
241cb0ef41Sopenharmony_ci  void MarkDeConstruction();
251cb0ef41Sopenharmony_ci  bool PropagateInOrder();
261cb0ef41Sopenharmony_ci  bool PropagateReversed();
271cb0ef41Sopenharmony_ci  bool PropagateIntoBlock(InstructionBlock* block);
281cb0ef41Sopenharmony_ci  const InstructionBlocks& instruction_blocks() const;
291cb0ef41Sopenharmony_ci  InstructionBlock* InstructionBlockAt(RpoNumber rpo_number) const;
301cb0ef41Sopenharmony_ci  Instruction* InstructionAt(int index) const;
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  InstructionSequence* const code_;
331cb0ef41Sopenharmony_ci};
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci}  // namespace compiler
361cb0ef41Sopenharmony_ci}  // namespace internal
371cb0ef41Sopenharmony_ci}  // namespace v8
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci#endif  // V8_COMPILER_BACKEND_FRAME_ELIDER_H_
40