October 20, 2014
On 10/20/2014 07:21 PM, Daniel Murphy wrote:
> "Timon Gehr"  wrote in message news:m23eqa$2qfq$1@digitalmars.com...
>> On 10/18/2014 07:30 PM, Walter Bright wrote:
>> >
>> > Also, the glue layer rewrites "for" loops into "goto" loops, as gotos
>> > are more powerful and foundational :-)
>>
>> Well, not really. It rewrites "for" loops into "goto" loops because
>> that's the only control flow construct implemented by the hardware.
>
> You might be thinking of the code generator, not the glue layer.

Why? Does the code generator support for loops?
October 21, 2014
"Timon Gehr"  wrote in message news:m23ng5$4v2$1@digitalmars.com...

>> Well, not really. It rewrites "for" loops into "goto" loops because
>> that's the only control flow construct implemented by the hardware.
>
> > You might be thinking of the code generator, not the glue layer.
>
> Why? Does the code generator support for loops?

The code cares what the hardware implements, the glue layer does not.  The choice of "goto" loops aka basic blocks as the representation in the backend is due to ease of analysis, not hardware constraints. 

October 21, 2014
On Tuesday, 21 October 2014 at 11:19:26 UTC, Daniel Murphy wrote:
> does not.  The choice of "goto" loops aka basic blocks as the representation in the backend is due to ease of analysis, not hardware constraints.

FWIW there are equivalent IR representations that are based on continuation passing (http://en.wikipedia.org/wiki/Static_single_assignment_form):

«SSA is formally equivalent to a well-behaved subset of CPS (excluding non-local control flow, which does not occur when CPS is used as intermediate representation), so optimizations and transformations formulated in terms of one immediately apply to the other.»
1 2 3 4 5 6
Next ›   Last »