Commit Graph

2269 Commits

Author SHA1 Message Date
Morgan Phillips
9165eef823 Modify the dominator tree's intersect method to interact with Basic Blocks
Corresponding changes to test cases are also included.
2016-08-23 13:34:40 -07:00
Jakob Stoklund Olesen
ddd205ff78 Upgrade to rustfmt 0.6.0 2016-08-23 11:01:08 -07:00
Jakob Stoklund Olesen
4ebad2060a Add RISC-V encodings for imediate shifts.
Also add the 32-bit shift instructions for RV64.
2016-08-19 15:56:09 -07:00
Jakob Stoklund Olesen
da27e65c25 Add rotate and shift instructions with immediate amounts. 2016-08-19 15:56:09 -07:00
Morgan Phillips
6952fa8aa4 Merge branch 'master' of github.com:stoklund/cretonne 2016-08-18 14:39:02 -07:00
Morgan Phillips
8683541ed3 Add basic block information to the dominator tree.
To be complete the dominator tree must represent idoms as Ebb, Inst pairs, i.e.
bais blocks.
2016-08-18 14:37:32 -07:00
Jakob Stoklund Olesen
55f1e69e3e Use shared quadratic probing for settings. 2016-08-18 13:45:50 -07:00
Jakob Stoklund Olesen
15d0108e4b Add a generic implementation of quadratic hash table probing.
We have multiple pre-computed constant hash tables that all use the same
quadratic probing algorithm.

Add a constant_hash Rust module to match the meta/constant_hash.py module.

Move the simple_hash() function into constant_hash. Its Python equivalent is in
the constant_hash.py module.
2016-08-18 13:44:17 -07:00
Jakob Stoklund Olesen
c3b7fc9a9c Move ir::Function into a sub-module.
Keep the top-level ir module free of implementation details that are
inadvertently exposed to sub-modules.
2016-08-12 16:46:44 -07:00
Jakob Stoklund Olesen
09b7420ca9 Use an EntityMap for stack slots.
Delete the StackSlots iterator and move the remaining StackSlotData into its
own module.
2016-08-12 16:44:39 -07:00
Jakob Stoklund Olesen
40e0989b8b Re-export common types in the cretonne::ir module.
Clients should not have to navigate the ir sub-modules to find commonly used
types.
2016-08-12 16:11:38 -07:00
Jakob Stoklund Olesen
9e87bffa82 Remove tests/lib.rs to avoid running tests twice.
The 'cargo test' command simply compiles each 'tests/*.rs' and runs the
enclosed tests. The 'lib.rs' source would get run as an individual test.
2016-08-12 11:05:29 -07:00
Jakob Stoklund Olesen
84a154a8ca Move integration tests into src/tools/tests.
The integration tests use both libcretonne and libreader, so moving them avoids
the circular dev-dependency.

Also go back to building everything under src/tools/target to avoid rebuilding
the libraries when cargo is invoked in different subdirectories. This speeds up
test-all.sh quite a bit.

Finally, skip the pure debug build. We build "cargo test" and "cargo build
--release" which should cover everything we need.
2016-08-12 10:43:10 -07:00
Jakob Stoklund Olesen
514ebc6bf9 Generate code to precompute predicates.
Each ISA predicate is assigned a bit the the Flags struct, and a corresponding
method is generated.
2016-08-12 10:13:50 -07:00
Jakob Stoklund Olesen
8457f67e34 Introduce predicates.
Predcates are boolean functions. There will be ISA predicates and instruction
predicates.

The ISA predicates will be turned into member functions on the generated Flags
structs.
2016-08-11 16:40:54 -07:00
Jakob Stoklund Olesen
aeb376227e Implement the machinery to create a TargetIsa.
Add an isa::lookup() function which serves as a target registry for creating
Box<TargetIsa> trait objects.

An isa::Builder makes it possible to confugure the trait object before it is
created.
2016-08-11 11:52:11 -07:00
Jakob Stoklund Olesen
8c48739afd Document ISA builder. 2016-08-10 15:48:19 -07:00
Jakob Stoklund Olesen
b9baf06fb7 Add a settings::Builder data type.
- Move detail data structures into a settings::detail module to avoid polluting
  the settings namespace.

- Rename generated data types to 'Flags' in anticipation of computed predicate
  flags that can't be set. The Flags struct is immutable.

- Use a settings::Builder struct to manipulate settings, then pass it to
  Flags::new().
2016-08-10 15:47:06 -07:00
Jakob Stoklund Olesen
1ef72dd5ec Add support for enumerated settings.
The EnumSetting objects can take one of 256 named values.
2016-08-09 15:13:43 -07:00
Jakob Stoklund Olesen
07e851a222 Add settings::Stringwise.
This trait allows settings to be manipulated as strings, using descriptors and
constant hash-table lookups.

Amend gen_settings.py to generate the necessary constant tables.
2016-08-09 15:04:42 -07:00
Jakob Stoklund Olesen
d152719d93 Move simple_hash into its own module. 2016-08-09 15:04:42 -07:00
Jakob Stoklund Olesen
36ad7da3ec Add ISA-dependent settings for RISC-V. 2016-08-05 16:19:46 -07:00
Jakob Stoklund Olesen
cfeefde3fc Scaffolding for defining settings.
Settings can be defined globally or per-ISA. They are available to code through
a generated Settings struct with accessor methods per setting.
2016-08-05 15:50:57 -07:00
Jakob Stoklund Olesen
6b69391289 Scaffold implementation of the TargetIsa trait.
More to come here.
2016-08-05 09:55:53 -07:00
Jakob Stoklund Olesen
92f84c655b Rename meta/target -> meta/isa.
Clarify terminology by always referring to a 'Target ISA' instead of just
'Target'. Use 'isa' as a module name instead of 'target' both in Rust and Python
code.

