Completely reject instructions that have an operand in their
ins/outs list that isn't specified by their asmstring. Previously
the asmmatcher would just force a 0 register into it, which clearly
isn't right. Mark a bunch of ARM instructions that use this as
isCodeGenOnly. Some of them are clearly pseudo instructions (like
t2TBB) others use a weird hasExtraSrcRegAllocReq thing that will
either need to be removed or the asmmatcher will need to be taught
about it (someday).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118119 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 0620a88..5610368 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1176,27 +1176,21 @@
continue;
}
+ // Otherwise, this must be a tied operand if not, it is something that is
+ // mentioned in the ins/outs list but not in the asm string.
+ int TiedOp = OpInfo.getTiedRegister();
+ if (TiedOp == -1)
+ throw TGError(II.TheDef->getLoc(), "Instruction '" +
+ II.TheDef->getName() + "' has operand '" + OpInfo.Name +
+ "' that doesn't appear in asm string!");
// If this operand is tied to a previous one, just copy the MCInst operand
// from the earlier one.
- int TiedOp = OpInfo.getTiedRegister();
- if (TiedOp != -1) {
- // Copy the tied operand. We can only tie single MCOperand values.
- assert(OpInfo.MINumOperands == 1 && "Not a singular MCOperand");
- assert(i > unsigned(TiedOp) && "Tied operand preceeds its target!");
- CaseOS << " Inst.addOperand(Inst.getOperand(" << TiedOp << "));\n";
- Signature += "__Tie" + itostr(TiedOp);
- continue;
- }
-
- // Otherwise this is some sort of dummy operand that is mentioned in the
- // ins/outs list but not mentioned in the asmstring, brutalize a dummy
- // value into the operand.
- // FIXME: This is a terrible hack: If an MCInst operand doesn't occur in
- // the asmstring, there is no way to parse something meaningful.
- // Just assume it is a zero register for now.
- CaseOS << " Inst.addOperand(MCOperand::CreateReg(0));\n";
- Signature += "__Imp";
+ // Copy the tied operand. We can only tie single MCOperand values.
+ assert(OpInfo.MINumOperands == 1 && "Not a singular MCOperand");
+ assert(i > unsigned(TiedOp) && "Tied operand preceeds its target!");
+ CaseOS << " Inst.addOperand(Inst.getOperand(" << TiedOp << "));\n";
+ Signature += "__Tie" + itostr(TiedOp);
}
II.ConversionFnKind = Signature;