summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2011-01-20 18:38:10 +0000
committerBob Wilson <bob.wilson@apple.com>2011-01-20 18:38:10 +0000
commit55931ab992d8f7fd23d1e8fa994cd8b03b98569f (patch)
treea1e6361055293ce42f0406b05a15a1f5aa376c0b /utils
parent906bc368bc0fe18682edc0743ada41f62e436383 (diff)
downloadllvm-55931ab992d8f7fd23d1e8fa994cd8b03b98569f.tar.gz
llvm-55931ab992d8f7fd23d1e8fa994cd8b03b98569f.tar.bz2
llvm-55931ab992d8f7fd23d1e8fa994cd8b03b98569f.tar.xz
Move InstAlias check of argument types to a separate loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index 5927041243..241105f9bb 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -403,6 +403,20 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
// NameClass - If argument names are repeated, we need to verify they have
// the same class.
StringMap<Record*> NameClass;
+ for (unsigned i = 0, e = Result->getNumArgs(); i != e; ++i) {
+ DefInit *ADI = dynamic_cast<DefInit*>(Result->getArg(i));
+ if (!ADI || Result->getArgName(i).empty())
+ continue;
+ // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
+ // $foo can exist multiple times in the result list, but it must have the
+ // same type.
+ Record *&Entry = NameClass[Result->getArgName(i)];
+ if (Entry && Entry != ADI->getDef())
+ throw TGError(R->getLoc(), "result value $" + Result->getArgName(i) +
+ " is both " + Entry->getName() + " and " +
+ ADI->getDef()->getName() + "!");
+ Entry = ADI->getDef();
+ }
// Decode and validate the arguments of the result.
unsigned AliasOpNo = 0;
@@ -474,17 +488,6 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
", instruction operand is class " +
ResultOpRec->getName());
- // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
- // $foo can exist multiple times in the result list, but it must have the
- // same type.
- Record *&Entry = NameClass[Result->getArgName(AliasOpNo)];
- if (Entry && Entry != ADI->getDef())
- throw TGError(R->getLoc(), "result value $" +
- Result->getArgName(AliasOpNo) +
- " is both " + Entry->getName() + " and " +
- ADI->getDef()->getName() + "!");
- Entry = ADI->getDef();
-
// Now that it is validated, add it.
ResultOperands.push_back(ResultOperand(Result->getArgName(AliasOpNo),
ADI->getDef()));