mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +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,14 +3304,14 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
||||
if (LI->getSize() == 0) continue; // no pattern.
|
||||
|
||||
// Parse the instruction.
|
||||
TreePattern *Result = new TreePattern(CurPattern, LI, false, *this);
|
||||
TreePattern Result(CurPattern, LI, false, *this);
|
||||
|
||||
// Inline pattern fragments into it.
|
||||
Result->InlinePatternFragments();
|
||||
Result.InlinePatternFragments();
|
||||
|
||||
if (Result->getNumTrees() != 1)
|
||||
Result->error("Cannot handle instructions producing instructions "
|
||||
"with temporaries yet!");
|
||||
if (Result.getNumTrees() != 1)
|
||||
Result.error("Cannot handle instructions producing instructions "
|
||||
"with temporaries yet!");
|
||||
|
||||
bool IterateInference;
|
||||
bool InferredAllPatternTypes, InferredAllResultTypes;
|
||||
@ -3324,7 +3324,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
||||
// 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.
|
||||
InferredAllResultTypes =
|
||||
Result->InferAllTypes(&Pattern->getNamedNodesMap());
|
||||
Result.InferAllTypes(&Pattern->getNamedNodesMap());
|
||||
|
||||
IterateInference = false;
|
||||
|
||||
@ -3332,13 +3332,13 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
||||
// 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
|
||||
// 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());
|
||||
i != e; ++i) {
|
||||
IterateInference = Pattern->getTree(0)->
|
||||
UpdateNodeType(i, Result->getTree(0)->getExtType(i), *Result);
|
||||
IterateInference |= Result->getTree(0)->
|
||||
UpdateNodeType(i, Pattern->getTree(0)->getExtType(i), *Result);
|
||||
IterateInference = Pattern->getTree(0)->UpdateNodeType(
|
||||
i, Result.getTree(0)->getExtType(i), Result);
|
||||
IterateInference |= Result.getTree(0)->UpdateNodeType(
|
||||
i, Pattern->getTree(0)->getExtType(i), Result);
|
||||
}
|
||||
|
||||
// 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.
|
||||
if (!IterateInference && InferredAllPatternTypes &&
|
||||
!InferredAllResultTypes)
|
||||
IterateInference = ForceArbitraryInstResultType(Result->getTree(0),
|
||||
*Result);
|
||||
IterateInference =
|
||||
ForceArbitraryInstResultType(Result.getTree(0), Result);
|
||||
} while (IterateInference);
|
||||
|
||||
// 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!");
|
||||
if (!InferredAllResultTypes) {
|
||||
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.
|
||||
@ -3375,7 +3375,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
||||
InstImpResults);
|
||||
|
||||
// Promote the xform function to be an explicit node if set.
|
||||
TreePatternNode *DstPattern = Result->getOnlyTree();
|
||||
TreePatternNode *DstPattern = Result.getOnlyTree();
|
||||
std::vector<TreePatternNode*> ResultNodeOperands;
|
||||
for (unsigned ii = 0, ee = DstPattern->getNumChildren(); ii != ee; ++ii) {
|
||||
TreePatternNode *OpNode = DstPattern->getChild(ii);
|
||||
@ -3387,16 +3387,16 @@ void CodeGenDAGPatterns::ParsePatterns() {
|
||||
}
|
||||
ResultNodeOperands.push_back(OpNode);
|
||||
}
|
||||
DstPattern = Result->getOnlyTree();
|
||||
DstPattern = Result.getOnlyTree();
|
||||
if (!DstPattern->isLeaf())
|
||||
DstPattern = new TreePatternNode(DstPattern->getOperator(),
|
||||
ResultNodeOperands,
|
||||
DstPattern->getNumTypes());
|
||||
|
||||
for (unsigned i = 0, e = Result->getOnlyTree()->getNumTypes(); i != e; ++i)
|
||||
DstPattern->setType(i, Result->getOnlyTree()->getExtType(i));
|
||||
for (unsigned i = 0, e = Result.getOnlyTree()->getNumTypes(); i != e; ++i)
|
||||
DstPattern->setType(i, Result.getOnlyTree()->getExtType(i));
|
||||
|
||||
TreePattern Temp(Result->getRecord(), DstPattern, false, *this);
|
||||
TreePattern Temp(Result.getRecord(), DstPattern, false, *this);
|
||||
Temp.InferAllTypes();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user