-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Mips] Implement MipsInstrInfo::getNop() operation #135524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// REQUIRES: mips-registered-target | ||
// RUN: %clang_cc1 -triple mipsel-w64-windows-gnu -x c++ -mrelocation-model static -emit-obj %s -o - | llvm-objdump -a - | FileCheck %s | ||
// CHECK: file format coff-mips | ||
|
||
[[__noreturn__]] inline void g() { | ||
__builtin_unreachable(); | ||
} | ||
|
||
void f(int i) | ||
{ | ||
if (i == 0) | ||
g(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,14 @@ MipsInstrInfo::GetMemOperand(MachineBasicBlock &MBB, int FI, | |
MFI.getObjectAlign(FI)); | ||
} | ||
|
||
MCInst MipsInstrInfo::getNop() const { | ||
MCInst Nop; | ||
// using Mips::NOP gives | ||
// "fatal error: error in backend: Not supported instr: <MCInst 580>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we need address this error and use Mips::NOP? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch is already an improvement, because it replaces a compiler crash by the use of a valid instruction (although deprecated in recent architectures). |
||
Nop.setOpcode(Mips::SSNOP); | ||
return Nop; | ||
} | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Branch Analysis | ||
//===----------------------------------------------------------------------===// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://maskray.me/blog/2021-08-08-toolchain-testing#the-test-checks-too-little#the-test-checks-at-the-wrong-layer
Should generally avoid clang/test/CodeGen test for lib/Target changes. llvm/test/MC/Mips testing is in a pretty bad state. You might want to check RISCV/LoongArch.
(I will have limited internet access between April 20th and May 4th, and my response time may be delayed..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang++ -target "mipsel-w64-windows-gnu" -c test.cpp
avoid deprecated-target
. Use--target=