[llvm] r337121 - [TableGen] std::move vectors into TreePatternNode.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 14 23:52:50 PDT 2018
Author: ctopper
Date: Sat Jul 14 23:52:49 2018
New Revision: 337121
URL: http://llvm.org/viewvc/llvm-project?rev=337121&view=rev
Log:
[TableGen] std::move vectors into TreePatternNode.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=337121&r1=337120&r2=337121&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Sat Jul 14 23:52:49 2018
@@ -1803,7 +1803,7 @@ TreePatternNodePtr TreePatternNode::clon
CChildren.reserve(Children.size());
for (unsigned i = 0, e = getNumChildren(); i != e; ++i)
CChildren.push_back(getChild(i)->clone());
- New = std::make_shared<TreePatternNode>(getOperator(), CChildren,
+ New = std::make_shared<TreePatternNode>(getOperator(), std::move(CChildren),
getNumTypes());
}
New->setName(getName());
@@ -1902,7 +1902,7 @@ void TreePatternNode::InlinePatternFragm
for (unsigned i = 0, e = ChildAlternatives.size(); i != e; ++i)
NewChildren.push_back(ChildAlternatives[i][Idxs[i]]);
TreePatternNodePtr R = std::make_shared<TreePatternNode>(
- getOperator(), NewChildren, getNumTypes());
+ getOperator(), std::move(NewChildren), getNumTypes());
// Copy over properties.
R->setName(getName());
@@ -2743,7 +2743,8 @@ TreePatternNodePtr TreePattern::ParseTre
}
TreePatternNodePtr Result =
- std::make_shared<TreePatternNode>(Operator, Children, NumResults);
+ std::make_shared<TreePatternNode>(Operator, std::move(Children),
+ NumResults);
Result->setName(OpName);
if (Dag->getName()) {
@@ -3604,7 +3605,7 @@ void CodeGenDAGPatterns::parseInstructio
OpNode->setTransformFn(nullptr);
std::vector<TreePatternNodePtr> Children;
Children.push_back(OpNode);
- OpNode = std::make_shared<TreePatternNode>(Xform, Children,
+ OpNode = std::make_shared<TreePatternNode>(Xform, std::move(Children),
OpNode->getNumTypes());
}
@@ -3616,7 +3617,7 @@ void CodeGenDAGPatterns::parseInstructio
" occurs in pattern but not in operands list!");
TreePatternNodePtr ResultPattern = std::make_shared<TreePatternNode>(
- I.getRecord(), ResultNodeOperands,
+ I.getRecord(), std::move(ResultNodeOperands),
GetNumNodeResults(I.getRecord(), *this));
// Copy fully inferred output node types to instruction result pattern.
for (unsigned i = 0; i != NumResults; ++i) {
@@ -4019,7 +4020,7 @@ void CodeGenDAGPatterns::ParseOnePattern
OpNode->setTransformFn(nullptr);
std::vector<TreePatternNodePtr> Children;
Children.push_back(OpNode);
- OpNode = std::make_shared<TreePatternNode>(Xform, Children,
+ OpNode = std::make_shared<TreePatternNode>(Xform, std::move(Children),
OpNode->getNumTypes());
}
ResultNodeOperands.push_back(OpNode);
@@ -4029,7 +4030,7 @@ void CodeGenDAGPatterns::ParseOnePattern
DstPattern->isLeaf()
? DstPattern
: std::make_shared<TreePatternNode>(DstPattern->getOperator(),
- ResultNodeOperands,
+ std::move(ResultNodeOperands),
DstPattern->getNumTypes());
for (unsigned i = 0, e = Result.getOnlyTree()->getNumTypes(); i != e; ++i)
@@ -4252,7 +4253,7 @@ static void CombineChildVariants(
for (unsigned i = 0, e = ChildVariants.size(); i != e; ++i)
NewChildren.push_back(ChildVariants[i][Idxs[i]]);
TreePatternNodePtr R = std::make_shared<TreePatternNode>(
- Orig->getOperator(), NewChildren, Orig->getNumTypes());
+ Orig->getOperator(), std::move(NewChildren), Orig->getNumTypes());
// Copy over properties.
R->setName(Orig->getName());
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h?rev=337121&r1=337120&r2=337121&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h Sat Jul 14 23:52:49 2018
@@ -600,9 +600,10 @@ class TreePatternNode {
std::vector<TreePatternNodePtr> Children;
public:
- TreePatternNode(Record *Op, std::vector<TreePatternNodePtr> &Ch,
+ TreePatternNode(Record *Op, std::vector<TreePatternNodePtr> Ch,
unsigned NumResults)
- : Operator(Op), Val(nullptr), TransformFn(nullptr), Children(Ch) {
+ : Operator(Op), Val(nullptr), TransformFn(nullptr),
+ Children(std::move(Ch)) {
Types.resize(NumResults);
}
TreePatternNode(Init *val, unsigned NumResults) // leaf ctor
More information about the llvm-commits
mailing list