summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-01-24 23:26:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-01-24 23:26:31 +0000
commitc0a7007d3a6a7bb31eec568b9dfdb8fb137702e5 (patch)
tree71a37b118a90b490b8aaf3dbe21baa3ce2f4a179 /utils
parent5899a60d2fb02f7e2d094d710babbe1d3bd97254 (diff)
downloadexternal_llvm-c0a7007d3a6a7bb31eec568b9dfdb8fb137702e5.zip
external_llvm-c0a7007d3a6a7bb31eec568b9dfdb8fb137702e5.tar.gz
external_llvm-c0a7007d3a6a7bb31eec568b9dfdb8fb137702e5.tar.bz2
tblgen/AsmMatcherEmitter: Fix alias handling to honor -match-prefix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 082b1c5..a2c5de3 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1090,6 +1090,13 @@ void AsmMatcherInfo::BuildInfo() {
for (unsigned i = 0, e = AllInstAliases.size(); i != e; ++i) {
CodeGenInstAlias *Alias = new CodeGenInstAlias(AllInstAliases[i], Target);
+ // If the tblgen -match-prefix option is specified (for tblgen hackers),
+ // filter the set of instruction aliases we consider, based on the target
+ // instruction.
+ if (!StringRef(Alias->ResultInst->TheDef->getName()).startswith(
+ MatchPrefix))
+ continue;
+
OwningPtr<MatchableInfo> II(new MatchableInfo(Alias));
II->Initialize(*this, SingletonRegisters);
@@ -1708,6 +1715,10 @@ static std::string GetAliasRequiredFeatures(Record *R,
/// EmitMnemonicAliases - If the target has any MnemonicAlias<> definitions,
/// emit a function for them and return true, otherwise return false.
static bool EmitMnemonicAliases(raw_ostream &OS, const AsmMatcherInfo &Info) {
+ // Ignore aliases when match-prefix is set.
+ if (!MatchPrefix.empty())
+ return false;
+
std::vector<Record*> Aliases =
Info.getRecords().getAllDerivedDefinitions("MnemonicAlias");
if (Aliases.empty()) return false;