forked from OSchip/llvm-project
[TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
Those changes were suggested post-commit for D47463. llvm-svn: 334706
This commit is contained in:
parent
9629d7897d
commit
0a2e0b6b0e
|
@ -1825,7 +1825,7 @@ void TreePatternNode::SubstituteFormalArguments(
|
|||
assert((Child->getPredicateFns().empty() ||
|
||||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||
"Non-empty child predicate clobbered!");
|
||||
setChild(i, NewChild);
|
||||
setChild(i, std::move(NewChild));
|
||||
}
|
||||
} else {
|
||||
getChild(i)->SubstituteFormalArguments(ArgMap);
|
||||
|
@ -1856,7 +1856,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
|||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||
"Non-empty child predicate clobbered!");
|
||||
|
||||
setChild(i, NewChild);
|
||||
setChild(i, std::move(NewChild));
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
@ -1883,7 +1883,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
|||
// Compute the map of formal to actual arguments.
|
||||
std::map<std::string, TreePatternNodePtr> ArgMap;
|
||||
for (unsigned i = 0, e = Frag->getNumArgs(); i != e; ++i) {
|
||||
TreePatternNodePtr Child = getChildShared(i);
|
||||
const TreePatternNodePtr &Child = getChildShared(i);
|
||||
ArgMap[Frag->getArgName(i)] = Child->InlinePatternFragments(Child, TP);
|
||||
}
|
||||
|
||||
|
@ -2673,9 +2673,8 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit,
|
|||
else // Otherwise, no chain.
|
||||
Operator = getDAGPatterns().get_intrinsic_wo_chain_sdnode();
|
||||
|
||||
TreePatternNodePtr IIDNode =
|
||||
std::make_shared<TreePatternNode>(IntInit::get(IID), 1);
|
||||
Children.insert(Children.begin(), IIDNode);
|
||||
Children.insert(Children.begin(),
|
||||
std::make_shared<TreePatternNode>(IntInit::get(IID), 1));
|
||||
}
|
||||
|
||||
if (Operator->isSubClassOf("ComplexPattern")) {
|
||||
|
@ -2736,7 +2735,7 @@ static bool SimplifyTree(TreePatternNodePtr &N) {
|
|||
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
|
||||
TreePatternNodePtr Child = N->getChildShared(i);
|
||||
MadeChange |= SimplifyTree(Child);
|
||||
N->setChild(i, Child);
|
||||
N->setChild(i, std::move(Child));
|
||||
}
|
||||
return MadeChange;
|
||||
}
|
||||
|
@ -3057,7 +3056,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
|
|||
DefaultOps[i]->getName() +
|
||||
"' doesn't have a concrete type!");
|
||||
}
|
||||
DefaultOpInfo.DefaultOps.push_back(TPN);
|
||||
DefaultOpInfo.DefaultOps.push_back(std::move(TPN));
|
||||
}
|
||||
|
||||
// Insert it into the DefaultOperands map so we can find it later.
|
||||
|
@ -3488,9 +3487,9 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
|||
if (!RNode)
|
||||
I->error("Operand $" + OpName + " does not exist in operand list!");
|
||||
|
||||
ResNodes.push_back(RNode);
|
||||
|
||||
Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
|
||||
ResNodes.push_back(std::move(RNode));
|
||||
if (!R)
|
||||
I->error("Operand $" + OpName + " should be a set destination: all "
|
||||
"outputs must occur before inputs in operand list!");
|
||||
|
@ -3555,7 +3554,7 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
|||
OpNode->getNumTypes());
|
||||
}
|
||||
|
||||
ResultNodeOperands.push_back(OpNode);
|
||||
ResultNodeOperands.push_back(std::move(OpNode));
|
||||
}
|
||||
|
||||
if (!InstInputsCheck.empty())
|
||||
|
@ -3744,7 +3743,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern,
|
|||
SrcNames[Entry.first].second == 1)
|
||||
Pattern->error("Pattern has dead named input: $" + Entry.first);
|
||||
|
||||
PatternsToMatch.push_back(std::move(PTM));
|
||||
PatternsToMatch.push_back(PTM);
|
||||
}
|
||||
|
||||
void CodeGenDAGPatterns::InferInstructionFlags() {
|
||||
|
@ -4084,9 +4083,10 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
|
|||
std::vector<Predicate> Preds = P.Predicates;
|
||||
const std::vector<Predicate> &MC = ModeChecks[Mode];
|
||||
Preds.insert(Preds.end(), MC.begin(), MC.end());
|
||||
PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, NewSrc, NewDst,
|
||||
P.getDstRegs(), P.getAddedComplexity(),
|
||||
Record::getNewUID(), Mode);
|
||||
PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, std::move(NewSrc),
|
||||
std::move(NewDst), P.getDstRegs(),
|
||||
P.getAddedComplexity(), Record::getNewUID(),
|
||||
Mode);
|
||||
};
|
||||
|
||||
for (PatternToMatch &P : Copy) {
|
||||
|
@ -4390,18 +4390,18 @@ static void GenerateVariantsOf(TreePatternNodePtr N,
|
|||
assert(NC >= 3 &&
|
||||
"Commutative intrinsic should have at least 3 children!");
|
||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||
Variants.push_back(ChildVariants[0]); // Intrinsic id.
|
||||
Variants.push_back(ChildVariants[2]);
|
||||
Variants.push_back(ChildVariants[1]);
|
||||
Variants.push_back(std::move(ChildVariants[0])); // Intrinsic id.
|
||||
Variants.push_back(std::move(ChildVariants[2]));
|
||||
Variants.push_back(std::move(ChildVariants[1]));
|
||||
for (unsigned i = 3; i != NC; ++i)
|
||||
Variants.push_back(ChildVariants[i]);
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||
} else if (NC == N->getNumChildren()) {
|
||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||
Variants.push_back(ChildVariants[1]);
|
||||
Variants.push_back(ChildVariants[0]);
|
||||
Variants.push_back(std::move(ChildVariants[1]));
|
||||
Variants.push_back(std::move(ChildVariants[0]));
|
||||
for (unsigned i = 2; i != NC; ++i)
|
||||
Variants.push_back(ChildVariants[i]);
|
||||
Variants.push_back(std::move(ChildVariants[i]));
|
||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue