From f9ec2fb34a48eb9e8e73027ec790235e1075ae85 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 30 Oct 2010 19:47:49 +0000 Subject: [PATCH] fix typos and some serious bugs in feature handling (but not for cases that are currently exercised). Thanks to Frits van Bommel for the great review! llvm-svn: 117840 --- llvm/docs/CodeGenerator.html | 2 +- llvm/utils/TableGen/AsmMatcherEmitter.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/docs/CodeGenerator.html b/llvm/docs/CodeGenerator.html index 60d54e507bc4..0a7761782545 100644 --- a/llvm/docs/CodeGenerator.html +++ b/llvm/docs/CodeGenerator.html @@ -1909,7 +1909,7 @@ description.

-

The first phase of alias processing is simple instruction mneomonic +

The first phase of alias processing is simple instruction mnemonic remapping for classes of instructions which are allowed with two different mnemonics. This phase is a simple and unconditionally remapping from one input mnemonic to one output mnemonic. It isn't possible for this form of alias to diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 999c137109b0..80f5e0841a51 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -1571,21 +1571,25 @@ static bool EmitMnemonicAliases(raw_ostream &OS) { // We can't have two aliases from the same mnemonic with no predicate. PrintError(ToVec[AliasWithNoPredicate]->getLoc(), "two MnemonicAliases with the same 'from' mnemonic!"); - PrintError(R->getLoc(), "this is the other MnemonicAliases."); - throw std::string("ERROR: Invalid MnemonicAliases definitions!"); + PrintError(R->getLoc(), "this is the other MnemonicAlias."); + throw std::string("ERROR: Invalid MnemonicAlias definitions!"); } AliasWithNoPredicate = i; continue; } + if (!MatchCode.empty()) + MatchCode += "else "; MatchCode += "if ((Features & " + FeatureMask + ") == "+FeatureMask+")\n"; MatchCode += " Mnemonic = \"" +R->getValueAsString("ToMnemonic")+"\";\n"; } if (AliasWithNoPredicate != -1) { Record *R = ToVec[AliasWithNoPredicate]; - MatchCode += "Mnemonic = \"" + R->getValueAsString("ToMnemonic") + "\";"; + if (!MatchCode.empty()) + MatchCode += "else\n "; + MatchCode += "Mnemonic = \"" + R->getValueAsString("ToMnemonic")+"\";\n"; } MatchCode += "return;"; -- GitLab