Path: csiph.com!news.swapon.de!eternal-september.org!reader02.eternal-september.org!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: "Alexei A. Frounze" Newsgroups: comp.compilers Subject: 8086 register allocation Date: Sun, 9 May 2021 14:28:39 -0700 (PDT) Organization: Compilers Central Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-05-005@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="18654"; mail-complaints-to="abuse@iecc.com" Keywords: code, architecture Posted-Date: 09 May 2021 20:04:16 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2657 For the fun of it I've implemented a greedy bottom-up local register allocator for the intel 8086 CPU, which is known for its non-uniform use of registers in ALU instructions and memory operands (https://github.com/alexfru/regal86). The motivation for it is that I haven't seen any such register allocator in e.g. the "Dragon" book and may other texts on compilers I've read or skimmed. And even today I can't quite come up with a proper web search request that would return info on such allocators. I've found one paper that very briefly talks about an allocator like this for the IBM 370. This gives a sense that this stuff is very yesterday in terms of both CPU architectures and modern compiler algorithms since many seem to delegate this particular aspect of register allocation to graph (pre)coloring and modern CPUs are more uniform in terms of register use (or there are simply more registers to use). Are there any other texts that introduce and explain such register allocators? Compiler Construction by William M. Waite and Gerhard Goos (section 10.2.2 "Targeting") is a bit too short on the matter. But people somehow have done things like this in the past. Thanks, Alex [I don't recall anything in a textbook about it. x86 register allocators were pretty ad-hoc due to all of the special cases where an operand had to be in a specific register. -John]