Commit Graph

1829 Commits

Author SHA1 Message Date
Tyler McMullen
0fb59dc589 Fix the ordering of return values. 2017-12-05 11:49:12 -08:00
Tyler McMullen
c156eb9ff7 Refactor prologue_epilogue. Break out into functions. Remove Vecs. 2017-12-05 11:49:12 -08:00
Tyler McMullen
c78a191294 Use layout.last_inst to find 'return' opcodes, rather than iterating. 2017-12-05 11:49:12 -08:00
Tyler McMullen
66eccb7859 Use opcode's is_return() rather than pattern-matching. 2017-12-05 11:49:12 -08:00
Tyler McMullen
a26d438b30 Use returned Value from append_ebb_param in prologue_epilogue. 2017-12-05 11:49:12 -08:00
Tyler McMullen
ced39f5186 Fix up adjust_sp_imm instruction.
* Use imm64 rather than offset32
* Add predicate to enforce signed 32-bit limit to imm
* Remove AdjustSpImm format
* Add encoding tests for adjust_sp_imm
* Adjust use of adjust_sp_imm in Intel prologue_epilogue to match
2017-12-05 11:49:12 -08:00
Tyler McMullen
1a11c351b5 Add tests and documentation for x86_(push|pop). Fix up encoding issues revealed by tests. 2017-12-05 11:49:12 -08:00
Tyler McMullen
3b1b33e0ac Add docs and tests for copy_special instruction. Fixes encoding issue that tests revealed. 2017-12-05 11:49:12 -08:00
Tyler McMullen
4eb9a54096 Convert x86_(push|pop) operations to be explicitly limited to 32-bit and 64-bit values. 2017-12-05 11:49:12 -08:00
Tyler McMullen
2f3edc1bc6 Fix issue in which CSR returns were incorrectly ordered. 2017-12-05 11:49:12 -08:00
Tyler McMullen
6ec4bfc4ca Fix up the encodings for new instructions, both expected and actual. Make the test more accurate. 2017-12-05 11:49:12 -08:00
Tyler McMullen
daa7a21d05 Adjust prologue/epilogue generation to work with 32-bit Intel arch. 2017-12-05 11:49:12 -08:00
Tyler McMullen
e6481bb4eb Add 32-bit encodings for x86_push, x86_pop, copy_special, and adjust_sp_imm. 2017-12-05 11:49:12 -08:00
Tyler McMullen
c92d49963a Simplify x86_(push|pop) encodings. 2017-12-05 11:49:12 -08:00
Tyler McMullen
cf9d287bea Pop the callee-saved registers in the function epilogue(s). 2017-12-05 11:49:12 -08:00
Tyler McMullen
f31a764fc8 Save all callee-saved registers in prologue. 2017-12-05 11:49:12 -08:00
Tyler McMullen
b049916d35 Move %rsp to %rbp, not the reverse.
This also takes away %rsp and %rbp from regalloc again. This may cause
tests to fail temporarily.
2017-12-05 11:49:12 -08:00
Tyler McMullen
e0c8ab49e1 Only emit an adjust_sp_imm if the stack_size is non-zero. 2017-12-05 11:49:12 -08:00
Tyler McMullen
d12587f218 Assign explicit register location to result of frame-pointer pop. 2017-12-05 11:49:12 -08:00
Tyler McMullen
544c148b25 Fix the stack slots, so the locations of local var slots are correct. 2017-12-05 11:49:12 -08:00
Tyler McMullen
c1a64a5dc7 Insert a basic epilogue. 2017-12-05 11:49:12 -08:00
Tyler McMullen
60b6bc3ab7 Sketch of prologue generation 2017-12-05 11:49:12 -08:00
Tyler McMullen
fdfe24760a Add missing newline to prologue epilogue test 2017-12-05 11:49:12 -08:00
Tyler McMullen
d4311d2b1d Add prologue-epilogue test that exercises new instructions and binary emission. 2017-12-05 11:49:12 -08:00
Tyler McMullen
ffab87318e Add adjust_sp_imm instruction. Note: This enables using rsp and rbp as normal registers. Which is... wrong. 2017-12-05 11:49:12 -08:00
Tyler McMullen
32509ebacd Fix push/pop encoding for extended registers. Add copy_special encoding. 2017-12-05 11:49:12 -08:00
Tyler McMullen
b8275f5713 Add (some) encodings for x86_push/pop instructions. Simple uses actually pass the legalizer now. 2017-12-05 11:49:12 -08:00
Tyler McMullen
cdf70ccb77 Add copy_special instruction. 2017-12-05 11:49:12 -08:00
Tyler McMullen
8ed37e352e Add x86_push and x86_pop instructions. 2017-12-05 11:49:12 -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
Pat Hickey
919de82e9c rename wasm testsuite to wasm_testsuite
this makes it a lot more obvious in the travis build output
2017-12-01 09:00:23 -08:00
Pat Hickey
8e0110b076 add wat2wasm note to readme 2017-12-01 09:00:23 -08:00
Pat Hickey
0676e8cbd7 install wasm-toolchain build 26619 from deb 2017-12-01 09:00:23 -08:00
Dan Gohman
27f0b29188 Replace hex with "0x%x" % ... to fix a trailing 'L' on 32-bit python2
This test was failing because the hash computes values greater than
0x7fffffff, which 32-bit python2 promotes to long, which `hex` formats
with a trailing 'L'. The code that uses it appears to be ok with a
long value, so it's just the test that needs to handle it.

Fix as suggested here:

https://stackoverflow.com/questions/5917203/python-trailing-l-problem
2017-12-01 06:44:37 -08:00
Pat Hickey
cced2c8b0c Fix wat syntax so wasm tests pass (#199)
* wasm testsuite: ignore hidden files in test dir

and report a rejected file. it was picking up vim .swp files

* wasmtests: correct wat syntax in icall.wat
2017-11-27 12:46:53 -08:00
Pat Hickey
b5601d57c8 filetests: change hex function names to user function numbers 2017-11-23 14:08:47 -08:00
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