Commit Graph

28 Commits

Author SHA1 Message Date
lazypassion
747ad3c4c5 moved crates in lib/ to src/, renamed crates, modified some files' text (#660)
moved crates in lib/ to src/, renamed crates, modified some files' text (#660)
2019-01-28 15:56:54 -08:00
Dan Gohman
c61f8a5baf Rename langref.rst to ir.rst.
This aligns with our use of the term "IR" rather than "IL" or
other terms involving "language".
2018-08-02 09:18:59 -07:00
Dan Gohman
c42bed7452 Update paths for the meta => meta-python rename. 2018-08-01 05:05:33 -07:00
Dan Gohman
f4dbd38a4c Rename Cretonne to Cranelift! 2018-07-13 09:15:16 -07:00
Dan Gohman
970045c309 Set clobbers_flags to False for urm_noflags_abcd.
`urm_noflags` is a variant of `urm` which doesn't clobber the flags, and
`urm_noflags_abcd` is a further variant for ABCD registers, so it also
doesn't clobber the flags.
2018-06-05 11:30:35 -07:00
Dan Gohman
4e67e08efd Use the target-lexicon crate.
This switches from a custom list of architectures to use the
target-lexicon crate.

 - "set is_64bit=1; isa x86" is replaced with "target x86_64", and
   similar for other architectures, and the `is_64bit` flag is removed
   entirely.

 - The `is_compressed` flag is removed too; it's no longer being used to
   control REX prefixes on x86-64, ARM and Thumb are separate
   architectures in target-lexicon, and we can figure out how to
   select RISC-V compressed encodings when we're ready.
