Commit Graph

8918 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
03170927dd Add a job queue and begin loading test files.
This code looks overly complicated because it is anticipating running
jobs in a thread pool.

The test files are loaded and parsed, but not actually executed yet.
Errors are reported back to the test runner.
2016-09-14 15:23:50 -07:00
Jakob Stoklund Olesen
a24ca56c0d Add a job queue and begin loading test files.
This code looks overly complicated because it is anticipating running
jobs in a thread pool.

The test files are loaded and parsed, but not actually executed yet.
Errors are reported back to the test runner.
2016-09-14 15:23:50 -07:00
Jakob Stoklund Olesen
99c04383c8 Add a utility read_to_string() function. 2016-09-14 13:24:17 -07:00
Jakob Stoklund Olesen
480054a094 Add a utility read_to_string() function. 2016-09-14 13:24:17 -07:00
Jakob Stoklund Olesen
ddadf2e7c1 Add scaffolding for a 'cton-util test' command.
This command accepts files and directories containing test cases to run.
Recursively searches for test files in any directory it is passed.

Actually running tests is not yet implemented.
2016-09-14 13:24:15 -07:00
Jakob Stoklund Olesen
4521afd474 Add scaffolding for a 'cton-util test' command.
This command accepts files and directories containing test cases to run.
Recursively searches for test files in any directory it is passed.

Actually running tests is not yet implemented.
2016-09-14 13:24:15 -07:00
Jakob Stoklund Olesen
538b773e6d Parse test commands in a .cton file.
The top-level parse_test() function now parses test commands in the
preamble of a .cton file.
2016-09-14 09:10:32 -07:00
Jakob Stoklund Olesen
a544c0e171 Parse test commands in a .cton file.
The top-level parse_test() function now parses test commands in the
preamble of a .cton file.
2016-09-14 09:10:32 -07:00
Jakob Stoklund Olesen
21ad1d1e2d Add a public rest_of_line() function to lexer.
This is used to grap the tail of a 'test' line which doesn't use the
same tokens as a normal .cton file.
2016-09-13 16:50:10 -07:00
Jakob Stoklund Olesen
55a89c2167 Add a public rest_of_line() function to lexer.
This is used to grap the tail of a 'test' line which doesn't use the
same tokens as a normal .cton file.
2016-09-13 16:50:10 -07:00
Jakob Stoklund Olesen
4e3f0fc41d Collect comments while parsing functions.
The result from parsing a function is now a DetailedFunction which
includes all comments that can be associated with an entity.

Comments before the first function are ignored, everything else is
associated with the preceeding entity.

The parse_functions() function still returns plain functions.
2016-09-13 16:15:42 -07:00
Jakob Stoklund Olesen
dedc44be69 Collect comments while parsing functions.
The result from parsing a function is now a DetailedFunction which
includes all comments that can be associated with an entity.

Comments before the first function are ignored, everything else is
associated with the preceeding entity.

The parse_functions() function still returns plain functions.
2016-09-13 16:15:42 -07:00
Jakob Stoklund Olesen
458ecebe8f Add a next_key() method to primary entity maps.
It is sometimes useful to know the entity reference number that will be
assigned to the next thing added to a map.
2016-09-13 16:14:46 -07:00
Jakob Stoklund Olesen
525c69bbe8 Add a next_key() method to primary entity maps.
It is sometimes useful to know the entity reference number that will be
assigned to the next thing added to a map.
2016-09-13 16:14:46 -07:00
Jakob Stoklund Olesen
1b6623f068 Add a representation of a parsed test case file.
The new exported function `parse_test()` will produce it eventually.
2016-09-13 16:14:29 -07:00
Jakob Stoklund Olesen
4fd15f98ed Add a representation of a parsed test case file.
The new exported function `parse_test()` will produce it eventually.
2016-09-13 16:14:29 -07:00
Jakob Stoklund Olesen
fcec517fc5 Simplify the interface to cretonne-reader.
Export a single function: parse_functions() which results a vector of
functions parsed from the source string.

