[PATCH] D102535: [RISCV] -mno-relax: emit .option norelax
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 14 14:29:20 PDT 2021
MaskRay updated this revision to Diff 345566.
MaskRay added a comment.
improve test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102535/new/
https://reviews.llvm.org/D102535
Files:
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/test/CodeGen/RISCV/option-norelax2.ll
Index: llvm/test/CodeGen/RISCV/option-norelax2.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/RISCV/option-norelax2.ll
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=riscv32 -mattr=-relax < %s | FileCheck %s
+; RUN: llc -mtriple=riscv64 -mattr=-relax < %s | FileCheck %s
+
+; RUN: llc -mtriple=riscv64 -mattr=+relax < %s | FileCheck %s --check-prefix=RELAX
+
+; CHECK: .option norelax
+
+; RELAX-NOT: .option norelax
+
+define void @foo() {
+ ret void
+}
Index: llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -178,6 +178,11 @@
}
void RISCVAsmPrinter::emitStartOfAsmFile(Module &M) {
+ if (!STI->getFeatureBits()[RISCV::FeatureRelax]) {
+ static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer())
+ .emitDirectiveOptionNoRelax();
+ }
+
if (TM.getTargetTriple().isOSBinFormatELF())
emitAttributes();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102535.345566.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210514/e63ae9b1/attachment.bin>
More information about the llvm-commits
mailing list