2018-05-30 06:13:35 -07:00
Dan Gohman
9e48344f7f Update examples to reflect that Cretonne indices typically start at 0. 2018-04-27 06:02:59 -07:00
Dan Gohman
24fa169e1f Rename the 'cretonne' crate to 'cretonne-codegen'.
This fixes the next part of #287.
2018-04-17 09:46:56 -07:00
Dan Gohman
6606b88136 Optimize immediates and compare and branch sequences (#286)
* Add a pre-opt optimization to change constants into immediates.

This converts 'iadd' + 'iconst' into 'iadd_imm', and so on.

* Optimize away redundant `bint` instructions.

Cretonne has a concept of "Testable" values, which can be either boolean
or integer. When the an instruction needing a "Testable" value receives
the result of a `bint`, converting boolean to integer, eliminate the
`bint`, as it's redundant.

* Postopt: Optimize using CPU flags.

This introduces a post-legalization optimization pass which converts
compare+branch sequences to use flags values on CPUs which support it.

* Define a form of x86's `urm` that doesn't clobber FLAGS.

movzbl/movsbl/etc. don't clobber FLAGS; define a form of the `urm`
recipe that represents this.

* Implement a DCE pass.

This pass deletes instructions with no side effects and no results that
are used.

* Clarify ambiguity about "32-bit" and "64-bit" in comments.

* Add x86 encodings for icmp_imm.

* Add a testcase for postopt CPU flags optimization.

This covers the basic functionality of transforming compare+branch
sequences to use CPU flags.

* Pattern-match irsub_imm in preopt.
2018-03-30 12:30:07 -07:00
Dan Gohman
57cd69d8b4 Say "IR" instead of "IL".
While the specifics of these terms are debatable, "IR" generally
isn't incorrect in this context, and is the more widely recognized
term at this time.

See also the discussion in #267.

Fixes #267.
2018-03-28 22:07:26 -07:00
Dan Gohman
e889b88d04 Split filecheck out into its own repo. 2018-03-15 15:35:48 -07:00
Dan Gohman
965b93bd2a Move the filetest harness into its own crate.
This allows us to run the tests via a library call rather than just
as a command execution. And, it's a step toward a broader goal, which
is to keep the code in the top-level src directory minimal, with
important functionality exposed as crates.
2018-03-15 15:35:48 -07:00
Dan Gohman
00af7a28f3 Run the filetests as part of "cargo test".
Refactor the filetests harness so that it can be run as part of
`cargo test`. And begin reorganizing the test harness code in preparation
for moving it out of the src directory.
 - Test subcommand files are now named `test_*.rs`.
 - cton-util subcommand files now just export their `run` and nothing else.
 - src/filetest/mod.rs now also just exports `run` and nothing else.
 - Tests are now run in release mode (with debug assertions enabled).
2018-03-15 13:38:21 -07:00
Dan Gohman
8df9fe6c87 Fix obsolete paths in comments. 2018-03-09 15:08:54 -08:00
Dan Gohman
10dcfcacdb Remove support for entity variables in filecheck.
Now that the parser doesn't renumber indices, there's no need for entity
variables like $v0.
2018-02-20 17:27:46 -08:00
Jakob Stoklund Olesen
7d5f2f0404 Convert the CFG traversal tests to file tests.
Add a "cfg_postorder:" printout to the "test domtree" file tests and use
that to check the computed CFG post-order instead of doing it manually
with Rust code.
2017-12-08 13:58:18 -08:00
Jakob Stoklund Olesen
04f6ccabe5 Allow filecheck directives with "test compile".
Things like inserted prologues and epilogues in #201 can be tested this
way.
2017-12-04 09:44:06 -08:00
Dan Gohman
4a5d48fe11 Documentation fixes (#103)
* Clarify that extended basic blocks are abbreviated as EBB.

* Fix typo.

* Fix a typo.

* Fix typos.

* Use the same phrase to indicate scalar-only as other places in the doc.

* Mention that `band_imm` and friends are scalar-only.

And mention that they're equivalent to their respective
non-immediate-form counterparts.
2017-06-22 12:01:32 -07:00
Aleksey Kuznetsov
706eef23d3 Binary function names (#91)
* Function names should start with %

* Create FunctionName from string

* Implement displaying of FunctionName as %nnnn with fallback to #xxxx

* Run rustfmt and fix FunctionName::with_string in parser

* Implement FunctionName::new as a generic function

* Binary function names should start with #

* Implement NameRepr for function name

* Fix examples in docs to reflect that function names start with %

* Rebase and fix filecheck tests
2017-06-10 10:30:37 -07:00
Dan Gohman
c826aefa0a Start a very simple GVN pass (#79)
* Skeleton simple_gvn pass.
* Basic testing infrastructure for simple-gvn.
* Add can_load and can_store flags to instructions.
* Move the replace_values function into the DataFlowGraph.
* Make InstructionData derive from Hash, PartialEq, and Eq.
* Make EntityList's hash and eq functions panic.
* Change Ieee32 and Ieee64 to store u32 and u64, respectively.
2017-05-18 18:18:57 -07:00
Jakob Stoklund Olesen
6ad34f90aa Allow for unencoded instructions in the binemit tests.
If an instruction doesn't have an associated encoding, use the standard
TargetIsa hook to encode it.

The test still fails if an instruction can't be encoded. There is no
legalization step.
2017-03-29 09:55:49 -07:00
Jakob Stoklund Olesen
f540cb0664 Add a binemit test command.
This makes it possible to write file tests that verify the binary
encoding of machine code.
2017-03-28 15:56:30 -07:00
Jakob Stoklund Olesen
04bddd73ba Add a 'regalloc' filetest command.
Run functions through the register allocator, and then filecheck.
2017-02-22 11:53:01 -08:00
Andrea Canciani
fd3cd153ed Fix some typos in the documentation
These were found by the spellchecker.
2017-01-27 09:51:22 -08:00
Jakob Stoklund Olesen
cb718b869c TestFile preamble comments apply to all functions.
Include the test file preamble comments when building a filecheck
instance for every function in the file.

This makes it possible to define common regex variables in the preamble
and use these definitions for all the functions.
2016-11-04 10:49:09 -07:00
Benjamin Bouvier
419e686581 Fix a few typos in the docs; 2016-10-28 11:31:22 -07:00
Jakob Stoklund Olesen
31e033af49 File stale path references.
After rearranging the directory layout, some paths in documentation
needed updating.

Fix some typos too.
2016-10-24 13:27:10 -07:00
Jakob Stoklund Olesen
acf41a7c09 Add a Cretonne testing guide.
Describe the basics of Rust-level tests, and go into more detail about
the file-level tests.
2016-09-23 11:37:40 -07:00