Commit Graph

109 Commits

Author SHA1 Message Date
Pierre Langlois
1e85b7f2e8 Introduce architecture specific guards for the simulator
This patch makes the VIXL_INCLUDE_SIMULATOR and
VIXL_GENERATE_SIMULATOR_CODE header guards specific to either AArch64 or
AArch32. Even though the simulator only support AArch64. The build
system was updated accordingly, the "simulator" variable now takes
"aarch64" or "none" as possible values instead of "on" and "off".

This fixes issues we have when we want to build VIXL natively on
AArch64 without a simulator, but still include the AArch32
macro-assembler. The later would check for VIXL_GENERATE_SIMULATOR_CODE
and then generate calls to native code, which breaks.

Change-Id: I2850782558d4cc37f37c1644f0efbd70a3123057
2016-08-15 16:32:57 +00:00
Vincent Belliard
3e1b899f48 AArch32: allow literals' update
Numerical literals can now be updated even after being emitted.

Change-Id: Ief50bac9079bb8c89c800c911ce6eb93a43ffd0e
2016-08-15 08:24:24 +00:00
Vincent Belliard
97a5640aed add lane access for D and Q registers
Change-Id: I7ebe3a5672327ae4ca05e5d6c691378041c8a92c
2016-08-12 15:57:19 +00:00
Alexandre Rames
c3487d2feb Fix macros for CallRuntime support.
The associated test was failing to compile natively.

Change-Id: I8962f348d3e019766c778dacd5c05f93b2295630
2016-08-12 11:27:15 +01:00
Pierre Langlois
78973f2580 Correctly include C headers
This patch refactors VIXL to use `extern` block when including C header
that do not have a C++ counterpart.

Change-Id: I203d7d107755dbac3e5f4cf8d2f196f70dea1e07
2016-08-12 09:29:08 +00:00
Serban Constantinescu
ec4fdd22ab Fix Valgrind issues
Change-Id: I7cc0a45f3831d93589eb546003225436c2419e01
2016-08-11 18:35:50 +01:00
Martyn Capewell
2a8ef397a5 AArch64: Fix assertion for NEON mov to scalar
Switch the assertion to the destination register, and add some extra tests for
vector sources moved to scalar destinations.

Change-Id: I79fd68d2e65927747f5bdebaa64df06a7435cc1d
2016-08-11 16:29:43 +00:00
Pierre Langlois
19c0535d3c [test] Make generated tests satisfy VIXL's clang-format
The test generator would use Google's style guide instead of VIXL's when
running clang-format over the generated files. Now that VIXL has its own
".clang-format", let's use it.

Change-Id: I960ed290d1b7e762da9e96f105b83e749ed560a5
2016-08-11 15:13:26 +01:00
Serban Constantinescu
60c79c5257 Rename targets in the Android makefile template
aarch32 is now arm
aarch64 is now arm64

Change-Id: I0d1e159081c41fc3b65190eeb103ab90f04bfdf8
2016-08-11 13:16:22 +00:00
Alexandre Rames
e0b313e398 Use references in the USE helper to not imply arguments copying.
Change-Id: I176bfd26efcd845dcab846a9a1e824d311782228
2016-08-11 10:23:59 +01:00
Pierre Langlois
9acb957698 [test] Fix build issue on AArch64 with GCC 5.2
When cross-compiling with GCC 5.2 we get a type-limits warning in
test-trace-aarch64.cc, because of comparing a char with EOF. `getc` and
`putc` work with integer so we should use this instead. The issue comes
from the fact that the signedness of char is undefined.

Change-Id: Ia7140643562875b66db6c5a9df83acb4b146df04
2016-08-10 16:29:07 +01:00
Alexandre Rames
9dbc587634 Revert "[test] Fix build issue on AArch64 with GCC 5.2"
This reverts commit 449befa253.

Change-Id: I172f6b5ef86f6e2b4ba1434e5aa19ecf42f58b05
2016-08-10 15:23:57 +00:00
Pierre Langlois
449befa253 [test] Fix build issue on AArch64 with GCC 5.2
When cross-compiling with GCC 5.2 we get a type-limits warning in
test-trace-aarch64.cc, because of using EOF. Work around it by using
`char_traits<char>::eof()` which is equivalent.

Change-Id: I51e474b03f46ab36f4eacee9903614d6441c98af
2016-08-10 13:08:57 +01:00
Pierre Langlois
36d16be94e [examples] Fix a sign comparison warning
Change-Id: Ib66a9c2eaaa158e44770a0adfe06103a6d8681a8
2016-08-10 13:08:57 +01:00
Alexandre Rames
fd09817b87 Do not include data members conditionally on VIXL_DEBUG in headers.
Objects visible via headers should have the same data-layout in release and
debug modes.

Change-Id: I7ce5014ab8406968cdd8e9818a7f840cb443b6c1
2016-08-09 11:24:24 +01:00
Alexandre Rames
01cbce53c0 AArch64: Make the destructors of 'scopes' virtual.
Change-Id: Icf23d4ed777fe1f8b57e536774c95d6c8ced5ad5
2016-08-09 08:39:21 +01:00
Alexandre Rames
de5bb0beb4 AArch64: Refactor InstructionAccurateScope and add a regression test.
The previous implementation was not emitting the pools when it needed to upon
construction, and was not correctly blocking emission of the pools.

