forked from OSchip/llvm-project
Revert r334374 [TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
This breaks some builders. llvm-svn: 334376
This commit is contained in:
parent
15243d5a6d
commit
53b14db9f2
|
@ -1825,7 +1825,7 @@ void TreePatternNode::SubstituteFormalArguments(
|
||||||
assert((Child->getPredicateFns().empty() ||
|
assert((Child->getPredicateFns().empty() ||
|
||||||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||||
"Non-empty child predicate clobbered!");
|
"Non-empty child predicate clobbered!");
|
||||||
setChild(i, std::move(NewChild));
|
setChild(i, NewChild);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getChild(i)->SubstituteFormalArguments(ArgMap);
|
getChild(i)->SubstituteFormalArguments(ArgMap);
|
||||||
|
@ -1856,7 +1856,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
||||||
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
NewChild->getPredicateFns() == Child->getPredicateFns()) &&
|
||||||
"Non-empty child predicate clobbered!");
|
"Non-empty child predicate clobbered!");
|
||||||
|
|
||||||
setChild(i, std::move(NewChild));
|
setChild(i, NewChild);
|
||||||
}
|
}
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
@ -1884,8 +1884,7 @@ TreePatternNodePtr TreePatternNode::InlinePatternFragments(TreePatternNodePtr T,
|
||||||
std::map<std::string, TreePatternNodePtr> ArgMap;
|
std::map<std::string, TreePatternNodePtr> ArgMap;
|
||||||
for (unsigned i = 0, e = Frag->getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = Frag->getNumArgs(); i != e; ++i) {
|
||||||
TreePatternNodePtr Child = getChildShared(i);
|
TreePatternNodePtr Child = getChildShared(i);
|
||||||
ArgMap[Frag->getArgName(i)] =
|
ArgMap[Frag->getArgName(i)] = Child->InlinePatternFragments(Child, TP);
|
||||||
Child->InlinePatternFragments(std::move(Child), TP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FragTree->SubstituteFormalArguments(ArgMap);
|
FragTree->SubstituteFormalArguments(ArgMap);
|
||||||
|
@ -2674,8 +2673,9 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit,
|
||||||
else // Otherwise, no chain.
|
else // Otherwise, no chain.
|
||||||
Operator = getDAGPatterns().get_intrinsic_wo_chain_sdnode();
|
Operator = getDAGPatterns().get_intrinsic_wo_chain_sdnode();
|
||||||
|
|
||||||
Children.insert(Children.begin(),
|
TreePatternNodePtr IIDNode =
|
||||||
std::make_shared<TreePatternNode>(IntInit::get(IID), 1));
|
std::make_shared<TreePatternNode>(IntInit::get(IID), 1);
|
||||||
|
Children.insert(Children.begin(), IIDNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Operator->isSubClassOf("ComplexPattern")) {
|
if (Operator->isSubClassOf("ComplexPattern")) {
|
||||||
|
@ -2736,7 +2736,7 @@ static bool SimplifyTree(TreePatternNodePtr &N) {
|
||||||
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
|
for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
|
||||||
TreePatternNodePtr Child = N->getChildShared(i);
|
TreePatternNodePtr Child = N->getChildShared(i);
|
||||||
MadeChange |= SimplifyTree(Child);
|
MadeChange |= SimplifyTree(Child);
|
||||||
N->setChild(i, std::move(Child));
|
N->setChild(i, Child);
|
||||||
}
|
}
|
||||||
return MadeChange;
|
return MadeChange;
|
||||||
}
|
}
|
||||||
|
@ -3057,7 +3057,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
|
||||||
DefaultOps[i]->getName() +
|
DefaultOps[i]->getName() +
|
||||||
"' doesn't have a concrete type!");
|
"' doesn't have a concrete type!");
|
||||||
}
|
}
|
||||||
DefaultOpInfo.DefaultOps.push_back(std::move(TPN));
|
DefaultOpInfo.DefaultOps.push_back(TPN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert it into the DefaultOperands map so we can find it later.
|
// Insert it into the DefaultOperands map so we can find it later.
|
||||||
|
@ -3487,9 +3487,9 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
||||||
if (!RNode)
|
if (!RNode)
|
||||||
I->error("Operand $" + OpName + " does not exist in operand list!");
|
I->error("Operand $" + OpName + " does not exist in operand list!");
|
||||||
|
|
||||||
|
ResNodes.push_back(RNode);
|
||||||
|
|
||||||
Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
|
Record *R = cast<DefInit>(RNode->getLeafValue())->getDef();
|
||||||
ResNodes.push_back(std::move(RNode));
|
|
||||||
if (!R)
|
if (!R)
|
||||||
I->error("Operand $" + OpName + " should be a set destination: all "
|
I->error("Operand $" + OpName + " should be a set destination: all "
|
||||||
"outputs must occur before inputs in operand list!");
|
"outputs must occur before inputs in operand list!");
|
||||||
|
@ -3554,7 +3554,7 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern(
|
||||||
OpNode->getNumTypes());
|
OpNode->getNumTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultNodeOperands.push_back(std::move(OpNode));
|
ResultNodeOperands.push_back(OpNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InstInputsCheck.empty())
|
if (!InstInputsCheck.empty())
|
||||||
|
@ -4080,10 +4080,9 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() {
|
||||||
std::vector<Predicate> Preds = P.Predicates;
|
std::vector<Predicate> Preds = P.Predicates;
|
||||||
const std::vector<Predicate> &MC = ModeChecks[Mode];
|
const std::vector<Predicate> &MC = ModeChecks[Mode];
|
||||||
Preds.insert(Preds.end(), MC.begin(), MC.end());
|
Preds.insert(Preds.end(), MC.begin(), MC.end());
|
||||||
PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, std::move(NewSrc),
|
PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, NewSrc, NewDst,
|
||||||
std::move(NewDst), P.getDstRegs(),
|
P.getDstRegs(), P.getAddedComplexity(),
|
||||||
P.getAddedComplexity(), Record::getNewUID(),
|
Record::getNewUID(), Mode);
|
||||||
Mode);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (PatternToMatch &P : Copy) {
|
for (PatternToMatch &P : Copy) {
|
||||||
|
@ -4387,18 +4386,18 @@ static void GenerateVariantsOf(TreePatternNodePtr N,
|
||||||
assert(NC >= 3 &&
|
assert(NC >= 3 &&
|
||||||
"Commutative intrinsic should have at least 3 children!");
|
"Commutative intrinsic should have at least 3 children!");
|
||||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||||
Variants.push_back(std::move(ChildVariants[0])); // Intrinsic id.
|
Variants.push_back(ChildVariants[0]); // Intrinsic id.
|
||||||
Variants.push_back(std::move(ChildVariants[2]));
|
Variants.push_back(ChildVariants[2]);
|
||||||
Variants.push_back(std::move(ChildVariants[1]));
|
Variants.push_back(ChildVariants[1]);
|
||||||
for (unsigned i = 3; i != NC; ++i)
|
for (unsigned i = 3; i != NC; ++i)
|
||||||
Variants.push_back(std::move(ChildVariants[i]));
|
Variants.push_back(ChildVariants[i]);
|
||||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||||
} else if (NC == N->getNumChildren()) {
|
} else if (NC == N->getNumChildren()) {
|
||||||
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
std::vector<std::vector<TreePatternNodePtr>> Variants;
|
||||||
Variants.push_back(std::move(ChildVariants[1]));
|
Variants.push_back(ChildVariants[1]);
|
||||||
Variants.push_back(std::move(ChildVariants[0]));
|
Variants.push_back(ChildVariants[0]);
|
||||||
for (unsigned i = 2; i != NC; ++i)
|
for (unsigned i = 2; i != NC; ++i)
|
||||||
Variants.push_back(std::move(ChildVariants[i]));
|
Variants.push_back(ChildVariants[i]);
|
||||||
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,11 +813,7 @@ public:
|
||||||
const std::vector<TreePatternNodePtr> &getTrees() const { return Trees; }
|
const std::vector<TreePatternNodePtr> &getTrees() const { return Trees; }
|
||||||
unsigned getNumTrees() const { return Trees.size(); }
|
unsigned getNumTrees() const { return Trees.size(); }
|
||||||
const TreePatternNodePtr &getTree(unsigned i) const { return Trees[i]; }
|
const TreePatternNodePtr &getTree(unsigned i) const { return Trees[i]; }
|
||||||
|
void setTree(unsigned i, TreePatternNodePtr Tree) { Trees[i] = Tree; }
|
||||||
void setTree(unsigned i, TreePatternNodePtr Tree) {
|
|
||||||
Trees[i] = std::move(Tree);
|
|
||||||
}
|
|
||||||
|
|
||||||
TreePatternNodePtr getOnlyTree() const {
|
TreePatternNodePtr getOnlyTree() const {
|
||||||
assert(Trees.size() == 1 && "Doesn't have exactly one pattern!");
|
assert(Trees.size() == 1 && "Doesn't have exactly one pattern!");
|
||||||
return Trees[0];
|
return Trees[0];
|
||||||
|
|
Loading…
Reference in New Issue