2015-12-08 17:05:23 +00:00
|
|
|
VIXL: AArch64 Runtime Code Generation Library Version 1.12
|
2015-07-21 11:37:10 +01:00
|
|
|
==========================================================
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
Contents:
|
|
|
|
|
|
|
|
* Overview
|
2015-07-21 11:37:10 +01:00
|
|
|
* Licence
|
2015-03-31 11:04:14 +01:00
|
|
|
* Requirements
|
2013-06-14 11:42:37 +01:00
|
|
|
* Known limitations
|
|
|
|
* Usage
|
|
|
|
|
|
|
|
|
2015-03-31 11:04:14 +01:00
|
|
|
Overview
|
|
|
|
========
|
|
|
|
|
|
|
|
VIXL contains three components.
|
|
|
|
|
|
|
|
1. A programmatic **assembler** to generate A64 code at runtime. The assembler
|
|
|
|
abstracts some of the constraints of the A64 ISA; for example, most
|
|
|
|
instructions support any immediate.
|
|
|
|
2. A **disassembler** that can print any instruction emitted by the assembler.
|
|
|
|
3. A **simulator** that can simulate any instruction emitted by the assembler.
|
|
|
|
The simulator allows generated code to be run on another architecture
|
|
|
|
without the need for a full ISA model.
|
|
|
|
|
|
|
|
The VIXL git repository can be found [on GitHub][vixl].
|
|
|
|
|
|
|
|
Changes from previous versions of VIXL can be found in the
|
|
|
|
[Changelog](doc/changelog.md).
|
|
|
|
|
|
|
|
|
2015-07-21 11:37:10 +01:00
|
|
|
Licence
|
|
|
|
=======
|
|
|
|
|
|
|
|
This software is covered by the licence described in the [LICENCE](LICENCE)
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
2013-06-14 11:42:37 +01:00
|
|
|
Requirements
|
|
|
|
============
|
|
|
|
|
|
|
|
To build VIXL the following software is required:
|
|
|
|
|
|
|
|
1. Python 2.7
|
2013-08-15 17:21:42 +01:00
|
|
|
2. SCons 2.0
|
2015-03-31 11:04:14 +01:00
|
|
|
3. GCC 4.8+ or Clang 3.4+
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
A 64-bit host machine is required, implementing an LP64 data model. VIXL has
|
2015-03-31 11:04:14 +01:00
|
|
|
been tested using GCC on AArch64 Debian, GCC and Clang on amd64 Ubuntu
|
|
|
|
systems.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
To run the linter stage of the tests, the following software is also required:
|
|
|
|
|
|
|
|
1. Git
|
|
|
|
2. [Google's `cpplint.py`][cpplint]
|
|
|
|
|
|
|
|
Refer to the 'Usage' section for details.
|
|
|
|
|
2013-08-15 17:21:42 +01:00
|
|
|
|
2013-06-14 11:42:37 +01:00
|
|
|
Known Limitations
|
|
|
|
=================
|
|
|
|
|
2015-03-31 11:04:14 +01:00
|
|
|
VIXL was developed for JavaScript engines so a number of features from A64 were
|
|
|
|
deemed unnecessary:
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
* Limited rounding mode support for floating point.
|
2014-02-05 13:22:16 +00:00
|
|
|
* Limited support for synchronisation instructions.
|
2013-06-14 11:42:37 +01:00
|
|
|
* Limited support for system instructions.
|
|
|
|
* A few miscellaneous integer and floating point instructions are missing.
|
|
|
|
|
|
|
|
The VIXL simulator supports only those instructions that the VIXL assembler can
|
2013-08-15 17:21:42 +01:00
|
|
|
generate. The `doc` directory contains a
|
|
|
|
[list of supported instructions](doc/supported-instructions.md).
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2014-03-21 14:03:59 +00:00
|
|
|
The VIXL simulator was developed to run on 64-bit amd64 platforms. Whilst it
|
|
|
|
builds and mostly works for 32-bit x86 platforms, there are a number of
|
|
|
|
floating-point operations which do not work correctly, and a number of tests
|
|
|
|
fail as a result.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2014-11-25 10:38:32 +00:00
|
|
|
Debug Builds
|
|
|
|
------------
|
|
|
|
|
|
|
|
Your project's build system must define `VIXL_DEBUG` (eg. `-DVIXL_DEBUG`)
|
|
|
|
when using a VIXL library that has been built with debug enabled.
|
|
|
|
|
|
|
|
Some classes defined in VIXL header files contain fields that are only present
|
|
|
|
in debug builds, so if `VIXL_DEBUG` is defined when the library is built, but
|
|
|
|
not defined for the header files included in your project, you will see runtime
|
|
|
|
failures.
|
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
Exclusive-Access Instructions
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
All exclusive-access instructions are supported, but the simulator cannot
|
2014-11-25 10:38:32 +00:00
|
|
|
accurately simulate their behaviour as described in the ARMv8 Architecture
|
|
|
|
Reference Manual.
|
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
* A local monitor is simulated, so simulated exclusive loads and stores execute
|
|
|
|
as expected in a single-threaded environment.
|
|
|
|
* The global monitor is simulated by occasionally causing exclusive-access
|
|
|
|
instructions to fail regardless of the local monitor state.
|
|
|
|
* Load-acquire, store-release semantics are approximated by issuing a host
|
|
|
|
memory barrier after loads or before stores. The built-in
|
|
|
|
`__sync_synchronize()` is used for this purpose.
|
|
|
|
|
|
|
|
The simulator tries to be strict, and implements the following restrictions that
|
|
|
|
the ARMv8 ARM allows:
|
2014-11-25 10:38:32 +00:00
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
* A pair of load-/store-exclusive instructions will only succeed if they have
|
|
|
|
the same address and access size.
|
|
|
|
* Most of the time, cache-maintenance operations or explicit memory accesses
|
|
|
|
will clear the exclusive monitor.
|
|
|
|
* To ensure that simulated code does not depend on this behaviour, the
|
|
|
|
exclusive monitor will sometimes be left intact after these instructions.
|
|
|
|
|
|
|
|
Instructions affected by these limitations:
|
2014-11-25 10:38:32 +00:00
|
|
|
`stxrb`, `stxrh`, `stxr`, `ldxrb`, `ldxrh`, `ldxr`, `stxp`, `ldxp`, `stlxrb`,
|
|
|
|
`stlxrh`, `stlxr`, `ldaxrb`, `ldaxrh`, `ldaxr`, `stlxp`, `ldaxp`, `stlrb`,
|
|
|
|
`stlrh`, `stlr`, `ldarb`, `ldarh`, `ldar`, `clrex`.
|
2014-07-14 09:02:40 +01:00
|
|
|
|
|
|
|
|
2013-06-14 11:42:37 +01:00
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
|
|
|
|
Running all Tests
|
|
|
|
-----------------
|
|
|
|
|
2015-07-21 11:37:10 +01:00
|
|
|
The helper script `tools/test.py` will build and run every test that is provided
|
|
|
|
with VIXL, in both release and debug mode. It is a useful script for verifying
|
|
|
|
that all of VIXL's dependencies are in place and that VIXL is working as it
|
|
|
|
should.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2015-07-21 11:37:10 +01:00
|
|
|
By default, the `tools/test.py` script runs a linter to check that the source
|
|
|
|
code conforms with the code style guide, and to detect several common errors
|
|
|
|
that the compiler may not warn about. This is most useful for VIXL developers.
|
|
|
|
The linter has the following dependencies:
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
1. Git must be installed, and the VIXL project must be in a valid Git
|
|
|
|
repository, such as one produced using `git clone`.
|
|
|
|
2. `cpplint.py`, [as provided by Google][cpplint], must be available (and
|
2014-11-25 10:38:32 +00:00
|
|
|
executable) on the `PATH`.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2015-07-21 11:37:10 +01:00
|
|
|
It is possible to tell `tools/test.py` to skip the linter stage by passing
|
2013-06-14 11:42:37 +01:00
|
|
|
`--nolint`. This removes the dependency on `cpplint.py` and Git. The `--nolint`
|
|
|
|
option is implied if the VIXL project is a snapshot (with no `.git` directory).
|
|
|
|
|
|
|
|
|
|
|
|
Building and Running the Benchmarks
|
|
|
|
-----------------------------------
|
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
There are three very basic benchmarks provided with VIXL:
|
|
|
|
|
|
|
|
1. bench-dataop, emitting adds
|
|
|
|
2. bench-branch, emitting branches
|
|
|
|
3. bench-branch-link, emitting branch-links
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
Build these benchmarks using `scons bench-dataop`, `scons bench-branch` and
|
|
|
|
`scons bench-branch-link`. This will produce binaries called
|
|
|
|
`bench-dataop_sim`, `bench-branch_sim` and `bench-branch-link_sim`. Run these
|
|
|
|
with an iteration count argument, for example `./bench-dataop_sim 10000000`. The
|
|
|
|
benchmarks do not report a result; time them using the UNIX `time` command.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
2014-07-14 09:02:40 +01:00
|
|
|
Build the benchmarks natively for execution on an AArch64 target using `scons
|
|
|
|
<benchmark name> simulator=off`. This will produce binaries called
|
|
|
|
`bench-dataop`, `bench-branch` and `bench-branch-link`. Run and time these in
|
|
|
|
the same way as the simulator versions.
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
Getting Started
|
|
|
|
---------------
|
|
|
|
|
2013-08-15 17:21:42 +01:00
|
|
|
A short introduction to using VIXL can be found [here](doc/getting-started.md).
|
2014-11-25 10:38:32 +00:00
|
|
|
Example source code is provided in the [examples](examples) directory. You can
|
|
|
|
build all the examples with `scons examples` from the root directory, or use
|
2014-09-25 18:49:30 +01:00
|
|
|
`scons --help` to get a detailed list of available build targets.
|
|
|
|
|
|
|
|
|
|
|
|
Using VIXL
|
|
|
|
----------
|
|
|
|
|
2014-11-25 10:38:32 +00:00
|
|
|
In addition to [getting started](doc/getting-started.md) and the
|
|
|
|
[examples](examples), you can find documentation and guides on various topics
|
|
|
|
that may be helpful [here](doc/topics/index.md).
|
2014-09-25 18:49:30 +01:00
|
|
|
|
|
|
|
|
2013-06-14 11:42:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-25 10:38:32 +00:00
|
|
|
[cpplint]: http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
|
2013-06-14 11:42:37 +01:00
|
|
|
"Google's cpplint.py script."
|
2013-08-15 17:21:42 +01:00
|
|
|
|
|
|
|
[vixl]: https://github.com/armvixl/vixl
|
|
|
|
"The VIXL repository on GitHub."
|