Commit Graph

1543 Commits

Author SHA1 Message Date
Pat Hickey
9108725b74 extname: extend testcases to 16 chars
this is sufficient for all filetests to pass without truncating
2017-11-23 14:08:47 -08:00
Pat Hickey
eb49d9f8bf tests: update ExternalName api 2017-11-23 14:08:47 -08:00
Pat Hickey
803b83c87a wasm: change to new externalname api 2017-11-23 14:08:47 -08:00
Pat Hickey
1216f81b90 parser: replace binary function name test case with user names 2017-11-23 14:08:47 -08:00
Pat Hickey
2dfc78dbcd reader: lex UserRefs and parse ExternalName::Users 2017-11-23 14:08:47 -08:00
Pat Hickey
894268233e ir::ExternalName representation and constructors rewritten 2017-11-23 14:08:47 -08:00
Jakob Stoklund Olesen
95bdf91e3e Use a bforest::Map for the predecessors in the CFG.
Like before, we store a redundant EBB with each predecessor instruction
which allows invalidate_ebb_successors() to clean up the successor's
predecessor lists even after instructions have been moved around in the
layout.
2017-11-22 13:52:42 -08:00
Jakob Stoklund Olesen
a960730add Add retain() methods to bforest::{Set,Map}.
These work just like their counterparts in HashMap and HashSet.
2017-11-22 13:43:41 -08:00
Jakob Stoklund Olesen
c810b21488 Be more forgiving about what's a "slow" test.
This was supposed to be Q3 + 1.5 IQR, but a braino meant we actually used
Q3 + 2/3 IQR.

Since the distribution of test case times is far from gaussian, bump the
"slow" limit up even further to Q3 + 3 IQR.
2017-11-22 11:48:47 -08:00
Jakob Stoklund Olesen
8e2ce6ded2 Revert "Enable pager in cton-util."
This reverts commit 0538615ccc0b600d4f534dae2ee966d5ed0df9b7.

Fixes #196. The pager functionality wasn't working as intended since
long error messages appear on stdout which isn't captured by the pager.
2017-11-22 11:35:03 -08:00
Jakob Stoklund Olesen
92f378de76 Expose CFG predecessors only as an iterator.
Define two public iterator types in the flowgraph module, PredIter and
SuccIter, which are by-value iterators over an EBB's predecessors and
successors respectively.

Provide matching pred_iter() and succ_iter() methods for inspecting the
CFG. Remove the get_predecessors() method which returned a slice.

Update the uses of get_predecessors(), none of which depended on it
being a slice.

