summaryrefslogtreecommitdiff
path: root/gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-04-06 14:26:57 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-04-06 14:26:57 +0000
commit5b0514634148624e8c36b28a654e89ce77f7cc92 (patch)
treec8c69996dfcbfd77243169cfb2652e27604a50d3 /gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp
parent2d2537b3985221b371b2a4a1471fa2e56b846bf0 (diff)
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp b/gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp
index 75b9bc6cca4..723c0cd773f 100644
--- a/gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/gnu/llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -820,8 +820,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
}
unsigned NumMIOps = 0;
- for (auto &Operand : CGA.ResultOperands)
- NumMIOps += Operand.getMINumOperands();
+ for (auto &ResultInstOpnd : CGA.ResultInst->Operands)
+ NumMIOps += ResultInstOpnd.MINumOperands;
std::string Cond;
Cond = std::string("MI->getNumOperands() == ") + utostr(NumMIOps);
@@ -831,6 +831,19 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
unsigned MIOpNum = 0;
for (unsigned i = 0, e = LastOpNo; i != e; ++i) {
+ // Skip over tied operands as they're not part of an alias declaration.
+ auto &Operands = CGA.ResultInst->Operands;
+ unsigned OpNum = Operands.getSubOperandNumber(MIOpNum).first;
+ if (Operands[OpNum].MINumOperands == 1 &&
+ Operands[OpNum].getTiedRegister() != -1) {
+ // Tied operands of different RegisterClass should be explicit within
+ // an instruction's syntax and so cannot be skipped.
+ int TiedOpNum = Operands[OpNum].getTiedRegister();
+ if (Operands[OpNum].Rec->getName() ==
+ Operands[TiedOpNum].Rec->getName())
+ ++MIOpNum;
+ }
+
std::string Op = "MI->getOperand(" + utostr(MIOpNum) + ")";
const CodeGenInstAlias::ResultOperand &RO = CGA.ResultOperands[i];
@@ -1024,8 +1037,10 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
O << " OS << '\\t' << StringRef(AsmString, I);\n";
O << " if (AsmString[I] != '\\0') {\n";
- O << " if (AsmString[I] == ' ' || AsmString[I] == '\\t')";
+ O << " if (AsmString[I] == ' ' || AsmString[I] == '\\t') {\n";
O << " OS << '\\t';\n";
+ O << " ++I;\n";
+ O << " }\n";
O << " do {\n";
O << " if (AsmString[I] == '$') {\n";
O << " ++I;\n";