mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
Turn a leaked object into a stack variable instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222046 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
61ab3a1cc5
commit
6141b4a113
@ -3304,13 +3304,13 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
if (LI->getSize() == 0) continue; // no pattern.
|
if (LI->getSize() == 0) continue; // no pattern.
|
||||||
|
|
||||||
// Parse the instruction.
|
// Parse the instruction.
|
||||||
TreePattern *Result = new TreePattern(CurPattern, LI, false, *this);
|
TreePattern Result(CurPattern, LI, false, *this);
|
||||||
|
|
||||||
// Inline pattern fragments into it.
|
// Inline pattern fragments into it.
|
||||||
Result->InlinePatternFragments();
|
Result.InlinePatternFragments();
|
||||||
|
|
||||||
if (Result->getNumTrees() != 1)
|
if (Result.getNumTrees() != 1)
|
||||||
Result->error("Cannot handle instructions producing instructions "
|
Result.error("Cannot handle instructions producing instructions "
|
||||||
"with temporaries yet!");
|
"with temporaries yet!");
|
||||||
|
|
||||||
bool IterateInference;
|
bool IterateInference;
|
||||||
@ -3324,7 +3324,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
// Infer as many types as possible. If we cannot infer all of them, we
|
// Infer as many types as possible. If we cannot infer all of them, we
|
||||||
// can never do anything with this pattern: report it to the user.
|
// can never do anything with this pattern: report it to the user.
|
||||||
InferredAllResultTypes =
|
InferredAllResultTypes =
|
||||||
Result->InferAllTypes(&Pattern->getNamedNodesMap());
|
Result.InferAllTypes(&Pattern->getNamedNodesMap());
|
||||||
|
|
||||||
IterateInference = false;
|
IterateInference = false;
|
||||||
|
|
||||||
@ -3332,13 +3332,13 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
// resolve cases where the input type is known to be a pointer type (which
|
// resolve cases where the input type is known to be a pointer type (which
|
||||||
// is considered resolved), but the result knows it needs to be 32- or
|
// is considered resolved), but the result knows it needs to be 32- or
|
||||||
// 64-bits. Infer the other way for good measure.
|
// 64-bits. Infer the other way for good measure.
|
||||||
for (unsigned i = 0, e = std::min(Result->getTree(0)->getNumTypes(),
|
for (unsigned i = 0, e = std::min(Result.getTree(0)->getNumTypes(),
|
||||||
Pattern->getTree(0)->getNumTypes());
|
Pattern->getTree(0)->getNumTypes());
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
IterateInference = Pattern->getTree(0)->
|
IterateInference = Pattern->getTree(0)->UpdateNodeType(
|
||||||
UpdateNodeType(i, Result->getTree(0)->getExtType(i), *Result);
|
i, Result.getTree(0)->getExtType(i), Result);
|
||||||
IterateInference |= Result->getTree(0)->
|
IterateInference |= Result.getTree(0)->UpdateNodeType(
|
||||||
UpdateNodeType(i, Pattern->getTree(0)->getExtType(i), *Result);
|
i, Pattern->getTree(0)->getExtType(i), Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our iteration has converged and the input pattern's types are fully
|
// If our iteration has converged and the input pattern's types are fully
|
||||||
@ -3352,8 +3352,8 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
// arbitrary types to the result pattern's nodes.
|
// arbitrary types to the result pattern's nodes.
|
||||||
if (!IterateInference && InferredAllPatternTypes &&
|
if (!IterateInference && InferredAllPatternTypes &&
|
||||||
!InferredAllResultTypes)
|
!InferredAllResultTypes)
|
||||||
IterateInference = ForceArbitraryInstResultType(Result->getTree(0),
|
IterateInference =
|
||||||
*Result);
|
ForceArbitraryInstResultType(Result.getTree(0), Result);
|
||||||
} while (IterateInference);
|
} while (IterateInference);
|
||||||
|
|
||||||
// Verify that we inferred enough types that we can do something with the
|
// Verify that we inferred enough types that we can do something with the
|
||||||
@ -3362,7 +3362,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
Pattern->error("Could not infer all types in pattern!");
|
Pattern->error("Could not infer all types in pattern!");
|
||||||
if (!InferredAllResultTypes) {
|
if (!InferredAllResultTypes) {
|
||||||
Pattern->dump();
|
Pattern->dump();
|
||||||
Result->error("Could not infer all types in pattern result!");
|
Result.error("Could not infer all types in pattern result!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate that the input pattern is correct.
|
// Validate that the input pattern is correct.
|
||||||
@ -3375,7 +3375,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
InstImpResults);
|
InstImpResults);
|
||||||
|
|
||||||
// Promote the xform function to be an explicit node if set.
|
// Promote the xform function to be an explicit node if set.
|
||||||
TreePatternNode *DstPattern = Result->getOnlyTree();
|
TreePatternNode *DstPattern = Result.getOnlyTree();
|
||||||
std::vector<TreePatternNode*> ResultNodeOperands;
|
std::vector<TreePatternNode*> ResultNodeOperands;
|
||||||
for (unsigned ii = 0, ee = DstPattern->getNumChildren(); ii != ee; ++ii) {
|
for (unsigned ii = 0, ee = DstPattern->getNumChildren(); ii != ee; ++ii) {
|
||||||
TreePatternNode *OpNode = DstPattern->getChild(ii);
|
TreePatternNode *OpNode = DstPattern->getChild(ii);
|
||||||
@ -3387,16 +3387,16 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
|||||||
}
|
}
|
||||||
ResultNodeOperands.push_back(OpNode);
|
ResultNodeOperands.push_back(OpNode);
|
||||||
}
|
}
|
||||||
DstPattern = Result->getOnlyTree();
|
DstPattern = Result.getOnlyTree();
|
||||||
if (!DstPattern->isLeaf())
|
if (!DstPattern->isLeaf())
|
||||||
DstPattern = new TreePatternNode(DstPattern->getOperator(),
|
DstPattern = new TreePatternNode(DstPattern->getOperator(),
|
||||||
ResultNodeOperands,
|
ResultNodeOperands,
|
||||||
DstPattern->getNumTypes());
|
DstPattern->getNumTypes());
|
||||||
|
|
||||||
for (unsigned i = 0, e = Result->getOnlyTree()->getNumTypes(); i != e; ++i)
|
for (unsigned i = 0, e = Result.getOnlyTree()->getNumTypes(); i != e; ++i)
|
||||||
DstPattern->setType(i, Result->getOnlyTree()->getExtType(i));
|
DstPattern->setType(i, Result.getOnlyTree()->getExtType(i));
|
||||||
|
|
||||||
TreePattern Temp(Result->getRecord(), DstPattern, false, *this);
|
TreePattern Temp(Result.getRecord(), DstPattern, false, *this);
|
||||||
Temp.InferAllTypes();
|
Temp.InferAllTypes();
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user