[PATCH] Switch a std::map to a DenseMap in CodeGenRegisters

Owen Anderson resistor at mac.com
Fri Feb 13 00:08:46 PST 2015


> On Feb 10, 2015, at 3:07 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> By inspection, it looks like the iteration order could eventually
> affect the contents of `SubRegs`, depending on whether there could
> be duplicates of `I->second` in `Comps`.  But I don't actually know
> this code... maybe `I->second` is guaranteed to be unique?

What’s modeled here is the composition relationship of subregister indices.  Index A’s map contains the pair <B, C> to indicate that A o B —> C.  With that in mind, I can’t imagine a scenario in which it would be meaningful for C not to be unique.  If you think of it as subsetting operations, you need a subsetting operation A such that there were multiple sub-subsetting operations (B) that you could apply to end up at the net subsetting operation C (empty sets excluded).  As far as I can tell, that doesn’t make semantic sense.

> The results of the first loop are obviously independent of iteration
> order.  I'm not sure of the second... if `Map` has two entries with
> the same `EnumValue` (but different `I->second`) the result would be
> non-deterministic.

EnumValue has to be unique, as it is ultimately how the sub register indices are represented in the generated C++ code at the end of the day.

—Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150213/60d30af9/attachment.html>


More information about the llvm-commits mailing list