From 6fde2f2d61bfd971f5634a0af6c1fe2941b7e679 Mon Sep 17 00:00:00 2001 From: Zongfang Lin Date: Mon, 17 May 2021 17:58:46 -0700 Subject: [PATCH 1/2] add Chinese translation --- README.md | 2 ++ README_zh_cn.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 README_zh_cn.md diff --git a/README.md b/README.md index e2d78fe..d560ee2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ # ``` +Please find READM.md in other languages: [简体中文](./README_zh_cn.md) + clang2mpl is a Clang-based frontend for the [Open Ark Compiler](https://gitee.com/openarkcompiler/OpenArkCompiler). ## Building clang2mpl diff --git a/README_zh_cn.md b/README_zh_cn.md new file mode 100644 index 0000000..e2d78fe --- /dev/null +++ b/README_zh_cn.md @@ -0,0 +1,92 @@ +``` +# +# 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 is a Clang-based frontend for the [Open Ark Compiler](https://gitee.com/openarkcompiler/OpenArkCompiler). + +## Building clang2mpl + +clang2mpl is setup as a clang tool. We will link with the libraries already checked out during your OAC installation. + +Before building, make sure you have the prerequisites: + +```sh +sudo apt-get install libssl-dev +``` + +The build process uses the environment variables from Maple to find the proper include and link directories. Be sure to follow the OpenArkCompiler installation instructions to setup the environment (and build the required libraries). + +```sh +cd $MAPLE_ROOT +source build/envsetup.sh arm release +``` + +Build clang2mpl: + +```sh +cd clang2mpl/ +make setup +make +make install +``` + +When this build completes, you should see _clang2mpl_ in _$MAPLE_EXECUTE_BIN_. + +## Usage + +As a Clang tool, clang2mpl uses the standard command line interface to pass flags to the tool and into clang: + +```sh +clang2mpl [] -- [] +``` + +The available flags for clang2mpl are: + +- `--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 + +For the clang options after the `--`, you can pass any flags that you would pass to clang (for example, `-Wno-unused-value`), but you should always include the target, `--target=aarch64-linux-elf`. + +A typical usage would look like this: + +```sh +clang2mpl --ascii foo.c -- --target=aarch64-linux-elf +``` + +## Testing + +### Unit Testing + +Unit tests for this tool are found in the [test/](/../tree/master/test) directory in the repository. The unit tests rely on LLVM's [lit](https://llvm.org/docs/CommandGuide/lit.html) and [FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html) tools. + +To install those tools: + +```sh +# Install lit +pip install lit + +# Install FileCheck +sudo apt install llvm-10-tools +``` + +To run the tests: + +```sh +cd clang2mpl/test +lit . +``` + +These tests should all pass and should be run before any commits. As enhancements are made to the tool, developers should update and add to these tests. -- Gitee From bb120e13a5835c31c6dee680898f99b28a74f23f Mon Sep 17 00:00:00 2001 From: Zongfang Lin Date: Mon, 17 May 2021 18:11:44 -0700 Subject: [PATCH 2/2] more translation --- README_zh_cn.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/README_zh_cn.md b/README_zh_cn.md index e2d78fe..88aa801 100644 --- a/README_zh_cn.md +++ b/README_zh_cn.md @@ -15,26 +15,28 @@ # ``` -clang2mpl is a Clang-based frontend for the [Open Ark Compiler](https://gitee.com/openarkcompiler/OpenArkCompiler). +clang2mpl是[Open Ark Compiler](https://gitee.com/openarkcompiler/OpenArkCompiler)基于Clang的前端. -## Building clang2mpl +## 构建 clang2mpl clang2mpl is setup as a clang tool. We will link with the libraries already checked out during your OAC installation. -Before building, make sure you have the prerequisites: +clang2mpl被安装成clang的一个工具。 我们将连接您在OAC安装过程中已checked out库。 + +构建前, 需要确保预安装的环境: ```sh -sudo apt-get install libssl-dev +sudo apt install libssl-dev ``` -The build process uses the environment variables from Maple to find the proper include and link directories. Be sure to follow the OpenArkCompiler installation instructions to setup the environment (and build the required libraries). +构建过程使用Maple中的环境变量来查找正确的包含和链接目录。 确保遵循OpenArkCompiler安装说明来设置环境(并构建所需的库)。 ```sh cd $MAPLE_ROOT source build/envsetup.sh arm release ``` -Build clang2mpl: +构建clang2mpl: ```sh cd clang2mpl/ @@ -43,36 +45,36 @@ make make install ``` -When this build completes, you should see _clang2mpl_ in _$MAPLE_EXECUTE_BIN_. +完成此构建后,您应该在_ $ MAPLE_EXECUTE_BIN_中看到_clang2mpl_。 -## Usage +## 用法 -As a Clang tool, clang2mpl uses the standard command line interface to pass flags to the tool and into clang: +作为Clang工具,clang2mpl使用标准命令行界面将标志flags传递给该工具并传递给clang: ```sh clang2mpl [] -- [] ``` -The available flags for clang2mpl are: +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 -For the clang options after the `--`, you can pass any flags that you would pass to clang (for example, `-Wno-unused-value`), but you should always include the target, `--target=aarch64-linux-elf`. +对于`--`之后的clang选项,您可以传递将传递给clang的所有标志(例如,-Wno-unused-value`),但是您应始终包含目标--target = aarch64 -linux-elf`。 -A typical usage would look like this: +典型用法如下: ```sh clang2mpl --ascii foo.c -- --target=aarch64-linux-elf ``` -## Testing +## 测试 -### Unit Testing +### 单元测试 -Unit tests for this tool are found in the [test/](/../tree/master/test) directory in the repository. The unit tests rely on LLVM's [lit](https://llvm.org/docs/CommandGuide/lit.html) and [FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html) tools. +该工具的单元测试位于[test/](/../tree/master/test) 目录中。 单元测试依赖LLVM的[lit](https://llvm.org/docs/CommandGuide/lit.html) 和 [FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html)。 -To install those tools: +安装那些工具: ```sh # Install lit @@ -82,11 +84,11 @@ pip install lit sudo apt install llvm-10-tools ``` -To run the tests: +要运行测试: ```sh cd clang2mpl/test lit . ``` -These tests should all pass and should be run before any commits. As enhancements are made to the tool, developers should update and add to these tests. +这些测试应该全部通过并且应该在任何提交之前运行。 随着对该工具的增强,开发人员应该更新并添加这些测试。 -- Gitee