[llvm-commits] [llvm] r118326 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Chris Lattner
sabre at nondot.org
Fri Nov 5 23:45:08 PDT 2010
Author: lattner
Date: Sat Nov 6 01:45:08 2010
New Revision: 118326
URL: http://llvm.org/viewvc/llvm-project?rev=118326&view=rev
Log:
simplify
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=118326&r1=118325&r2=118326&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Sat Nov 6 01:45:08 2010
@@ -306,9 +306,6 @@
}
};
- /// ResultInst - The result instruction generated.
- const CodeGenInstruction *ResultInst;
-
/// TheDef - This is the definition of the instruction or InstAlias that this
/// matchable came from.
Record *const TheDef;
@@ -349,13 +346,11 @@
MatchableInfo(const CodeGenInstruction &CGI)
: TheDef(CGI.TheDef), DefRec(&CGI),
TheOperandList(CGI.Operands), AsmString(CGI.AsmString) {
- ResultInst = &CGI;
}
MatchableInfo(const CodeGenInstAlias *Alias)
: TheDef(Alias->TheDef), DefRec(Alias), TheOperandList(Alias->Operands),
AsmString(Alias->AsmString) {
- ResultInst = Alias->ResultInst;
}
void Initialize(const AsmMatcherInfo &Info,
@@ -1821,7 +1816,14 @@
it != ie; ++it) {
MatchableInfo &II = **it;
- OS << " { " << Target.getName() << "::" << II.ResultInst->TheDef->getName()
+
+ const CodeGenInstruction *ResultInst;
+ if (II.DefRec.is<const CodeGenInstruction*>())
+ ResultInst = II.DefRec.get<const CodeGenInstruction*>();
+ else
+ ResultInst = II.DefRec.get<const CodeGenInstAlias*>()->ResultInst;
+
+ OS << " { " << Target.getName() << "::" << ResultInst->TheDef->getName()
<< ", \"" << II.Mnemonic << "\""
<< ", " << II.ConversionFnKind << ", { ";
for (unsigned i = 0, e = II.AsmOperands.size(); i != e; ++i) {
More information about the llvm-commits
mailing list