diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-07-17 16:11:37 +0000 |
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-07-17 16:11:37 +0000 |
| commit | ad0293ca4175670a5a8b770b0c38728fe234022c (patch) | |
| tree | 3a13daf1534d3adcc41cf483a1e58446a5244f67 /llvm/utils/TableGen | |
| parent | 7b33faaf38a49787b209cfa514bfda5e20d1fc40 (diff) | |
| download | bcm5719-llvm-ad0293ca4175670a5a8b770b0c38728fe234022c.tar.gz bcm5719-llvm-ad0293ca4175670a5a8b770b0c38728fe234022c.zip | |
[Tablegen][PredicateExpander] Fix a bug in `expandCheckImmOperand`.
Function `expandCheckImmOperand` should always check if the input machine
instruction is passed by reference before calling method `getOperand()` on it.
Found while working on a patch that relies on `expandCheckImmOperand` to expand
a scheduling predicate.
llvm-svn: 337294
Diffstat (limited to 'llvm/utils/TableGen')
| -rw-r--r-- | llvm/utils/TableGen/PredicateExpander.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/PredicateExpander.cpp b/llvm/utils/TableGen/PredicateExpander.cpp index 62a01dc8854..56ffa77e4ed 100644 --- a/llvm/utils/TableGen/PredicateExpander.cpp +++ b/llvm/utils/TableGen/PredicateExpander.cpp @@ -22,14 +22,14 @@ void PredicateExpander::expandFalse(formatted_raw_ostream &OS) { void PredicateExpander::expandCheckImmOperand(formatted_raw_ostream &OS, int OpIndex, int ImmVal) { - OS << "MI.getOperand(" << OpIndex << ").getImm() " - << (shouldNegate() ? "!= " : "== ") << ImmVal; + OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex + << ").getImm() " << (shouldNegate() ? "!= " : "== ") << ImmVal; } void PredicateExpander::expandCheckImmOperand(formatted_raw_ostream &OS, int OpIndex, StringRef ImmVal) { - OS << "MI.getOperand(" << OpIndex << ").getImm() " - << (shouldNegate() ? "!= " : "== ") << ImmVal; + OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex + << ").getImm() " << (shouldNegate() ? "!= " : "== ") << ImmVal; } void PredicateExpander::expandCheckRegOperand(formatted_raw_ostream &OS, |