This is only to clarify terminology and not at all because Cargo insists on
using the 'target' sub-directory for build products. Oh, no. Not at all.
2016-08-04 11:50:19 -07:00
Jakob Stoklund Olesen
c47c524017 Add an empty isa/riscv module scaffold.
Targeted ISAs will be defined as sub-modules of isa.
2016-08-04 11:39:25 -07:00
Jakob Stoklund Olesen
5bd2117ad7 Don't sphinx-autobuild on Vim .swp file changes. 2016-08-04 11:28:38 -07:00
Jakob Stoklund Olesen
24c97ce6e5 Verify that type variables have been fully bound.
The shift instructions have two type variables since the shift amount can be a
differently sized integer. Fix the RISC-V shift encodings to reflect this, and
allow i64 registers to be shifted by an i32 amount.
2016-08-04 10:21:48 -07:00
Jakob Stoklund Olesen
c1d32167dc Use dot syntax to bind type variables on instructions.
Encodings need to refer to concrete instances of polymorphic instructions by
binding type variables. Allow dot syntax like iadd.i32 to do that.
2016-08-03 16:30:47 -07:00
Jakob Stoklund Olesen
9cdf6edd62 Add an Encoding meta-language class.
Start adding some RISC-V encodings too as a way of testing the ergonomics.
2016-08-03 16:04:29 -07:00
Jakob Stoklund Olesen
d215b622e4 Add an EncRecipe meta-language class.
Move the CPUMode reference from EncRecipe to the Encoding itself, allowing
EncRecipes to be shared between CPU modes. At least RISC-V should be able to
share some recipes between RV32 and RV64 modes.
2016-08-03 12:06:21 -07:00
Jakob Stoklund Olesen
c4faef196e Add a CPUMode meta-language class. 2016-08-03 11:20:13 -07:00
Jakob Stoklund Olesen
bd72439fbc Document binary encodings.
Describe the meta-language data structures that are built to represent
instruction encodings.

Begin a metaref glossary.
2016-08-02 16:02:20 -07:00
Jakob Stoklund Olesen
f5008567c9 Add PrimaryEntityData marker trait.
Require this trait on the value type stored in an EntityMap to 'unlock' the
methods intended for primary entity maps that are allowed to create references
with the 'push method.

This prevents accidentally depending on these methods in secondary maps.
2016-08-01 19:52:57 -07:00
Morgan Phillips
549a14bf96 Merge branch 'master' of github.com:stoklund/cretonne into cfg-fix 2016-08-01 18:06:59 -07:00
Morgan Phillips
80abf8b1f0 Remove uses of EntityMap::len. 2016-08-01 18:04:25 -07:00
Jakob Stoklund Olesen
2c1e80b0e0 Remove the cfg::predecessors_iter() method and iterator.
This iterator enumerates all EBB references whether they are in the layout or
not. That is usually not what is needed when working with the CFG.

It is better to iterate over EBB referrences in layout order, or in reverse
post-order and then call the get_predecessors() method for each Ebb reference.

See the new implementation of print_cfg::cfg_connections().
2016-08-01 15:18:34 -07:00
Jakob Stoklund Olesen
02c1bb8f2c Print CFG edges from func.layout instead of cfg.predecessors_iter.
EBBs not in the layout should never be printed as part of the CFG.
2016-08-01 15:18:34 -07:00
Morgan Phillips
e9cfcf4f78 Improve the structure and comments of the module. 2016-08-01 15:00:08 -07:00
Morgan Phillips
5a38ca2db7 Remove println\! 2016-08-01 12:15:08 -07:00
Morgan Phillips
19a47d57b3 Add a dominator tree implementation. 2016-07-31 21:40:11 -07:00
Morgan Phillips
0ce01c1b8d Clean up the CFG representation. 2016-07-31 21:31:18 -07:00
Jakob Stoklund Olesen
bbdae39cb9 Add EntityMap::with_capacity.
Create a secondary entity map with space reserved for a known range of entity
references.

Add dfg.num_ebbs() and dfg.num_insts() methods to provide capacities.
2016-07-29 15:59:09 -07:00
Jakob Stoklund Olesen
14027660c5 Use sub-shells instead of pushd / popd.
The push and pop commands print the directory stack to stdout, while subshells
and cd is quiet.
2016-07-29 12:35:56 -07:00
Morgan Phillips
a9748dff02 Remove innacurate comments. 2016-07-28 17:51:50 -07:00
Morgan Phillips
858d756631 Merge branch 'master' of github.com:stoklund/cretonne into bleh 2016-07-28 17:49:48 -07:00
Morgan Phillips
82ff64820c Simplify the reverse_postorder_ebbs implementation. 2016-07-28 17:49:25 -07:00
Jakob Stoklund Olesen
ad79ad753d Documentation typos. 2016-07-27 16:10:02 -07:00
Morgan Phillips
e94d7c2a99 Avoid cloning levels 2016-07-26 17:13:11 -07:00
Morgan Phillips
1cd6e35a42 Give the test module a more apt name. 2016-07-26 12:07:18 -07:00