Change-Id: I06db5b5891234946b139ba64898929c0e3ced3c4
2016-08-09 08:36:59 +01:00
Alexandre Rames
9fbd11bbc6 AArch64: Refactor EmissionCheckScope.
It now inherits from `CodeBufferCheckScope` instead of reimplementing the
buffer size checking feature.

Change-Id: I9cb5f0ea49aba8b87c21d9de41d94562265943f3
2016-08-09 08:36:58 +01:00
Alexandre Rames
61240278b0 Follow the Open() and Close() design for CodeBufferCheckScope.
The `Open()` and `Close()` helpers will be used in incoming commits refactoring
related scopes.

Change-Id: Ia57f74a5c98324cd6cd026a4c36f9049c7ae6a03
2016-08-09 08:36:58 +01:00
Pierre Langlois
11000d04c4 Add missing namespace in examples
A missing namespace declarations in the examples triggered a compilation
issue. We need the "vixl" namespace for the definition of "byte".

Change-Id: If2bdf9df5cb72dbfce9d480d1de1f7699acaa128
2016-08-08 18:20:33 +01:00
Alexandre Rames
d2761c75d4 Fix a reinterpret_cast to a static_cast.
Change-Id: Id4fb5fddd04b699ee6541139454dbd807dbe591b
2016-08-08 10:36:43 +00:00
Artem Serov
979b1d25d9 Add GetStartAddress helper function.
Change-Id: I957db991bc84493a36eaf89a16b699c907c3479f
2016-08-08 08:58:51 +00:00
Pierre Langlois
7ee317d3a2 [test] Add hardware traces that were accidentally removed
Commit 5e7413a accidently removed all hardware traces from the test,
this patch adds them again.

Change-Id: I55290fea88784a51e69e5432dd879b3be5291140
2016-08-05 17:38:08 +01:00
Jacob Bramley
482d4df29d Work around a GCC bug in runtime call support.
For now, simulated runtime call support is disabled for GCC before
version 4.9.1. A proper fix requires another way to force evaluation
order.

Also, fix a compiler warning.

Change-Id: Iffb258aec6f36cdd0a1e0da2f419bd3de0c6ca72
2016-08-05 16:16:27 +00:00
Alexandre Rames
bbfdd71ed7 AArch64: Avoid dynamically allocating a few objects in disassembler tests.
Change-Id: Ic81235a8846ba11055a87798fe4dab23cc4b94de
2016-08-04 15:22:55 +01:00
Alexandre Rames
a51a98b083 AArch64: Use CodeBufferCheckScope more safely in the disassembler tests.
In particular, the updated implementation works when initialising the code
buffer with a size of `0`.

Change-Id: Ic84ef05d45cace5411c472904aa23664455d0a0a
2016-08-04 15:22:53 +01:00
Alexandre Rames
7cd99a8e90 Allow the CodeBuffer to be initialized with a zero-sized buffer.
Change-Id: Id7790c494f7398be4a5cd1fe89f6404d4c709330
2016-08-04 08:26:42 +01:00
Jacob Bramley
10dae1a549 AArch32: Improve the API for selecting the ISA.
Specifically, replace SetT32(false) with SetA32(), and SetT32(true) with
SetT32(). This also adds a parameterised SetInstructionSet(...) helper, and
allows the instruction set to be set in the constructors.

Change-Id: I82609823a4b2af908b38c0a4240ff239561f7507
2016-08-03 11:32:34 +01:00
Alexandre Rames
f679d1ef44 Remove unnecessary compilation flags.
Tests pass on Linux and OSX. These compilation flags were added during the
AArch32 backend development, but are now apparently unnecessary.

Change-Id: I016b9d1ccd0d4c0450ee1f8f0f61ce9e784fafa9
2016-07-29 13:46:59 +01:00
Alexandre Rames
77f0f9fad6 Remove now unnecessary #ifdef directives in AArch32 tests.
Change-Id: I7e6baab44d0f2156492a0ddc18c625e6edebe65f
2016-07-28 16:12:13 +01:00
Alexandre Rames
2639eaa141 Fix a #ifdef in examples/aarch32/disasm-a32.cc.
Change-Id: I0b4f5c397bb573da164234c890f3cff9f97c637e
2016-07-28 14:12:32 +01:00
Alexandre Rames
03b5c8da53 Fix a call to std::max seen as ambiguous and breaking compilation on OSX.
Change-Id: I0ed0b2711602e71e0240d527b695812ad9e1f4c4
2016-07-28 12:16:26 +00:00
Alexandre Rames
dd35b95cf7 The -Wno-maybe-uninitialized option breaks compilation on OSX.
Tested with OSX 10.9.5.

