mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
5ddce7be21
In order to make the framework code structure clearer and more readable, it encapsulates multiple calling interfaces, uses clearer variable names, and draws a comparison diagram before and after lowering, so that developers can better understand the code. issue: https://e.gitee.com/open_harmony/dashboard?issue=I4U02P Signed-off-by: xujie <xujie101@huawei.com> Change-Id: Ied4933d8eac5e4b7b50c894ae496d7cf8d1ff1b0
43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include "pass_manager.h"
|
|
#include "pass.h"
|
|
|
|
namespace panda::ecmascript::kungfu {
|
|
bool PassManager::Compile(std::string fileName)
|
|
{
|
|
std::vector<BytecodeTranslationInfo> infoList;
|
|
const panda_file::File *file = nullptr;
|
|
auto res = vm_->CollectInfoOfPandaFile(fileName, entry_, infoList, file);
|
|
if (!res) {
|
|
std::cerr << "Cannot execute panda file '" << fileName << "' with entry '" << entry_ << "'" << std::endl;
|
|
return false;
|
|
}
|
|
|
|
for (auto &info : infoList) {
|
|
BytecodeCircuitBuilder builder;
|
|
builder.BytecodeToCircuit(info.pcArray, *info.file, info.method);
|
|
PassData data(builder.GetCircuit());
|
|
PassRunner<PassData> pipeline(&data);
|
|
pipeline.RunPass<SlowPathLoweringPass>(&builder);
|
|
pipeline.RunPass<VerifierPass>();
|
|
pipeline.RunPass<SchedulingPass>();
|
|
pipeline.RunPass<LLVMIRGenPass>();
|
|
}
|
|
return true;
|
|
}
|
|
}
|