summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2014-12-16 18:05:28 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2014-12-16 18:05:28 +0000
commit0dc19792937bb64d795a9ff809eb73cc3fb81fd0 (patch)
tree86da563e661be9c921dbac93bc4b77525b9a2672 /llvm/utils
parent1944a8cd0479ad4b229f9305cf58cef4105f2afa (diff)
downloadbcm5719-llvm-0dc19792937bb64d795a9ff809eb73cc3fb81fd0.tar.gz
bcm5719-llvm-0dc19792937bb64d795a9ff809eb73cc3fb81fd0.zip
[MC] Reset the MCInst in the matcher function before adding opcode/operands.
On X86, the Intel asm parser tries to match all memory operand sizes when none is explicitly specified. For LEA, which doesn't really have a memory operand (just a pointer one), this results in multiple successful matches, one for each memory size. There's no error because it's same opcode, so really, it's just one match. However, the tablegen'd matcher function adds opcode/operands to the passed MCInst, and this results in multiple duplicated operands. This commit clears the MCInst in the tablegen'd matcher function. We sometimes clear it when the match failed, so there's no expectation of keeping the previous content anyway. Differential Revision: http://reviews.llvm.org/D6670 llvm-svn: 224347
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/AsmMatcherEmitter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 5b2ff6792d4..85312b13923 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -2965,6 +2965,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " continue;\n";
OS << " }\n";
OS << "\n";
+ OS << " Inst.clear();\n\n";
OS << " if (matchingInlineAsm) {\n";
OS << " Inst.setOpcode(it->Opcode);\n";
OS << " convertToMapAndConstraints(it->ConvertFn, Operands);\n";
OpenPOWER on IntegriCloud