[Mesa-dev] [PATCH] nir: add support for structured COME FROM

Connor Abbott cwabbott0 at gmail.com
Wed Apr 1 18:05:12 PDT 2015


On Wed, Apr 1, 2015 at 8:34 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Wed, Apr 1, 2015 at 9:59 AM, Francisco Jerez <currojerez at riseup.net> wrote:
>> Connor Abbott <cwabbott0 at gmail.com> writes:
>>
>>> Unfortunately, we can't support unstructured COME FROM yet, since we
>>> can't structurize arbitrary control flow graphs. Also TODO is adding
>>> support for threading by having multiple come_from's point to the same
>>> unconditional branch, as well as various other INTERCAL features.
>>>
>>
>> I believe what we are really badly missing is a
>> call-with-current-continuation opcode, COME FROM or any other obscure
>> control flow construct of your choice will become a straightforward
>> special case.  Please fix!
>
> Ok, I feel a little silly saying this, but I have absolutely no idea
> what either of you are talking about.  What's wrong with calling it
> "preds" and what is a call-with-current-continuation opcode and what
> does that have to do with a nir_print patch?  I'm very confused.
> --Jason

As for COME FROM, see: http://en.wikipedia.org/wiki/COMEFROM and
http://en.wikipedia.org/wiki/Intercal

As for call-with-current-continuation or call/cc, it's something left
to us by The Lisp Masters, Hallowed Be Their Names (actually, Scheme
was the language to popularize it). As with other things lisp-y, it's
something incredibly powerful that we mortals pretend to understand
but only The True Masters can comprehend without brain aneurysms. You
can think of it as a sort of setjmp-longjmp on steroids where you can
pass around the object and call longjmp() anywhere you want, instead
of just winding back the stack.

In other words, check what date it is.

>
>>> Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
>>> ---
>>>  src/glsl/nir/nir_print.c | 6 ++----
>>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
>>> index fa11a31..2086e21 100644
>>> --- a/src/glsl/nir/nir_print.c
>>> +++ b/src/glsl/nir/nir_print.c
>>> @@ -655,12 +655,10 @@ print_block(nir_block *block, print_var_state *state, unsigned tabs, FILE *fp)
>>>     qsort(preds, block->predecessors->entries, sizeof(nir_block *),
>>>           compare_block_index);
>>>
>>> -   print_tabs(tabs, fp);
>>> -   fprintf(fp, "/* preds: ");
>>>     for (unsigned i = 0; i < block->predecessors->entries; i++) {
>>> -      fprintf(fp, "block_%u ", preds[i]->index);
>>> +      print_tabs(tabs, fp);
>>> +      fprintf(fp, "come_from %u\n", preds[i]->index);
>>>     }
>>> -   fprintf(fp, "*/\n");
>>>
>>>     free(preds);
>>>
>>> --
>>> 2.1.0
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>


More information about the mesa-dev mailing list