Hide the parser and lexer modules. They are not useful to external
clients.
2016-09-13 11:01:21 -07:00
Jakob Stoklund Olesen
169a2f7542 Simplify the interface to cretonne-reader.
Export a single function: parse_functions() which results a vector of
functions parsed from the source string.

Hide the parser and lexer modules. They are not useful to external
clients.
2016-09-13 11:01:21 -07:00
Jakob Stoklund Olesen
c80934d084 Add a data structure representing a parsed test command.
It's not used for anything yet.
2016-09-13 10:51:15 -07:00
Jakob Stoklund Olesen
d0fb647357 Add a data structure representing a parsed test command.
It's not used for anything yet.
2016-09-13 10:51:15 -07:00
Jakob Stoklund Olesen
b14be8b14b Add an AnyEntity enum type.
This type can reference any type of entity in a function. It will be
used for the location of verifier error messages and other annotations.
2016-09-12 15:14:15 -07:00
Jakob Stoklund Olesen
eeb8f5e4e4 Add an AnyEntity enum type.
This type can reference any type of entity in a function. It will be
used for the location of verifier error messages and other annotations.
2016-09-12 15:14:15 -07:00
Jakob Stoklund Olesen
1c5547970a Idiomatic impl of unordered_begin. 2016-09-10 12:33:58 -07:00
Jakob Stoklund Olesen
0eea144fef Idiomatic impl of unordered_begin. 2016-09-10 12:33:58 -07:00
Jakob Stoklund Olesen
38952eea00 Add an explainer mode to filecheck.
The -c flag to 'cton-util filecheck' will now print out a description of how
the directives are matching the input.

This explanation is also printed when a match fails.
2016-09-09 17:08:29 -07:00
Jakob Stoklund Olesen
8483dc1085 Add an explainer mode to filecheck.
The -c flag to 'cton-util filecheck' will now print out a description of how
the directives are matching the input.

This explanation is also printed when a match fails.
2016-09-09 17:08:29 -07:00
Jakob Stoklund Olesen
1ce5bc3509 pub 2016-09-09 14:32:07 -07:00
Jakob Stoklund Olesen
b9d6ff2b51 pub 2016-09-09 14:32:07 -07:00
Jakob Stoklund Olesen
d9cceb18d3 Add a MatchRange type alias.
The regex library also uses (usize, usize) for ranges. The type alias is just
to make it clearer what the tuple means.
2016-09-09 14:11:56 -07:00
Jakob Stoklund Olesen
7317775052 Add a MatchRange type alias.
The regex library also uses (usize, usize) for ranges. The type alias is just
to make it clearer what the tuple means.
2016-09-09 14:11:56 -07:00
Jakob Stoklund Olesen
9772398ae4 Convert the DFG tests to use filecheck. 2016-09-09 11:09:54 -07:00
Jakob Stoklund Olesen
e41853cab0 Convert the DFG tests to use filecheck. 2016-09-09 11:09:54 -07:00
Jakob Stoklund Olesen
42cdebd508 Add a cton-util filecheck sub-command. 2016-09-09 10:54:57 -07:00
Jakob Stoklund Olesen
c95c23dbbe Add a cton-util filecheck sub-command. 2016-09-09 10:54:57 -07:00
Jakob Stoklund Olesen
71b742ec34 Add a libfilecheck crate.
This library implements functionality similar to LLVM's FileCheck utility, but
in library form.
2016-09-09 10:45:10 -07:00
Jakob Stoklund Olesen
5b22634c8d Add a libfilecheck crate.
This library implements functionality similar to LLVM's FileCheck utility, but
in library form.
2016-09-09 10:45:10 -07:00
Morgan Phillips
d8712b2ce6 Add a verifier
The current implementation only performs a few basic checks.
2016-09-06 14:09:09 -07:00
Morgan Phillips
de04d6d083 Add a verifier
The current implementation only performs a few basic checks.
2016-09-06 14:09:09 -07:00
Jakob Stoklund Olesen
78a9e67a09 Emit ISA predicates in the encoding tables.
Use the new ISA predicate numbering to emit ISA predicate instructions in the
encoding tables.

