[PATCH] D158589: [MIPS] Add handing of forbidden slot when IR with inline asm

Ying Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 01:13:16 PDT 2023


yingopq created this revision.
Herald added subscribers: atanasyan, jrtc27, hiraditya, arichardson, sdardis.
Herald added a project: All.
yingopq requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

Modify: Pass in parameter MachineInstr *MI to get next line IR
instruction TSFlags.  Pass out current instruction TSFlags using
parameter ErrorInfo to help next instruction in inline asm get
TSFlags of previous instruction.

Fix scenarios:
1.Fix when inline asm ends with branch instruction and then compiler
generate another CTI immediately, CTI lie in forbidden slot.
test: Use function foo1 in new file llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll.
2.Fix when inline asm ends with branch instruction and next IR line
was also inline asm, need insert nop between them.
test: Use function foo2 in new file llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll.
3.Fix when inline asm includes CTI following branch instruction, need
insert nop between them.
test: Use function foo3 in new file llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll.
4.Also add test for scenario that have been realized in pass, when
CTI follow branch instruction.
test: Use function foo0 in new file llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll.
5.Fix when .set reorder is set in handwritten assembly file, nop need
insert between branch instruction and CTI.
test: in new file llvm/test/MC/Mips/forbidden-slot.s

Test result:
$ ./build/bin/llvm-lit -v ./llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll llvm/test/MC/Mips/forbidden-slot.s

- Testing: 2 tests, 2 workers --

PASS: LLVM :: CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll (1 of 2)
PASS: LLVM :: MC/Mips/forbidden-slot.s (2 of 2)
Testing Time: 0.09s

  Passed: 2


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158589

Files:
  llvm/include/llvm/CodeGen/AsmPrinter.h
  llvm/include/llvm/MC/MCParser/MCAsmParser.h
  llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/MC/MCParser/MasmParser.cpp
  llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  llvm/lib/Target/Mips/MipsInstrInfo.cpp
  llvm/test/CodeGen/Mips/llvm-ir/forbidden-slot-ir.ll
  llvm/test/MC/Mips/forbidden-slot.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158589.552617.patch
Type: text/x-patch
Size: 19075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230823/8ccb4ddc/attachment.bin>


More information about the llvm-commits mailing list