diff options
Diffstat (limited to 'contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp b/contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp index a8e8e39..e039ae5 100644 --- a/contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp +++ b/contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp @@ -25,6 +25,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -1393,7 +1394,7 @@ void Intrinsic::emitBody(StringRef CallPrefix) { } } - assert(Lines.size() && "Empty def?"); + assert(!Lines.empty() && "Empty def?"); if (!RetVar.getType().isVoid()) Lines.back().insert(0, RetVar.getName() + " = "); @@ -1563,10 +1564,8 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ // See the documentation in arm_neon.td for a description of these operators. class LowHalf : public SetTheory::Operator { public: - virtual void anchor() {} - virtual ~LowHalf() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts2, Loc); Elts.insert(Elts2.begin(), Elts2.begin() + (Elts2.size() / 2)); @@ -1574,10 +1573,8 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ }; class HighHalf : public SetTheory::Operator { public: - virtual void anchor() {} - virtual ~HighHalf() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts2, Loc); Elts.insert(Elts2.begin() + (Elts2.size() / 2), Elts2.end()); @@ -1588,10 +1585,8 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ public: Rev(unsigned ElementSize) : ElementSize(ElementSize) {} - virtual void anchor() {} - virtual ~Rev() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin() + 1, Expr->arg_end(), Elts2, Loc); @@ -1613,9 +1608,7 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ public: MaskExpander(unsigned N) : N(N) {} - virtual void anchor() {} - virtual ~MaskExpander() {} - virtual void expand(SetTheory &ST, Record *R, SetTheory::RecSet &Elts) { + void expand(SetTheory &ST, Record *R, SetTheory::RecSet &Elts) override { unsigned Addend = 0; if (R->getName() == "mask0") Addend = 0; @@ -1637,15 +1630,13 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ "Different types in arguments to shuffle!"); SetTheory ST; - LowHalf LH; - HighHalf HH; - MaskExpander ME(Arg1.first.getNumElements()); - Rev R(Arg1.first.getElementSizeInBits()); SetTheory::RecSet Elts; - ST.addOperator("lowhalf", &LH); - ST.addOperator("highhalf", &HH); - ST.addOperator("rev", &R); - ST.addExpander("MaskExpand", &ME); + ST.addOperator("lowhalf", llvm::make_unique<LowHalf>()); + ST.addOperator("highhalf", llvm::make_unique<HighHalf>()); + ST.addOperator("rev", + llvm::make_unique<Rev>(Arg1.first.getElementSizeInBits())); + ST.addExpander("MaskExpand", + llvm::make_unique<MaskExpander>(Arg1.first.getNumElements())); ST.evaluate(DI->getArg(2), Elts, None); std::string S = "__builtin_shufflevector(" + Arg1.second + ", " + Arg2.second; @@ -1938,7 +1929,8 @@ void NeonEmitter::createIntrinsic(Record *R, } std::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); - std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()); + NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()), + NewTypeSpecs.end()); for (auto &I : NewTypeSpecs) { Intrinsic *IT = new Intrinsic(R, Name, Proto, I.first, I.second, CK, Body, |