Properly decode the ISA predicate number in RISC-V and add tests for RV32M iwth
and without 'supports_m' enabled.
2016-08-31 16:00:33 -07:00
Jakob Stoklund Olesen
116b898da3 Emit ISA predicates in the encoding tables.
Use the new ISA predicate numbering to emit ISA predicate instructions in the
encoding tables.

Properly decode the ISA predicate number in RISC-V and add tests for RV32M iwth
and without 'supports_m' enabled.
2016-08-31 16:00:33 -07:00
Jakob Stoklund Olesen
de330402b8 Add casual string representation of named settings and predicates.
Use 'group.setting' format for named predicates, only display the expression
for anonymous predicates.
2016-08-31 15:46:05 -07:00
Jakob Stoklund Olesen
f305f50829 Add casual string representation of named settings and predicates.
Use 'group.setting' format for named predicates, only display the expression
for anonymous predicates.
2016-08-31 15:46:05 -07:00
Jakob Stoklund Olesen
88c8e9a59a Move byte-vector layout into SettingGroup.layout().
Move all the byte-sized settings to the front of the byte-vector, and add a
mechanism for assigning numbers to predicates that have no name as well as
predicates from the parent settings group.

This way, all the boolean predicates that are used by a target ISA appear as a
contiguous bit-vector that is a suffix of the settings byte-vector. This
bit-vector can then be indexed linearly when resolving ISA predicates on
encodings.

Add a numbered_predicate() method to the generated Flags structs that can read
a predicate by number dynamically.
2016-08-31 12:25:57 -07:00
Jakob Stoklund Olesen
84b0a92326 Move byte-vector layout into SettingGroup.layout().
Move all the byte-sized settings to the front of the byte-vector, and add a
mechanism for assigning numbers to predicates that have no name as well as
predicates from the parent settings group.

This way, all the boolean predicates that are used by a target ISA appear as a
contiguous bit-vector that is a suffix of the settings byte-vector. This
bit-vector can then be indexed linearly when resolving ISA predicates on
encodings.

Add a numbered_predicate() method to the generated Flags structs that can read
a predicate by number dynamically.
2016-08-31 12:25:57 -07:00
Jakob Stoklund Olesen
036fa46b37 Fix typo in predicate combination. 2016-08-31 08:48:31 -07:00
Jakob Stoklund Olesen
be8d486113 Fix typo in predicate combination. 2016-08-31 08:48:31 -07:00
Jakob Stoklund Olesen
997919c696 Add encodings for imul instructions to RISC-V.
This is just the basic 'imul' the M instruction set also has mulh/mulhu which
yield the high bits of a multiplication, and there are div/rem instructions to
be implemented.

These instructions are gated by the use_m predicate, but ISA predicates are not
completely implemented yet.
2016-08-30 16:16:28 -07:00
Jakob Stoklund Olesen
a1cbeb7f7a Add encodings for imul instructions to RISC-V.
This is just the basic 'imul' the M instruction set also has mulh/mulhu which
yield the high bits of a multiplication, and there are div/rem instructions to
be implemented.

These instructions are gated by the use_m predicate, but ISA predicates are not
completely implemented yet.
2016-08-30 16:16:28 -07:00
Jakob Stoklund Olesen
09734f2033 Add controls for enabling M, F, and D RISC-V extensions.
Three predicates affect each extension:

- supports_m determines whether the target CPU supports the instruction set.
- enable_m determines if the instructions should be used, assuming they're
  available.
- use_m is the predicate used to actually use the instructions.
2016-08-30 15:44:26 -07:00
Jakob Stoklund Olesen
c1971db091 Add controls for enabling M, F, and D RISC-V extensions.
Three predicates affect each extension:

- supports_m determines whether the target CPU supports the instruction set.
- enable_m determines if the instructions should be used, assuming they're
  available.
- use_m is the predicate used to actually use the instructions.
2016-08-30 15:44:26 -07:00