[PATCH 0/5] LiveInterval refactoring

Matthias Braun mbraun at apple.com
Tue Sep 3 11:46:29 PDT 2013


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

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
> 





More information about the llvm-commits mailing list