summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIParser.cpp12
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp2
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp2
-rw-r--r--llvm/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir4
4 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index f3d46afb0b0..18cc6db3196 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -923,11 +923,13 @@ bool MIParser::verifyImplicitOperands(ArrayRef<ParsedMachineOperand> Operands,
}
bool MIParser::parseInstruction(unsigned &OpCode, unsigned &Flags) {
- if (Token.is(MIToken::kw_frame_setup)) {
- Flags |= MachineInstr::FrameSetup;
- lex();
- } else if (Token.is(MIToken::kw_frame_destroy)) {
- Flags |= MachineInstr::FrameDestroy;
+ // Allow both:
+ // * frame-setup frame-destroy OPCODE
+ // * frame-destroy frame-setup OPCODE
+ while (Token.is(MIToken::kw_frame_setup) ||
+ Token.is(MIToken::kw_frame_destroy)) {
+ Flags |= Token.is(MIToken::kw_frame_setup) ? MachineInstr::FrameSetup
+ : MachineInstr::FrameDestroy;
lex();
}
if (Token.isNot(MIToken::Identifier))
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 683ad6e479a..e2be2e989b6 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -672,7 +672,7 @@ void MIPrinter::print(const MachineInstr &MI) {
OS << " = ";
if (MI.getFlag(MachineInstr::FrameSetup))
OS << "frame-setup ";
- else if (MI.getFlag(MachineInstr::FrameDestroy))
+ if (MI.getFlag(MachineInstr::FrameDestroy))
OS << "frame-destroy ";
OS << TII->getName(MI.getOpcode());
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 7d04e6b4d77..5f3989bbe7e 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1292,7 +1292,7 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
if (getFlag(MachineInstr::FrameSetup))
OS << "frame-setup ";
- else if (getFlag(MachineInstr::FrameDestroy))
+ if (getFlag(MachineInstr::FrameDestroy))
OS << "frame-destroy ";
// Print the opcode name.
diff --git a/llvm/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir b/llvm/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir
index 98fc57da38d..2e6d48c4647 100644
--- a/llvm/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir
+++ b/llvm/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir
@@ -32,5 +32,9 @@ body: |
CALL64pcrel32 @compute, csr_64, implicit $rsp, implicit $edi, implicit-def $rsp, implicit-def $eax
; CHECK: $rdx = frame-destroy POP64r
$rdx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ ; CHECK: $rdx = frame-setup frame-destroy POP64r
+ $rdx = frame-setup frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ ; CHECK: $rdx = frame-setup frame-destroy POP64r
+ $rdx = frame-destroy frame-setup POP64r implicit-def $rsp, implicit $rsp
RETQ $eax
...
OpenPOWER on IntegriCloud