mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Add support for naming the destination of a "set" in a pattern
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7748 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
88118bf787
commit
57fb6ab871
@ -138,6 +138,7 @@ Pattern::Pattern(PatternType pty, DagInit *RawPat, Record *TheRec,
|
|||||||
if (!Tree->getChild(0)->isLeaf())
|
if (!Tree->getChild(0)->isLeaf())
|
||||||
error("Arg #0 of set should be a register or register class!");
|
error("Arg #0 of set should be a register or register class!");
|
||||||
Result = Tree->getChild(0)->getValueRecord();
|
Result = Tree->getChild(0)->getValueRecord();
|
||||||
|
ResultName = Tree->getChildName(0);
|
||||||
Tree = Tree->getChild(1);
|
Tree = Tree->getChild(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -895,6 +896,9 @@ static std::string getArgName(Pattern *P, const std::string &ArgName,
|
|||||||
for (unsigned i = 0, e = P->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = P->getNumArgs(); i != e; ++i)
|
||||||
if (P->getArgName(i) == ArgName)
|
if (P->getArgName(i) == ArgName)
|
||||||
return Operands[i].second + "->Val";
|
return Operands[i].second + "->Val";
|
||||||
|
|
||||||
|
if (ArgName == P->getResultName())
|
||||||
|
return "NewReg";
|
||||||
P->error("Pattern does not define a value named $" + ArgName + "!");
|
P->error("Pattern does not define a value named $" + ArgName + "!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ private:
|
|||||||
/// register result, specified with a (set) in the pattern.
|
/// register result, specified with a (set) in the pattern.
|
||||||
///
|
///
|
||||||
Record *Result;
|
Record *Result;
|
||||||
|
std::string ResultName; // The name of the result value...
|
||||||
|
|
||||||
/// TheRecord - The actual TableGen record corresponding to this pattern.
|
/// TheRecord - The actual TableGen record corresponding to this pattern.
|
||||||
///
|
///
|
||||||
@ -185,6 +186,7 @@ public:
|
|||||||
TreePatternNode *getTree() const { return Tree; }
|
TreePatternNode *getTree() const { return Tree; }
|
||||||
|
|
||||||
Record *getResult() const { return Result; }
|
Record *getResult() const { return Result; }
|
||||||
|
const std::string &getResultName() const { return ResultName; }
|
||||||
|
|
||||||
/// getRecord - Return the actual TableGen record corresponding to this
|
/// getRecord - Return the actual TableGen record corresponding to this
|
||||||
/// pattern.
|
/// pattern.
|
||||||
|
@ -138,6 +138,7 @@ Pattern::Pattern(PatternType pty, DagInit *RawPat, Record *TheRec,
|
|||||||
if (!Tree->getChild(0)->isLeaf())
|
if (!Tree->getChild(0)->isLeaf())
|
||||||
error("Arg #0 of set should be a register or register class!");
|
error("Arg #0 of set should be a register or register class!");
|
||||||
Result = Tree->getChild(0)->getValueRecord();
|
Result = Tree->getChild(0)->getValueRecord();
|
||||||
|
ResultName = Tree->getChildName(0);
|
||||||
Tree = Tree->getChild(1);
|
Tree = Tree->getChild(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -895,6 +896,9 @@ static std::string getArgName(Pattern *P, const std::string &ArgName,
|
|||||||
for (unsigned i = 0, e = P->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = P->getNumArgs(); i != e; ++i)
|
||||||
if (P->getArgName(i) == ArgName)
|
if (P->getArgName(i) == ArgName)
|
||||||
return Operands[i].second + "->Val";
|
return Operands[i].second + "->Val";
|
||||||
|
|
||||||
|
if (ArgName == P->getResultName())
|
||||||
|
return "NewReg";
|
||||||
P->error("Pattern does not define a value named $" + ArgName + "!");
|
P->error("Pattern does not define a value named $" + ArgName + "!");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ private:
|
|||||||
/// register result, specified with a (set) in the pattern.
|
/// register result, specified with a (set) in the pattern.
|
||||||
///
|
///
|
||||||
Record *Result;
|
Record *Result;
|
||||||
|
std::string ResultName; // The name of the result value...
|
||||||
|
|
||||||
/// TheRecord - The actual TableGen record corresponding to this pattern.
|
/// TheRecord - The actual TableGen record corresponding to this pattern.
|
||||||
///
|
///
|
||||||
@ -185,6 +186,7 @@ public:
|
|||||||
TreePatternNode *getTree() const { return Tree; }
|
TreePatternNode *getTree() const { return Tree; }
|
||||||
|
|
||||||
Record *getResult() const { return Result; }
|
Record *getResult() const { return Result; }
|
||||||
|
const std::string &getResultName() const { return ResultName; }
|
||||||
|
|
||||||
/// getRecord - Return the actual TableGen record corresponding to this
|
/// getRecord - Return the actual TableGen record corresponding to this
|
||||||
/// pattern.
|
/// pattern.
|
||||||
|
Loading…
Reference in New Issue
Block a user