Commit Graph

10539 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
21b0eae044 Fix build. 2016-05-02 16:04:21 -07:00
Jakob Stoklund Olesen
24970593ac Implement value lists.
Values that are defined together are represented as a singly linked list. These
lists appear in:

- Instructions with multiple result values. The first result value is special, and the
  following results form a linked list of Def extended_value table entries.

- EBB arguments are represented as a linked list of Argument extended_value
  table entries. The EbbData struct has pointers to the first and last argument
  to allow fast insertion at both ends.

Add a Values iterator type whicih can enumerate both kinds of value lists.
2016-05-02 15:36:54 -07:00
Jakob Stoklund Olesen
1d768ff734 Implement value lists.
Values that are defined together are represented as a singly linked list. These
lists appear in:

- Instructions with multiple result values. The first result value is special, and the
  following results form a linked list of Def extended_value table entries.

- EBB arguments are represented as a linked list of Argument extended_value
  table entries. The EbbData struct has pointers to the first and last argument
  to allow fast insertion at both ends.

Add a Values iterator type whicih can enumerate both kinds of value lists.
2016-05-02 15:36:54 -07:00
Jakob Stoklund Olesen
ab50f17412 Implement Index<Inst/StackSlot> for Function.
When Function serves as a container for IL entities, use the Index trait to
translate a reference class to a Data object.

Works for:

- StackSlot -> StackSlotData
- Inst -> InstructionData
2016-05-02 12:13:24 -07:00
Jakob Stoklund Olesen
e026b36db4 Implement Index<Inst/StackSlot> for Function.
When Function serves as a container for IL entities, use the Index trait to
translate a reference class to a Data object.

Works for:

- StackSlot -> StackSlotData
- Inst -> InstructionData
2016-05-02 12:13:24 -07:00
Jakob Stoklund Olesen
aec94912d7 Exit test script on errors. 2016-04-29 15:45:48 -07:00
Jakob Stoklund Olesen
e414ce6315 Exit test script on errors. 2016-04-29 15:45:48 -07:00
Jakob Stoklund Olesen
a6c9d2b339 Build status badge. 2016-04-29 15:33:24 -07:00
Jakob Stoklund Olesen
3c0e2f6e9d Build status badge. 2016-04-29 15:33:24 -07:00
Jakob Stoklund Olesen
c344dbf437 Set up Travis CI 2016-04-29 15:31:25 -07:00
Jakob Stoklund Olesen
4e4c634666 Set up Travis CI 2016-04-29 15:31:25 -07:00
Jakob Stoklund Olesen
3d4103bf79 Rename the 'cretonne' binary.
It soome that 'cargo doc' gets confused when there is both a library crate
and a binary called 'cretonne'.
2016-04-29 15:15:45 -07:00
Jakob Stoklund Olesen
d34ced5437 Rename the 'cretonne' binary.
It soome that 'cargo doc' gets confused when there is both a library crate
and a binary called 'cretonne'.
2016-04-29 15:15:45 -07:00
Jakob Stoklund Olesen
01ed9fc6c8 Rename libraries
libctonfile -> libreader.

This library will only provide .cton file reading/parsing services which are
not needed after deployment.

Code for writing .cton files lives in the main cretonne library because it is
fairly small, and because it is useful for extracting test cases from a
deployed library.
2016-04-29 15:00:16 -07:00
Jakob Stoklund Olesen
810a90e322 Rename libraries
libctonfile -> libreader.

This library will only provide .cton file reading/parsing services which are
not needed after deployment.

Code for writing .cton files lives in the main cretonne library because it is
fairly small, and because it is useful for extracting test cases from a
deployed library.
2016-04-29 15:00:16 -07:00
Jakob Stoklund Olesen
b390b3113a Add a write.rs module.
Convert a function to text.
2016-04-29 13:53:14 -07:00
Jakob Stoklund Olesen
ddea422ceb Add a write.rs module.
Convert a function to text.
2016-04-29 13:53:14 -07:00
Jakob Stoklund Olesen
8f65207ed1 Use x.to_string() instead of format!("{}", x).
Both use the Display trait.
2016-04-29 11:55:40 -07:00
Jakob Stoklund Olesen
5c4f3d01e2 Use x.to_string() instead of format!("{}", x).
Both use the Display trait.
2016-04-29 11:55:40 -07:00
Jakob Stoklund Olesen
ed6677d576 Parse stack slot decls.
Add a stack slot array to repr::Function, use repr::StackSlot to reference them.

Parse stack slot declarations in the function preamble, add them to the
function.

Add a new `Context` struct which keeps track of mappings between identifiers
used in the file and real references.
2016-04-28 17:35:01 -07:00
Jakob Stoklund Olesen
88931983a8 Parse stack slot decls.
Add a stack slot array to repr::Function, use repr::StackSlot to reference them.

Parse stack slot declarations in the function preamble, add them to the
function.

