1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef ECMASCRIPT_COMPILER_ESCAPE_ANALYSIS_EDITOR_H
17#define ECMASCRIPT_COMPILER_ESCAPE_ANALYSIS_EDITOR_H
18
19#include "ecmascript/compiler/combined_pass_visitor.h"
20#include "ecmascript/compiler/escape_analysis.h"
21#include "ecmascript/compiler/gate_accessor.h"
22#include "ecmascript/mem/chunk_containers.h"
23
24namespace panda::ecmascript::kungfu {
25
26class EscapeAnalysisEditor : public PassVisitor {
27public:
28    EscapeAnalysisEditor(Circuit* circuit, RPOVisitor* visitor,
29                         Chunk* chunk, EscapeAnalysis* result, bool isTraced)
30        : PassVisitor(circuit, chunk, visitor), circuit_(circuit), result_(result), isTraced_(isTraced) {}
31
32    GateRef VisitFinishAllocate(GateRef gate);
33    GateRef VisitGate(GateRef gate) override;
34private:
35    Circuit* circuit_;
36    EscapeAnalysis* result_;
37    bool isTraced_;
38};
39
40}
41#endif