Change-Id: I0073134eeb9146739b333e87b47511e36ca5dc82
2016-07-28 12:16:20 +00:00
Alexandre Rames
2b51dca2c1 AArch64: Fix AArch64 trace tests for BSD/OSX.
Change-Id: I83e425bc6ee6d3e632c443a6275ba641fd3e6653
2016-07-28 12:16:07 +00:00
Alexandre Rames
fa4a4bd37d Remove -Wl,--gc-sections and related build options.
It breaks compilation on OSX (tested with OSX 10.9.5).

Change-Id: Ie8012829d9d5d4faa5f67451a44ffd8a5daeba46
2016-07-28 12:16:02 +00:00
Alexandre Rames
2b5d561b62 Manually define MAP_ANONYMOUS when necessary.
Change-Id: I65b3fac08d98ad3182d1922d7af60ae9424152a5
2016-07-28 12:15:56 +00:00
Alexandre Rames
8d0ffa353a Do not compile the AArch32 disassembler example on OSX.
It does not compile: it relies on ELF headers.

Change-Id: Ife8c11c4e4e9f2708f99e2c6bf8db82b021795fd
2016-07-28 12:15:46 +00:00
Alexandre Rames
225c69c0b7 Fix a a call to abs breaking compilation on OSX.
Change-Id: I59cc05b6040ca0a8e7c283bd8db67e4238d03d9c
2016-07-28 12:15:39 +00:00
Alexandre Rames
ca73ba046c Fix #define directives related to ABI and runtime call simulation.
Also add a regression test.

Change-Id: Iad770e7181f3b994590bdee069845885039e8bc4
2016-07-28 12:14:26 +00:00
Alexandre Rames
ad91cee685 Minor fix to a comment for Claim(), Drop(), and Peek().
Change-Id: I7c80121610c99bf3114af7644450209cfdb215cb
2016-07-28 08:23:00 +00:00
Pierre Langlois
d375606001 Keep comments describing an instruction on one line
This patch unwraps comments showing instruction's expected disassembly
in comments. We have a NOLINT marker so clang-format will not wrap it
again.

Change-Id: I66de6b4543e8f068799a89e0cb613ded7bd9ed6f
2016-07-27 17:16:10 +01:00
Alexandre Rames
868bfc49d7 AArch64: Add more Simulator read/write helpers working with GenericOperand.
Change-Id: I4950e9895a7ba458581c7265ca0b08b59048455f
2016-07-25 15:28:38 +00:00
Alexandre Rames
064e02d4e8 AArch64: Support runtime call simulation.
Change-Id: I063c2223a63791e90d8aa9cffc6e88f96d57187e
2016-07-25 15:28:37 +00:00
Alexandre Rames
a9e580275a AArch64: Introduce an ABI helper.
Change-Id: I913269bb0d2cc466decee02044e7516383a8bbb3
2016-07-25 16:20:09 +01:00
Alexandre Rames
4e7c93cc25 AArch64: Introduce a new GenericOperand abstraction.
Currently, a `GenericOperand` can represent a `CPURegister` or a
memory area (`MemOperand` extended by a 'size' field).

Change-Id: Ic37c4da07ea888444ccb1bfbd82646d0c56bbe84
2016-07-25 16:08:17 +01:00
Alexandre Rames
5e7413ae8e AArch32: Update test files after changes to test configuration.
Change-Id: I8da54d5cb40686eea3d58fa1a1d2bac9b467604c
2016-07-25 13:16:48 +00:00
Alexandre Rames
d4e76afa6d Update AArch32 test-generation configuration to reduce the number of tests.
Some assembler tests were *exhaustively* testing the encoding of instructions.
This lead to a few test files taking more than 10 minutes to compile with GCC.
(Clang takes around 15 seconds.)
We reduce the number of tests to a level that is still acceptable, but that also
leads to an acceptable compilation time with gcc.

Before:

    time CXX=clang++ scons all -j40
		898.17s user 19.20s system 1418% cpu 1:04.68 total

    time CXX=g++ scons all -j40
		5275.81s user 53.89s system 742% cpu 11:57.93 total

After:

    time CXX=clang++ scons all -j40
    622.55s user 14.86s system 1319% cpu 48.309 total

    time CXX=g++ scons all -j40
    1239.82s user 27.78s system 2283% cpu 55.517 total

Change-Id: I92c98776c99a35eba2652d837aa4792c0eda71b6
2016-07-25 11:26:41 +01:00
Alexandre Rames
5738e8cdd5 AArch32: Make the test generator add newline at the end of tests.
Otherwise, after regenerating the tests, `clang` fails with:
    error: no newline at end of file [-Werror,-Wnewline-eof]

Change-Id: I794cf5eb711acfac9902a4f4883fc120875f2f90
2016-07-25 11:26:30 +01:00
Alexandre Rames
54fce717d9 AArch32: Do not verify simulator test results when tests cannot be run.
Change-Id: Ie32499560265f9fec6d73b585b6d823286fa9a65
2016-07-25 09:49:25 +00:00
Alexandre Rames
6b5fe94b63 AArch64: Work around undefined behaviour of printf for NaNs.
We manually print NaNs with a known output to have coherent traces across all
implementations of `printf`.

Change-Id: Ice93ab39c6379280c6cb012b911e6fdc15de2445
2016-07-25 08:57:45 +00:00