Add a new `Context` struct which keeps track of mappings between identifiers
used in the file and real references.
2016-04-28 17:35:01 -07:00
Jakob Stoklund Olesen
d1c79e8916 Add FunctionName, Signature to repr::Function.
Simplify the uses in parser.rs to avoid too many module qualifiers.
2016-04-28 14:54:17 -07:00
Jakob Stoklund Olesen
021bde1191 Add FunctionName, Signature to repr::Function.
Simplify the uses in parser.rs to avoid too many module qualifiers.
2016-04-28 14:54:17 -07:00
Jakob Stoklund Olesen
90b3e16b56 Tests for signature parser. 2016-04-28 14:39:47 -07:00
Jakob Stoklund Olesen
41d95c0342 Tests for signature parser. 2016-04-28 14:39:47 -07:00
Jakob Stoklund Olesen
716b427cb1 Add top-level productions to language reference. 2016-04-28 14:39:42 -07:00
Jakob Stoklund Olesen
42364fda59 Add top-level productions to language reference. 2016-04-28 14:39:42 -07:00
Jakob Stoklund Olesen
8067a17977 Fix documentation badge. 2016-04-28 09:09:34 -07:00
Jakob Stoklund Olesen
cda7943b0b Fix documentation badge. 2016-04-28 09:09:34 -07:00
Jakob Stoklund Olesen
65dfef16e9 Begin parser unit tests, add public interface.
The main entry point is Parser::parse().
2016-04-28 09:05:11 -07:00
Jakob Stoklund Olesen
07afc6e8da Begin parser unit tests, add public interface.
The main entry point is Parser::parse().
2016-04-28 09:05:11 -07:00
Jakob Stoklund Olesen
615d9825e5 Simplify parser.
Use 'if let' instead of 'match' where it makes sense.

Use EBNF notation for the grammar rules. This simplifies repetition a lot.
2016-04-28 08:06:30 -07:00
Jakob Stoklund Olesen
8d0311b642 Simplify parser.
Use 'if let' instead of 'match' where it makes sense.

Use EBNF notation for the grammar rules. This simplifies repetition a lot.
2016-04-28 08:06:30 -07:00
Jakob Stoklund Olesen
c69a21f79e Parser for .cton files.
Recursive descent parser, although with this simple grammar there won't be any
recursion.
2016-04-27 17:11:05 -07:00
Jakob Stoklund Olesen
f1a4b28d3f Parser for .cton files.
Recursive descent parser, although with this simple grammar there won't be any
recursion.
2016-04-27 17:11:05 -07:00
Jakob Stoklund Olesen
7ccef63077 Handle value type names in the lexer. 2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
c712ddc776 Handle value type names in the lexer. 2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
1228abca29 Begin lexer implementation.
Add a lexer module which implements the lexical analysis of .cton files.
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
ab74770ffe Begin lexer implementation.
Add a lexer module which implements the lexical analysis of .cton files.
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
bbeafde243 Type::by() returns an Optional<Type>.
Don't use assertions to enforce the limits on SIMD lanes in a type, Type is too
fundamental for that. Instead, the Vector-forming by() method returns an
Optional<Type>, and None if the requested SIMD vector is not valid.

Same for Type::half_vector().
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
9e00ce5081 Type::by() returns an Optional<Type>.
Don't use assertions to enforce the limits on SIMD lanes in a type, Type is too
fundamental for that. Instead, the Vector-forming by() method returns an
Optional<Type>, and None if the requested SIMD vector is not valid.

Same for Type::half_vector().
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
c0f77f35c7 Add function signatures.
Describe function argument and return value types along with flags for passing
values in an ABI-compliant way.
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
04d3b10564 Add function signatures.
Describe function argument and return value types along with flags for passing
values in an ABI-compliant way.
2016-04-27 17:07:54 -07:00
Jakob Stoklund Olesen
58f70ef12d Implement FromStr for Imm64, Ieee32, Ieee64.
These are bitwise exact conversions from string to immediates, implementing the
inverse of the Display trait.

Only accept hexadecimal floating point numbers to avoid issues with rounding
when converting decimal numbers to binary.
2016-04-27 17:07:46 -07:00
Jakob Stoklund Olesen
6a1f74125f Implement FromStr for Imm64, Ieee32, Ieee64.
These are bitwise exact conversions from string to immediates, implementing the
inverse of the Display trait.

Only accept hexadecimal floating point numbers to avoid issues with rounding
when converting decimal numbers to binary.
2016-04-27 17:07:46 -07:00
Jakob Stoklund Olesen
71f8fe1cb1 Migrate to readthedocs.io 2016-04-27 17:05:02 -07:00
Jakob Stoklund Olesen
f1d43652ad Migrate to readthedocs.io 2016-04-27 17:05:02 -07:00
Jakob Stoklund Olesen
9a6f79a9ba Add some scaffolding for building more crates.
The src/tools directory contains the cretonne-tools crate which will build
binaries for testing cretonne.

The src/libctonfile directory contains the ctonfile library crate which
provides reading and writing of .cton files.
2016-04-08 12:55:29 -07:00
Jakob Stoklund Olesen
4f40a2ae79 Add some scaffolding for building more crates.
The src/tools directory contains the cretonne-tools crate which will build
binaries for testing cretonne.

The src/libctonfile directory contains the ctonfile library crate which
provides reading and writing of .cton files.
2016-04-08 12:55:29 -07:00
Jakob Stoklund Olesen
661ac9e7ad Implement std::str::FromStr for matching opcodes.
Replace the home-grown from_str function.
2016-04-08 11:06:33 -07:00