summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-30 21:43:05 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-30 21:43:05 +0000
commiteac13a36b87b8bb323b341cbda171438815073f0 (patch)
tree1e3480e0a3f1610680b1a793833c19033de08612
parent0274766be5914317cb4947fa169dbe55ff4aec6b (diff)
downloadbcm5719-llvm-eac13a36b87b8bb323b341cbda171438815073f0.tar.gz
bcm5719-llvm-eac13a36b87b8bb323b341cbda171438815073f0.zip
Hoist a check to eliminate obvious mismatches as early as possible. Also, fix
an 80-column violation in the generated code. No functional change intended. llvm-svn: 162944
-rw-r--r--llvm/utils/TableGen/AsmMatcherEmitter.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 25e9fbb4ec9..2d028c29b73 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -2770,6 +2770,12 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " MCInst &Inst, unsigned &ErrorInfo, ";
OS << "unsigned VariantID) {\n";
+ OS << " // Eliminate obvious mismatches.\n";
+ OS << " if (Operands.size() > " << (MaxNumOperands+1) << ") {\n";
+ OS << " ErrorInfo = " << (MaxNumOperands+1) << ";\n";
+ OS << " return Match_InvalidOperand;\n";
+ OS << " }\n\n";
+
// Emit code to get the available features.
OS << " // Get the current feature set.\n";
OS << " unsigned AvailableFeatures = getAvailableFeatures();\n\n";
@@ -2786,12 +2792,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
}
// Emit code to compute the class list for this operand vector.
- OS << " // Eliminate obvious mismatches.\n";
- OS << " if (Operands.size() > " << (MaxNumOperands+1) << ") {\n";
- OS << " ErrorInfo = " << (MaxNumOperands+1) << ";\n";
- OS << " return Match_InvalidOperand;\n";
- OS << " }\n\n";
-
OS << " // Some state to try to produce better error messages.\n";
OS << " bool HadMatchOtherThanFeatures = false;\n";
OS << " bool HadMatchOtherThanPredicate = false;\n";
@@ -2856,8 +2856,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " HadMatchOtherThanFeatures = true;\n";
OS << " unsigned NewMissingFeatures = it->RequiredFeatures & "
"~AvailableFeatures;\n";
- OS << " if (CountPopulation_32(NewMissingFeatures) <= "
- "CountPopulation_32(MissingFeatures))\n";
+ OS << " if (CountPopulation_32(NewMissingFeatures) <=\n"
+ " CountPopulation_32(MissingFeatures))\n";
OS << " MissingFeatures = NewMissingFeatures;\n";
OS << " continue;\n";
OS << " }\n";
OpenPOWER on IntegriCloud