Commit graph

1015 commits

Author SHA1 Message Date
Quentin Carbonneaux
8799dc30ac make rsp and rbp globally live 2017-02-08 10:49:55 -05:00
Quentin Carbonneaux
c71f44c5a8 update assert() missed in 7e1c1f 2017-02-07 21:56:00 -05:00
Quentin Carbonneaux
8215b50a10 fix edge deletion bug in sccp
When an edge is deleted, the phis and predecessors of the
destination block have to be updated.  This is what blkdel()
was doing, but at a level too coarse.  The new function
edgedel() allows to remove a single edge (and takes care of
multiple edges).
2017-02-06 15:58:09 -05:00
Quentin Carbonneaux
1a76fd11f5 robustness fix in fillfron()
This makes it possible to call it several times in a row.
2017-02-06 14:37:43 -05:00
Quentin Carbonneaux
7e1c1f9f77 use uint for block ids 2017-02-06 14:36:27 -05:00
Quentin Rameau
835b2b4910 create an index for the instructions in the IL doc 2017-02-03 09:26:43 -05:00
Quentin Carbonneaux
d4be94bae0 fix the same bug in varget() 2017-02-01 13:50:04 -05:00
Quentin Carbonneaux
4d656383d8 fix bug in varadd(), thanks Ed Davis 2017-02-01 13:47:29 -05:00
Quentin Rameau
cec21e6540 create an instruction index for the IL doc 2017-01-20 11:26:37 -05:00
Quentin Rameau
9fbb276e37 change 'b' and 'h' ordering in IL doc 2017-01-20 11:25:46 -05:00
Quentin Carbonneaux
2b4ece6f99 use a less obtuse api for vnew() 2017-01-12 22:31:51 -05:00
Quentin Carbonneaux
e38da51c14 isel fixes for lame apple assembler 2017-01-10 20:24:10 -05:00
Quentin Carbonneaux
0602ad48f0 remove styling from generated html 2017-01-07 15:57:09 -05:00
Quentin Carbonneaux
260178dcef prepare for new c9x infrastructure 2017-01-06 22:57:30 -05:00
Quentin Carbonneaux
f5917c35bd attempt to fix cc flags in tests 2017-01-04 22:01:55 -05:00
Quentin Carbonneaux
7918c9411c improve performance of bsiter() 2017-01-04 19:22:31 -05:00
Quentin Carbonneaux
b976b2da5c more performance improvements in the parser 2017-01-04 15:02:07 -05:00
Quentin Carbonneaux
391b79fcbd use a perfect hash for lexing 2016-12-31 14:23:29 -05:00
Quentin Carbonneaux
103f427356 minor bugs in lexh tool 2016-12-31 14:17:11 -05:00
Quentin Carbonneaux
cd458524b3 new tool to improve lexing speed 2016-12-30 22:05:27 -05:00
Quentin Carbonneaux
ed8fe831fe remove debugging stub 2016-12-29 20:58:30 -05:00
Quentin Carbonneaux
e9ccf35b8a do not create useless mem refs 2016-12-29 17:58:56 -05:00
Quentin Carbonneaux
7815610cd8 simplify seladdr()
This also provides a violent fix to a bug causing an invalid
addressing to be generated when indexing into a global variable.
The fix is not satisfactory, though, as bad code is generated
(instead of invalid code before).
2016-12-29 17:51:26 -05:00
Quentin Carbonneaux
ea4b47003b fix escapes handling (patch from ac) 2016-12-28 12:45:40 -05:00
Quentin Carbonneaux
52cc53185e loosen assertion in load elimination
The assertion was invalid, I was assuming il->blk was
b when writing it.  The new assertion should be right:
If the loop level were to decrease we would get out of
a cycle in cfg, this should not be possible unless we
go through a block with more than 1 predecessor.
2016-12-28 06:43:05 -05:00
Quentin Carbonneaux
3c3afdc896 schedule loop nesting computations earlier 2016-12-21 09:56:40 -05:00
Quentin Carbonneaux
d04ba5eae8 fix wrong assertion in load elimination
The assertion fails incorrectly on a block right
after the end of a loop.
2016-12-21 09:54:50 -05:00
Quentin Carbonneaux
96f0711dac use the new load optimization 2016-12-12 22:17:03 -05:00
Quentin Carbonneaux
8d8d551df2 new tests for the load optimization 2016-12-12 22:17:03 -05:00
Quentin Carbonneaux
3f147ed2e0 implement a simple load elimination pass 2016-12-12 22:17:03 -05:00
Quentin Carbonneaux
8fdea1dd52 implement a simple alias analysis 2016-12-12 22:17:03 -05:00
Quentin Carbonneaux
12f9d16c7b create cfg.c for cfg-related functions 2016-12-12 22:16:57 -05:00
Quentin Carbonneaux
2380b5786a make newtmp() return zeroed out temporaries
This was not necessary as temporaries were never freed
and returned from an array zero initialized.  But in the
coming load optimization, we sometimes free temporaries
by resetting fn->ntmp.
2016-12-12 19:24:39 -05:00
Quentin Carbonneaux
00f3d2228b new eight queens test 2016-12-12 19:24:39 -05:00
Quentin Carbonneaux
844b97cf37 use a queue for copy elimination 2016-12-08 22:17:24 -05:00
Quentin Carbonneaux
a9bc0541b5 move some liveness code where it belongs 2016-12-05 02:51:31 -05:00
Quentin Carbonneaux
8032339c59 disable pie (default on some os) 2016-12-05 02:50:08 -05:00
Quentin Carbonneaux
6ed62fe945 doc nits 2016-11-09 22:34:05 -05:00
Quentin Carbonneaux
3e8a18dd1b return non-zero when tests fail 2016-10-24 14:36:35 -04:00
Quentin Carbonneaux
2434d4eb3e fix bug in folding of w comparisons
The casting to uint32_t made the code for comparing
two signed words invalid.  Interestingly, this can
be fixed by casting to int32_t instead.  Because
sign extension is monotonic, all the unsigned
comparisons remain valid.

