Index: llvm/trunk/docs/MIRLangRef.rst =================================================================== --- llvm/trunk/docs/MIRLangRef.rst +++ llvm/trunk/docs/MIRLangRef.rst @@ -365,12 +365,17 @@ Instruction Flags ^^^^^^^^^^^^^^^^^ -The flag ``frame-setup`` can be specified before the instruction's name: +The flag ``frame-setup`` or ``frame-destroy`` can be specified before the +instruction's name: .. code-block:: text %fp = frame-setup ADDXri %sp, 0, 0 +.. code-block:: text + + %x21, %x20 = frame-destroy LDPXi %sp + .. _registers: Registers Index: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h =================================================================== --- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h +++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h @@ -63,6 +63,7 @@ kw_renamable, kw_tied_def, kw_frame_setup, + kw_frame_destroy, kw_debug_location, kw_cfi_same_value, kw_cfi_offset, Index: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp +++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp @@ -211,6 +211,7 @@ .Case("renamable", MIToken::kw_renamable) .Case("tied-def", MIToken::kw_tied_def) .Case("frame-setup", MIToken::kw_frame_setup) + .Case("frame-destroy", MIToken::kw_frame_destroy) .Case("debug-location", MIToken::kw_debug_location) .Case("same_value", MIToken::kw_cfi_same_value) .Case("offset", MIToken::kw_cfi_offset) Index: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp +++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp @@ -925,6 +925,9 @@ if (Token.is(MIToken::kw_frame_setup)) { Flags |= MachineInstr::FrameSetup; lex(); + } else if (Token.is(MIToken::kw_frame_destroy)) { + Flags |= MachineInstr::FrameDestroy; + lex(); } if (Token.isNot(MIToken::Identifier)) return error("expected a machine instruction"); Index: llvm/trunk/lib/CodeGen/MIRPrinter.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MIRPrinter.cpp +++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp @@ -670,6 +670,9 @@ OS << " = "; if (MI.getFlag(MachineInstr::FrameSetup)) OS << "frame-setup "; + else if (MI.getFlag(MachineInstr::FrameDestroy)) + OS << "frame-destroy "; + OS << TII->getName(MI.getOpcode()); if (I < E) OS << ' '; Index: llvm/trunk/test/CodeGen/AArch64/arm64-csldst-mmo.ll =================================================================== --- llvm/trunk/test/CodeGen/AArch64/arm64-csldst-mmo.ll +++ llvm/trunk/test/CodeGen/AArch64/arm64-csldst-mmo.ll @@ -11,7 +11,7 @@ ; CHECK: Before post-MI-sched: ; CHECK-LABEL: # Machine code for function test1: ; CHECK: SU(2): STRWui %wzr -; CHECK: SU(3): %x21, %x20 = LDPXi %sp +; CHECK: SU(3): %x21, %x20 = LDPXi %sp, 2; flags: FrameDestroy ; CHECK: Predecessors: ; CHECK-NEXT: SU(0): Out ; CHECK-NEXT: SU(0): Out Index: llvm/trunk/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir =================================================================== --- llvm/trunk/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir +++ llvm/trunk/test/CodeGen/MIR/X86/frame-setup-instruction-flag.mir @@ -30,6 +30,7 @@ ; CHECK: frame-setup PUSH64r %rax frame-setup PUSH64r %rax, implicit-def %rsp, implicit %rsp CALL64pcrel32 @compute, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp, implicit-def %eax - %rdx = POP64r implicit-def %rsp, implicit %rsp + ; CHECK: %rdx = frame-destroy POP64r + %rdx = frame-destroy POP64r implicit-def %rsp, implicit %rsp RETQ %eax ...