diff options
| author | Andrew Trick <atrick@apple.com> | 2012-08-29 03:52:57 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2012-08-29 03:52:57 +0000 |
| commit | 818f5ac5fc6eabef6dfaa3753ea3e5f811a9037f (patch) | |
| tree | a7b08a96d90e7b56778d8b522decd32dcf4c6a01 /llvm/utils | |
| parent | e87e559e62fa7442b3bd8f2762f570c351083c89 (diff) | |
| download | bcm5719-llvm-818f5ac5fc6eabef6dfaa3753ea3e5f811a9037f.tar.gz bcm5719-llvm-818f5ac5fc6eabef6dfaa3753ea3e5f811a9037f.zip | |
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.
llvm-svn: 162824
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 097cbfc6808..9e8e9462cc6 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/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; } |

