diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-09-02 07:19:53 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-09-02 07:19:53 -0400 |
commit | 11dd6cb49dffdf7ded0bedb3e27d9746831c71cc (patch) | |
tree | a507a57cae4e63c7ee0059ca70fd863478f10e6b | |
parent | dcfacf911588255ce9d03ad2f0e5c57ee19b750a (diff) |
TODO
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | iterjit.c | 102 | ||||
-rw-r--r-- | simplex86.c | 14 |
3 files changed, 63 insertions, 59 deletions
@@ -95,11 +95,11 @@ should be encoded with the earlier version in preference to the newer one. - Consider changing labels to be integers instead of strings. This -will make it possible in many cases for code to be stored in static -const arrays. + will make it possible in many cases for code to be stored in static + const arrays. - Storing the encoding in the info field. Maybe rename info to -encoding or details. + encoding or details. Feature checking @@ -1,13 +1,61 @@ /* - + Flow: + - outer loop: + - generates outer loop + - src/mask/dest have pre-scanline setups called + - body is generated by destination iter + - src/mask/dest have post-scanline finalizers called + + - destination iter: + - for each alignment loop, it generates an inner loop + - body of inner loop is generated by combiner + - combiner returns pixels or an indication that + no change is required + - destination iter writes back if necessary + - advances pointer + + - combiner drives generation of pixels + - if there is a mask, then + - tell mask iter to load n pixels + - generate code to check if all pixels are 0 + - if it is, then + - depending on operator + - return 0 + - return "no change needed" + else: + - tell source iter to load n pixels + - add code to multiply them together + - depending on operator + - add code to check if a result is 0xff + - if it is, then + - return source + else: + - tell destination to read a pixel + - generate code to combine with source + - return result + tell mask iter to advance + else: + - tell source iter to load n pixels + - depending on operator + - add code to check if source is 0xff + - if it is, then + - return source + else: + - tell destination to read pixel + - generate code to combine with source + - return result + tell source iter to advance + + -=- + Iterator based JIT compiler There is a new structure that can be either source or destination. It contains function pointers that know how to generate pixels. The function pointers: - + Source iterators: - + - begin(): generates code that runs before the kernel - begin_line(): generates code that runs before each scanline - get_one_pixel(): generates code that reads one pixel @@ -24,7 +72,7 @@ format_16_a8 format_8_a8r8g8b8 and possibly others - + The iterator is supposed to return pixels in that format. It will never be asked to fetch more pixels than the format supports. Ie., get_sixteen_pixels() will never be called if the format is @@ -50,52 +98,6 @@ There may also be setup()/setup_line() methods required. - Flow: - - outer loop: - - generates outer loop - - src/mask/dest have pre-scanline setups called - - body is generated by destination iter - - src/mask/dest have post-scanline finalizers called - - - destination iter: - - for each alignment loop, it generates an inner loop - - body of inner loop is generated by combiner - - combiner returns pixels or an indication that - no change is required - - destination iter writes back if necessary - - advances pointer - - - combiner drives generation of pixels - - if there is a mask, then - - tell mask iter to load n pixels - - generate code to check if all pixels are 0 - - if it is, then - - depending on operator - - return 0 - - return "no change needed" - else: - - tell source iter to load n pixels - - add code to multiply them together - - depending on operator - - add code to check if a result is 0xff - - if it is, then - - return source - else: - - tell destination to read a pixel - - generate code to combine with source - - return result - tell mask iter to advance - else: - - tell source iter to load n pixels - - depending on operator - - add code to check if source is 0xff - - if it is, then - - return source - else: - - tell destination to read pixel - - generate code to combine with source - - return result - tell source iter to advance */ #include <stdio.h> diff --git a/simplex86.c b/simplex86.c index 9c51f17..f77e812 100644 --- a/simplex86.c +++ b/simplex86.c @@ -1912,6 +1912,7 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) w = r = x = b = FALSE; + /* Emit opcode */ if (variant->encoding != E_ANNOTATE && variant->encoding != E_D) { if (variant->encoding == E_O) @@ -1927,8 +1928,9 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) c = emit_opcode (c, opc); } - - vex_regno = 0x0000; + + /* Emit operands */ + vex_regno = 0x0; switch (variant->encoding) { case E_RM: @@ -2053,10 +2055,10 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) } else { - uint8_t rex = 0x40 | (w << 3) | (r << 2) | (x << 1) | (b << 0); + uint8_t rex = (w << 3) | (r << 2) | (x << 1) | (b << 0); - if (rex != 0x40) - *p++ = rex; + if (rex) + *p++ = 0x40 | rex; } /* Emit immediates */ @@ -2091,7 +2093,7 @@ emit (fragment_t *frag, const variant_t *variant, const op_t ops[4]) add_annotation (&frag->annotations, &ann); } - array_append (&frag->code, p - prefixes + c - code, &d); + array_append (&frag->code, (p - prefixes) + (c - code), &d); memcpy (d, prefixes, p - prefixes); memcpy (d + (p - prefixes), code, c - code); } |