[llvm-commits] [llvm] r89356 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
Evan Cheng
evan.cheng at apple.com
Thu Nov 19 13:51:48 PST 2009
On Nov 19, 2009, at 1:10 PM, David Greene wrote:
> On Thursday 19 November 2009 13:36, Evan Cheng wrote:
>> On Nov 19, 2009, at 7:55 AM, David Greene wrote:
>>> + // The queue of recently-used registers.
>>> + SmallVector<unsigned, 3> RecentRegs;
>>
>> Why the odd sized vector?
>
> Why not? We have the queue sized to three in our code. I can
> change it if you'd like. It's an arbitrary choice.
It seems strange.
>
>>> +
>>> + // Record that we just picked this register.
>>> + void recordRecentlyUsed(unsigned reg) {
>>> + assert(reg != 0 && "Recently used register is NOREG!");
>>> + if (!RecentRegs.empty()) {
>>> + std::copy(RecentRegs.begin() + 1, RecentRegs.end(),
>>> RecentRegs.begin()); + RecentRegs.back() = reg;
>>
>> This seems extremely slow? Why not pop front and push back? Or just use a
>> fixed size array and keep rotating the begin and end pointers?
>
> pop_front on a vector is no faster than the copy and might actually be slower.
> Perhaps this should be a list<> or deque<>. What do you think?
deque is slow. Why not just a fixed sized array and rotate the head and tail pointers?
Evan
>
> -Dave
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list