summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-08-29 03:52:57 +0000
committerAndrew Trick <atrick@apple.com>2012-08-29 03:52:57 +0000
commit2b70dfaaebcc436c53b2c86cd8a9574baba47253 (patch)
treec21e370e68a8e470f301212fd22f1b7fceb99ddb /utils
parentc4dc2490c4ea2c75e451eec5950179f06d2610a2 (diff)
downloadllvm-2b70dfaaebcc436c53b2c86cd8a9574baba47253.tar.gz
llvm-2b70dfaaebcc436c53b2c86cd8a9574baba47253.tar.bz2
llvm-2b70dfaaebcc436c53b2c86cd8a9574baba47253.tar.xz
Fix a nondeterminism in the ARM assembler.
Adding arbitrary records to ARM.td would break basic-arm-instructions.s because selection of nop vs mov r0,r0 was ambiguous (this will be tested by a subsequent addition to ARM.td). An imperfect but sensible fix is to give precedence to match rules that have more constraints. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 097cbfc680..9e8e9462cc 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -488,6 +488,15 @@ struct MatchableInfo {
return false;
}
+ // Give matches that require more features higher precedence. This is useful
+ // because we cannot define AssemblerPredicates with the negation of
+ // processor features. For example, ARM v6 "nop" may be either a HINT or
+ // MOV. With v6, we want to match HINT. The assembler has no way to
+ // predicate MOV under "NoV6", but HINT will always match first because it
+ // requires V6 while MOV does not.
+ if (RequiredFeatures.size() != RHS.RequiredFeatures.size())
+ return RequiredFeatures.size() > RHS.RequiredFeatures.size();
+
return false;
}