<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 8, 2011, at 10:19 PM, Cameron Zwarich wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Oct 8, 2011, at 7:21 PM, Jakob Stoklund Olesen wrote:<br><br><blockquote type="cite">On Oct 8, 2011, at 2:25 PM, Cameron Zwarich wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Could this sort of thing be checked statically?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I wish.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The 20 x86 8-bit registers are crazy. 12 can only be accessed with an REX prefix, and the 4 H-regs can only be accessed without a prefix.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Ideally, GR8_NOREX shouldn't be a sub-class of GR8, and this wouldn't be as big a problem. Unfortunately, GR8 is identical to GR8_NOREX in 32-bit mode, so TableGen considers it a super-class.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">We could create separate GR8 register classes for 32-bit and 64-bit modes, but that would require duplicating instruction definitions as well.<br></blockquote><br><br>Sounds like a good idea. We could add some metaprogramming features to Tablegen to reduce the burden of duplicating all of the instruction definitions...<br></div></blockquote><div><br></div><div>I think we can avoid the need for hygienic macros by supporting recursive multiclasses. For example:</div><div><br></div><div><pre style="word-wrap: break-word; white-space: pre-wrap; ">int O,o,i;char*I="";main(l){O&=l&1?*I:~*I,*I++||(l=2*getchar(),i+=O>8
?o:O?0:o+1,o=O>9,O=-1,I="t8B~pq`",l>0)?main(l/2):printf("%d\n",--i);}</pre><div><br></div><div>/jakob</div><div><br></div></div></div></body></html>