[PATCH 0/5] LiveInterval refactoring
Matthias Braun
mbraun at apple.com
Tue Sep 3 11:58:03 PDT 2013
On Sep 3, 2013, at 11:52 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
> On 03.09.2013, at 20:46, Matthias Braun <mbraun at apple.com> wrote:
>
>> Currently I see these options:
>>
>> 1:
>> live with a freestanding struct LiveInterval;
>>
>> 2:
>> class LiveIntervalBase {
>> public: struct Segment {};
>> };
>> template <> struct isPodLike<LiveIntervalBase::Segment> /* … */
>> class LiveInterval : public LiveIntervalBase {
>> public:
>> SmallVector<Segment> /* … */
>> };
>>
>> 3:
>> /** please do not use directly but LiveInterval::Segment */
>> struct LiveSegment { /* … */ }
>> template <> struct isPodLike<LiveSegment> /* … */
>> class LiveInterval {
>> public:
>> typedef LiveSegment Segment;
>> SmallVector<Segment> /* … */
>> };
>>
>> 4: Drop the isPodLike, no idea if/how badly it affects performance
>
> When compiling with Clang we use the is_trivially_copyable type trait as a base line for isPodLike. That should be sufficient for the Segment class. Not sure if we care enough about performance on other compilers.
Indeed, sounds like a good enough reason to drop isPodLike here, IMHO.
Matthias
>
> - Ben
>
>>
>> Greetings
>> Matthias
>>
>> On Sep 3, 2013, at 11:39 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>
>>>
>>> On Sep 3, 2013, at 11:30 AM, Matthias Braun <mbraun at apple.com> wrote:
>>>
>>>> Sounds good. Though I’m having trouble make Segment an inner class of LiveInterval:
>>>> I need to specialize the isPodLike type constraint class. But apparently c++ forces you to specialize templates at the same scope where the template was specified, so it is only possible
>>>> to do that after the LiveIntervall class, where it is too late, because the SmallVector<Segment> has already been instantiated.
>>>> So I guess I have to create a LiveSegment class outside LiveInterval, unless I’m missing some C++ tricks here…
>>>
>>> Oh, for crying out loud! Maybe some of our C++ wizards can help?
>>>
>>> I wonder, though, if isPodLike does any good? Could we just drop it?
>>>
>>> Thanks,
>>> /jakob
>>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130903/10eabc79/attachment.html>
More information about the llvm-commits
mailing list