/// as singly-linked lists, with the "next" fields stored in the dependence
/// itelf.
class Dependence {
+ protected:
+ Dependence(const Dependence &) = default;
+
public:
Dependence(Instruction *Source,
Instruction *Destination) :
/// (for output, flow, and anti dependences), the dependence implies an
/// ordering, where the source must precede the destination; in contrast,
/// input dependences are unordered.
- class FullDependence : public Dependence {
+ class FullDependence final : public Dependence {
public:
FullDependence(Instruction *Src, Instruction *Dst, bool LoopIndependent,
unsigned Levels);
- ~FullDependence() override { delete[] DV; }
/// isLoopIndependent - Returns true if this is a loop-independent
/// dependence.
unsigned short Levels;
bool LoopIndependent;
bool Consistent; // Init to true, then refine.
- DVEntry *DV;
+ std::unique_ptr<DVEntry[]> DV;
friend class DependenceAnalysis;
};
: Dependence(Source, Destination), Levels(CommonLevels),
LoopIndependent(PossiblyLoopIndependent) {
Consistent = true;
- DV = CommonLevels ? new DVEntry[CommonLevels] : nullptr;
+ if (CommonLevels)
+ DV = make_unique<DVEntry[]>(CommonLevels);
}
// The rest are simple getters that hide the implementation.
return nullptr;
}
- auto Final = make_unique<FullDependence>(Result);
- Result.DV = nullptr;
- return std::move(Final);
+ return make_unique<FullDependence>(std::move(Result));
}