mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-20 12:31:40 +00:00
Nate wants to define 'Pat's which turn into instructions that don't have
patterns. Certainly a logical request. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8d94832394
commit
0c0cfa741f
@ -975,11 +975,36 @@ void DAGISelEmitter::ParseInstructions() {
|
|||||||
std::vector<Record*> Instrs = Records.getAllDerivedDefinitions("Instruction");
|
std::vector<Record*> Instrs = Records.getAllDerivedDefinitions("Instruction");
|
||||||
|
|
||||||
for (unsigned i = 0, e = Instrs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Instrs.size(); i != e; ++i) {
|
||||||
if (!dynamic_cast<ListInit*>(Instrs[i]->getValueInit("Pattern")))
|
ListInit *LI = 0;
|
||||||
continue; // no pattern yet, ignore it.
|
|
||||||
|
|
||||||
ListInit *LI = Instrs[i]->getValueAsListInit("Pattern");
|
if (dynamic_cast<ListInit*>(Instrs[i]->getValueInit("Pattern")))
|
||||||
if (LI->getSize() == 0) continue; // no pattern.
|
LI = Instrs[i]->getValueAsListInit("Pattern");
|
||||||
|
|
||||||
|
// If there is no pattern, only collect minimal information about the
|
||||||
|
// instruction for its operand list. We have to assume that there is one
|
||||||
|
// result, as we have no detailed info.
|
||||||
|
if (!LI || LI->getSize() == 0) {
|
||||||
|
std::vector<MVT::ValueType> ResultTypes;
|
||||||
|
std::vector<MVT::ValueType> OperandTypes;
|
||||||
|
|
||||||
|
CodeGenInstruction &InstInfo =Target.getInstruction(Instrs[i]->getName());
|
||||||
|
|
||||||
|
// Doesn't even define a result?
|
||||||
|
if (InstInfo.OperandList.size() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Assume the first operand is the result.
|
||||||
|
ResultTypes.push_back(InstInfo.OperandList[0].Ty);
|
||||||
|
|
||||||
|
// The rest are inputs.
|
||||||
|
for (unsigned j = 1, e = InstInfo.OperandList.size(); j != e; ++j)
|
||||||
|
OperandTypes.push_back(InstInfo.OperandList[j].Ty);
|
||||||
|
|
||||||
|
// Create and insert the instruction.
|
||||||
|
Instructions.insert(std::make_pair(Instrs[i],
|
||||||
|
DAGInstruction(0, ResultTypes, OperandTypes)));
|
||||||
|
continue; // no pattern.
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the instruction.
|
// Parse the instruction.
|
||||||
TreePattern *I = new TreePattern(Instrs[i], LI, *this);
|
TreePattern *I = new TreePattern(Instrs[i], LI, *this);
|
||||||
@ -1112,6 +1137,7 @@ void DAGISelEmitter::ParseInstructions() {
|
|||||||
for (std::map<Record*, DAGInstruction>::iterator II = Instructions.begin(),
|
for (std::map<Record*, DAGInstruction>::iterator II = Instructions.begin(),
|
||||||
E = Instructions.end(); II != E; ++II) {
|
E = Instructions.end(); II != E; ++II) {
|
||||||
TreePattern *I = II->second.getPattern();
|
TreePattern *I = II->second.getPattern();
|
||||||
|
if (I == 0) continue; // No pattern.
|
||||||
|
|
||||||
if (I->getNumTrees() != 1) {
|
if (I->getNumTrees() != 1) {
|
||||||
std::cerr << "CANNOT HANDLE: " << I->getRecord()->getName() << " yet!";
|
std::cerr << "CANNOT HANDLE: " << I->getRecord()->getName() << " yet!";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user