Hacker News new | past | comments | ask | show | jobs | submit login
Does a free swap turn a stack into a traditional register set? (2005) (cr.yp.to)
21 points by Tomte on May 20, 2017 | hide | past | favorite | 4 comments



"I suggest compiler writers stop viewing the x86 stack as a twisted version of a traditional 8-register set."

What if compiler writers will not fix the problem?

Write own register allocator: http://cr.yp.to/qhasm.html

Bonus: allow use of a "portable assembly language" to generate assembly, being respectful of the fact that users might not all be using computers with the same CPU architecture.

This could be like assembler with C-like operators and structure.

In addtion to facilitating portability it might also make writing in assembler a little easier.

Reminds me of Bell Labs' LIL: http://www.ultimate.com/phil/lil/tut.html


So, what's the follow up a dozen years later? Do clang or gcc treat the floating point stack as a stack?

Is x86-64 completely different?


x86-64 replaced the stack with registers. So this article, while interesting, is not of much practical use anymore.


x86-64 is guaranteed to contain at least SSE2. Scalar SSE2 is better than x87 in everything except extended prevision doubles, but those are very rarely used. These days, x87 code is seldom emitted.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: