TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A quick look at destination-driven code generation

60 pointsby tekknolagiover 1 year ago

3 comments

lboassoover 1 year ago
It is interesting to see that this approach has been used by Niklaus Wirth in most of his compilers, see &quot;Compiler Construction - The Art of Niklaus Wirth&quot; by Hanspeter Mössenböck [0]. This technique was also described by David R. Hanson in &quot;Code Improvement via Lazy Evaluation&quot;, 1980 [1] and &quot;Simple Code Optimizations&quot;, 1983 [2].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;lboasso&#x2F;oberonc&#x2F;blob&#x2F;master&#x2F;doc&#x2F;Moe00b.pdf">https:&#x2F;&#x2F;github.com&#x2F;lboasso&#x2F;oberonc&#x2F;blob&#x2F;master&#x2F;doc&#x2F;Moe00b.pd...</a><p>[1] <a href="http:&#x2F;&#x2F;storage.webhop.net&#x2F;documents&#x2F;lazyevaluation.pdf" rel="nofollow noreferrer">http:&#x2F;&#x2F;storage.webhop.net&#x2F;documents&#x2F;lazyevaluation.pdf</a><p>[2] <a href="http:&#x2F;&#x2F;storage.webhop.net&#x2F;documents&#x2F;simpleopt.pdf" rel="nofollow noreferrer">http:&#x2F;&#x2F;storage.webhop.net&#x2F;documents&#x2F;simpleopt.pdf</a>
评论 #38228550 未加载
Joker_vDover 1 year ago
&gt; Nothing too fancy. No control-flow. No function calls. No data structures.<p>If that&#x27;s the problem statement, then you may as well perform register allocation: all you need is Sethi–Ullman&#x27;s algorithm [0][1], and it&#x27;s quite simple.<p>Register allocation only becomes complicated when the control flow comes into the picture, especially the loops. Even then, there are some more or less obvious ways to do it, if you don&#x27;t want to do graph colouring after Chaitin et al. (remember, people had to write register allocators before Chaitin&#x27;s publication in 1981). For instance, you can do what the very first FORTRAN compiler did: you look at registerts as a cache for memory, in which case the Bélády&#x27;s algorithm can be used for spilling. And with loops over arrays you can leverage the knowledge that you&#x27;re looping over arrays quite nicely [2].<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sethi%E2%80%93Ullman_algorithm" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sethi%E2%80%93Ullman_algorithm</a><p>[1] <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;321607.321620" rel="nofollow noreferrer">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;321607.321620</a><p>[2] <a href="https:&#x2F;&#x2F;archive.computerhistory.org&#x2F;resources&#x2F;text&#x2F;Fortran&#x2F;102663113.05.01.acc.pdf" rel="nofollow noreferrer">https:&#x2F;&#x2F;archive.computerhistory.org&#x2F;resources&#x2F;text&#x2F;Fortran&#x2F;1...</a>
评论 #38226371 未加载
qazxcvbnmover 1 year ago
Reminds me of HOAS techniques.