CVC4 can even check that for us:

x, y : BITVECTOR(32);
QUERY BVLT(SX(x, 64), SX(y, 64)) <=> BVLT(x, y);
QUERY BVLE(SX(x, 64), SX(y, 64)) <=> BVLE(x, y);
QUERY BVGT(SX(x, 64), SX(y, 64)) <=> BVGT(x, y);
QUERY BVGE(SX(x, 64), SX(y, 64)) <=> BVGE(x, y);
2016-10-24 13:46:27 -04:00
Quentin Carbonneaux
2f41ff03e2 fix bug in copy propagation
The pass was not doing anything incorrect, but
it missed some opportunities to optimize.  On
a copy heavy example I observed that, in the
output of the pass a phi of the following shape
remained:

   %a =w phi @A %c, @B %a

Originally the phi for %a was:

   %a =w phi @A %b, @B %a

Since %b was discovered a copy of %c, %a should
have been eliminated and replaced with %c.

I think the problem is that knowledge on the
first argument of the phi %a changes as the
algorithm progresses, a more detailed walk-
through follows.

In the first round of the algoritm, %a is
discovered to be a copy of its first argument
%b.
    phi(%b, %a) -> %b

In the second round, %a is computed as the phi
of %c (since the first argument changed) and %b
(the result of the first iteration), in our
lattice, the glb of those two is bottom.
    phi(%c, %b) -> %a (Bottom)

Finally, there is a third round in which we
compute %a as the phi of %a and %c, which again,
gives bottom.
    phi(%c, %a) -> %a (Bottom)

The bug is not tied to a phi of a copy, for
example, if the first argument is speculated
to be a copy of 0 and then, this knowledge is
retracted; we will compute in sequence:

    phi(0, %a)  -> 0
    phi(%b, 0)  -> %a (Bottom)
    phi(%b, %a) -> %a (Bottom)

The way I fixed this is by ignoring arguments
of the phi that were discovered to be copies of
the phi node itself.  This will make the last
rounds above do the correct thing.
2016-10-22 14:31:03 -04:00
Quentin Carbonneaux
48896b0598 improve tests output for contbuild 2016-10-19 19:36:33 -04:00
Quentin Carbonneaux
b39ccc6061 add magic for mobile viewing of doc 2016-10-19 11:24:11 -04:00
Quentin Carbonneaux
fd9c2e045f accept "ret" for functions with a return type
This happens to be needed for C.  The standard mandates that a return
value is used if the caller uses it.  Surprisingly, if the return
"value" is not used, the callee can use "return;".

A better solution is to add an "undef" value and return it, "undef"
would also have other use cases for compiling C.
2016-09-27 10:23:31 -04:00
Quentin Carbonneaux
09192cdeab silent a few warnings 2016-08-17 23:45:28 -07:00
Quentin Carbonneaux
490799b772 update help message of unit tester 2016-08-16 13:38:39 -07:00
Quentin Carbonneaux
cad13d0dce add support for unions in sysv abi 2016-08-16 13:28:55 -07:00
Quentin Carbonneaux
fbbb8e4d78 parse union types 2016-08-16 12:54:24 -07:00
Quentin Carbonneaux
3f8af2ba7b specify the allocation function in vnew 2016-08-15 22:55:08 -07:00
Quentin Carbonneaux
5ad8a2c6fe couple of case fixes in tokens 2016-08-14 20:03:39 -07:00