1b8021494Sopenharmony_ci# VIXL
2b8021494Sopenharmony_ci
3b8021494Sopenharmony_ci## 简介
4b8021494Sopenharmony_ci
5b8021494Sopenharmony_ciVIXL是一个用于生成和解码ARM、AArch64平台指令的开源库。
6b8021494Sopenharmony_ci
7b8021494Sopenharmony_ciVIXL包括三个组件:
8b8021494Sopenharmony_ci
9b8021494Sopenharmony_ci- 汇编器:在运行时生成AArch64、AArch32 (Arm and Thumb-2) 指令。汇编器抽象了ISA(Instruction Set Architecture)的约束,例如,大多数指令支持即时操作。
10b8021494Sopenharmony_ci- 反汇编:可以输出汇编程序编译出的指令所对应的反汇编内容。
11b8021494Sopenharmony_ci- 模拟器:可以模拟AArch64汇编器编译的任何指令。模拟器允许生成的代码在另一个体系结构(如AArch32架构)上运行,而不需要完整的ISA模型。
12b8021494Sopenharmony_ci
13b8021494Sopenharmony_ci为了方舟编译器运行时公共组件能够编译ARM、AArch64平台代码,引入了VIXL。
14b8021494Sopenharmony_ci
15b8021494Sopenharmony_ci## 接口说明
16b8021494Sopenharmony_ci
17b8021494Sopenharmony_ciVIXL的一些常用接口说明:
18b8021494Sopenharmony_ci- `MacroAssembler`类:用于生成ARM指令的类。它提供了一组函数,用于生成不同类型的指令,如MOV、ADD、SUB等。
19b8021494Sopenharmony_ci- `Label`类:用于标记指令的类。它提供了一个`Bind`函数,用于将标签绑定到指令地址上。
20b8021494Sopenharmony_ci- `CodeBuffer`类:是存储生成的指令的类。它提供了一组函数,用于将指令写入缓冲区中。
21b8021494Sopenharmony_ci
22b8021494Sopenharmony_ci-  `Decoder`类:是解码ARM指令的类。它提供了一个`DecodeInstruction`函数,用于解码指令。
23b8021494Sopenharmony_ci
24b8021494Sopenharmony_ci-  `Instruction`类:是表示ARM指令的类。它提供了一组函数,用于获取指令的不同部分,如操作码、寄存器等。
25b8021494Sopenharmony_ci
26b8021494Sopenharmony_ci- `CPUFeatures`类:是表示CPU特性的类。它提供了一组函数,用于设置和查询CPU特性。
27b8021494Sopenharmony_ci
28b8021494Sopenharmony_ci更多详细信息可以参考[接口文档](doc/aarch64/supported-instructions-aarch64.md)。
29b8021494Sopenharmony_ci
30b8021494Sopenharmony_ci
31b8021494Sopenharmony_ci## 编译
32b8021494Sopenharmony_ci
33b8021494Sopenharmony_ci使用OpenHarmony中编译部件的方式进行编译即可:
34b8021494Sopenharmony_ci1. 主干代码下载
35b8021494Sopenharmony_ci   ```
36b8021494Sopenharmony_ci   repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
37b8021494Sopenharmony_ci   repo sync -c
38b8021494Sopenharmony_ci   repo forall -c 'git lfs pull'
39b8021494Sopenharmony_ci   ```
40b8021494Sopenharmony_ci2. 预处理
41b8021494Sopenharmony_ci   ```
42b8021494Sopenharmony_ci   ./build/prebuilts_download.sh
43b8021494Sopenharmony_ci   ```
44b8021494Sopenharmony_ci3. 编译
45b8021494Sopenharmony_ci   ```
46b8021494Sopenharmony_ci   ./build.sh --product-name rk3568 --build-target libvixl_frontend_static
47b8021494Sopenharmony_ci   ```
48b8021494Sopenharmony_ci   编译生成物对应路径:`out/rk3568/obj/third_party/vixl/libvixl_frontend_static.a`。
49b8021494Sopenharmony_ci
50b8021494Sopenharmony_ci## 许可证
51b8021494Sopenharmony_ci
52b8021494Sopenharmony_ci本项目遵从[LICENCE](LICENCE)中所描述的许可证。