# clang2mpl **Repository Path**: openarkcompiler-incubator/clang2mpl ## Basic Information - **Project Name**: clang2mpl - **Description**: No description available - **Primary Language**: C++ - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 6 - **Created**: 2021-05-03 - **Last Updated**: 2024-06-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ``` # # Copyright (c) 2021 Futurewei Technologies, Inc. # # clang2mpl is licensed under Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan # PSL v2. You may obtain a copy of Mulan PSL v2 at: # # http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY # KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the # Mulan PSL v2 for more details. # ``` clang2mpl是[Open Ark Compiler](https://gitee.com/openarkcompiler/OpenArkCompiler)基于Clang的前端. ## 构建 clang2mpl clang2mpl is setup as a clang tool. We will link with the libraries already checked out during your OAC installation. clang2mpl被安装成clang的一个工具。 我们将连接您在OAC安装过程中已checked out库。 构建前, 需要确保预安装的环境: ```sh sudo apt install libssl-dev ``` 构建过程使用Maple中的环境变量来查找正确的包含和链接目录。 确保遵循OpenArkCompiler安装说明来设置环境(并构建所需的库)。 ```sh cd $MAPLE_ROOT source build/envsetup.sh arm release ``` 构建clang2mpl: ```sh cd clang2mpl/ make setup make make install ``` 完成此构建后,您应该在_ $ MAPLE_EXECUTE_BIN_中看到_clang2mpl_。 ## 用法 作为Clang工具,clang2mpl使用标准命令行界面将标志flags传递给该工具并传递给clang: ```sh clang2mpl [] -- [] ``` clang2mpl的可用标志有: - `--ascii`: Generate ASCII maple in a .mpl file. Without this flag, binary maple will be generated in a .bpl file. - `--verify`: Call the `Verify` method on the generated maple 对于`--`之后的clang选项,您可以传递将传递给clang的所有标志(例如,-Wno-unused-value`),但是您应始终包含目标--target = aarch64 -linux-elf`。 典型用法如下: ```sh clang2mpl --ascii foo.c -- --target=aarch64-linux-elf ``` ## 测试 ### 单元测试 该工具的单元测试位于[test/](/../tree/master/test) 目录中。 单元测试依赖LLVM的[lit](https://llvm.org/docs/CommandGuide/lit.html) 和 [FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html)。 安装那些工具: ```sh # Install lit pip install lit # Install FileCheck sudo apt install llvm-10-tools ``` 要运行测试: ```sh cd clang2mpl/test lit . ``` 这些测试应该全部通过并且应该在任何提交之前运行。 随着对该工具的增强,开发人员应该更新并添加这些测试。