This abstraction makes it possible to change the internal representation
of the CFG.
2017-11-22 09:13:04 -08:00
Tyler McMullen
7956084121 Treat VmContext as positional when using Native CallConv (#195)
* Treat VMContext as standard positional argument when using Native CallConv.

This requires threading the CallConv through legalize_args and into ArgAssigner.

* Stash CallConv in the intel-specific Args struct, for use ArgAssigner.
2017-11-21 17:08:31 -08:00
Jakob Stoklund Olesen
b5d4fb66d9 Use a bforest::Set to represent CFG successor sets.
This has two advantages over the previous Vec<Ebb>:

- Duplicates are removed.
- Clearing the control flow graph is constant time.

The set of EBB successors is simply ordered by EBB number.
2017-11-21 15:03:09 -08:00
Jakob Stoklund Olesen
cf45afa1e7 Avoid the CFG get_successors() when computing a post-order.
The control flow graph does not guarantee any particular ordering for
its successor lists, and the post-order we are computing for building
the dominator tree needs to be "split-invariant".

See #146 for details.

- Discover EBB successors directly from the EBB instruction sequence to
  guarantee that the post-order we compute is canonical/split-invariant.
- Use an alternative graph DFS algorithm which doesn't require indexing
  into a slice of successors.

This changes cfg_postorder in some cases because the edge pruning when
converting the (DAG) CFG to a tree for the DFT is different.
2017-11-21 14:20:57 -08:00
Jakob Stoklund Olesen
2e0b931590 Provide an fmt::Debug impl for entity references.
Instead of deriving a Debug impl: Ebb(45), use the Display version for
Debug too: ebb45.

This is more readable, and no information is lost.
2017-11-21 10:01:55 -08:00
Jakob Stoklund Olesen
2d7b54373f Implement Clone and Default for bforest::{Set,Map}.
The default container is empty. We need a manual implementation of
Default because deriving it seems to imply that K and V generic
parameter types must also implement Default.

Cloning can be used to clone an empty container or for cloning the whole
forest. We can derive this trait because we already require Copy for K
and V.
2017-11-20 15:06:00 -08:00
Jakob Stoklund Olesen
8eaf7d3904 Add iterators for bforest::{Set,Map}.
The iter() methods return an iterator that traverses all set elements /
map key-value pairs. The iterator doesn't require a mutable container
and forest reference, unlike the cursor types.
2017-11-20 14:20:19 -08:00
Jakob Stoklund Olesen
a2ff2a6836 Add goto_first() methods to SetCursor and MapCursor. 2017-11-20 14:16:39 -08:00
Jakob Stoklund Olesen
3389eaef29 Add a clear() method to bforest::{Set,Map}.
This is a lot more efficient that removing entries one by one.
2017-11-20 14:16:19 -08:00
Jakob Stoklund Olesen
d3778e56bb Remove the "BPlus" prefix from bforest::* types.
We'll just use the bforest:: namespace for these types, avoiding the
confusing mix of prefixed and non-prefixed names.

No functional change intended.
2017-11-20 14:15:56 -08:00
Dan Gohman
d51a4c1065 Replace FunctionBuilder's Drop impl with a finalize function. (#193)
* Replace FunctionBuilder's Drop impl with a finalize function.

This has the advantage of not triggering assertion failures in the event
of abandoning a partially-built function. It has the disadvantage of
requiring users to call finalize() explicitly.
2017-11-17 16:03:40 -08:00
Jakob Stoklund Olesen
aa6f5c0db3 Forests of B+ trees.
Add new ordered set and map data structures based on B+-trees. These are
not general-purpose data structures like the BTreeSet and BTreeMap types
in the standard library. They are specialized for:

- Keys and values are small `Copy` types, optimized for 32-bit entities.
- Each set or map has a very small footprint, using only 32 bits of
  memory when empty.
- Keys are compared using a borrowed comparator object which can provide
  context for comparing tiny types that don't contain enough information
  to implement `Ord`.
- A whole forest of B-trees can be cleared in constant time without
  having to traverse the whole data structure.
2017-11-17 07:21:19 -08:00
Jakob Stoklund Olesen
94921c0b74 Remove the dead B-Tree interface.
We're starting over from scratch.
2017-11-17 07:21:19 -08:00
Dan Gohman
bfa5a72b77 Use reserve_exact instead of reserve when the max size is known. 2017-11-16 15:16:23 -08:00
Dan Gohman
4d9aedbaca Add a 'clear()' function to Context.
This includes adding `clear()` functions to its (transitive) members.
2017-11-15 11:15:30 -08:00
Dan Gohman
4c829f7c7f Fix sphinx hyperlink syntax. 2017-11-14 14:09:35 -08:00
Dan Gohman
355e3e3c15 Remove redundant validation for function locals.
Remove the MAX_LOCALS constraint, and the local type validation.
These are checked by whatever is performing proper validation.
2017-11-13 14:34:35 -08:00
Dan Gohman
648c1b33ba Fix sphinx hyperlink syntax. 2017-11-13 14:05:47 -08:00
Dan Gohman
78f2edefc2 Add todos for add/sub with signed overflow, saturating fcvt_to_[su]int. 2017-11-11 17:45:09 -08:00
Dan Gohman
54e4ab71d9 Enable pager in cton-util. 2017-11-10 09:09:00 -08:00
Dan Gohman
8dd46054a5 In the verifier, clarify expected versus observed values. 2017-11-09 22:02:07 -08:00
Dan Gohman
ced7a88ecc Use consistent formatting for module-level comments. 2017-11-08 14:49:27 -08:00
Dan Gohman
e213c2654f Fix branch_destination/analyze_branch for BranchInt/BranchFloat. 2017-11-08 10:58:03 -08:00
Dan Gohman
889b06fd16 Replace as casts with type-conversion functions. 2017-11-08 10:48:44 -08:00
Dan Gohman
7c579a80c2 Avoid an unneeded .into_iter(). 2017-11-08 10:43:12 -08:00
Dan Gohman
d939bc5137 Use is_empty() instead of comparing len() with 0. 2017-11-08 10:43:12 -08:00
Dan Gohman
5d3ae0596c Avoid matching with reference patterns. 2017-11-08 10:43:12 -08:00
Dan Gohman
809e2f0c91 Avoid unneeded return keywords. 2017-11-08 10:43:12 -08:00
Dan Gohman
0d825b4643 Remove a redundant .into(). 2017-11-08 10:43:11 -08:00
Dan Gohman
3ab4349c1b Use Self instead of repeating the type name. 2017-11-08 10:43:11 -08:00
Dan Gohman
b7f979a8be Combine identical match arms. 2017-11-08 10:40:43 -08:00
Dan Gohman
388ebde41d Use .any(...) rather than .position(...).is_some(). 2017-11-08 10:40:42 -08:00
Dan Gohman
8b053aa923 Remove a trivial cast. 2017-11-08 10:40:39 -08:00
Dan Gohman
24e185c8c5 Remove unnecessary parens. 2017-11-08 10:40:37 -08:00
Dan Gohman
d7796cbf25 Suppress an unused-import warning on AsciiExt.
See

https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726

for details.
2017-11-08 10:40:29 -08:00
Dan Gohman
2b6502ac6e Fix handling of CFG triangles in compute_postorder.
For example, in `loops_one`, ebb3 is the bottom of a triangle, so
postorder should order it after the rest of the triangle.
2017-11-07 16:57:22 -08:00
Dan Gohman
849f090562 Fix nondeterminism in br_table translation. 2017-11-07 15:33:35 -08:00
Dan Gohman
15aff899ee Block no longer needs to implement Hash. 2017-11-07 15:19:55 -08:00
Dan Gohman
6d91a32d39 Add comments about "user" parameters. 2017-11-07 15:13:46 -08:00
Dan Gohman
cbb99bf233 Rename "user_arg_count" to "user_param_count" for consistency. 2017-11-07 15:13:46 -08:00