<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 9, 2011, at 3:15 PMPST, Jakob Stoklund Olesen wrote:</div><blockquote type="cite"><div>On Jan 7, 2011, at 11:25 AM, Dale Johannesen wrote:<br><br><blockquote type="cite">We might want to make physical registers negative and virtuals positive, or vice versa.   Then FirstVirtualRegister is 0 or 1, and we could get rid of those annoying subtractions of FirstVirtualRegister all over the virtual-register-handling passes.  Since 0 is used all over the place as "invalid register" it is probably best to leave this alone, let FirstVirtualRegister be 1, and simply ignore (i.e. treat as erroneous) the 0th element of anything keyed off FirstVirtualRegister.</blockquote></div></blockquote><div><br></div><div>Thanks Jakob.  This is a microoptimization, but those subtractions were really kludgy-looking.</div><div><br></div><div>After writing the above it occurred to me that negative numbers would run afoul of the widespread practice of declaring registers "unsigned", so this is probably the best way.</div><br><blockquote type="cite"><div>Fixed in r123137.<br><br>I decided to move the virtual register numbers because there is so much code already using physical register numbers as direct indices.<br><br>My first attempt was to let the virtuals run from -1 downwards, but it turns out that we have code in isel depending on createVirtualRegister() returning increasing numbers. DenseMap<unsigned> also complained because it uses -1u and -2u as sentinels.<br><br>So I moved the virtual register range to 2^31 growing upwards.<br><br>The range from 2^30 to 2^31 is reserved for representing stack slots.<br><br>Physical registers get 1 .. 2^30-1.<br><br>/jakob<br><br></div></blockquote></div></body></html>