[PATCH] D102926: [RISCV] Fix wrong objfile attribute bug.
Zakk Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 09:00:50 PDT 2021
khchen created this revision.
khchen added reviewers: craig.topper, jrtc27, HsiangKai, asb.
Herald added subscribers: vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
khchen requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
Need to EmitAttributes after get the correct feature bit.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102926
Files:
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/test/CodeGen/RISCV/subtarget-features-obj-bug.ll
Index: llvm/test/CodeGen/RISCV/subtarget-features-obj-bug.ll
===================================================================
--- llvm/test/CodeGen/RISCV/subtarget-features-obj-bug.ll
+++ llvm/test/CodeGen/RISCV/subtarget-features-obj-bug.ll
@@ -2,7 +2,7 @@
; RUN: | FileCheck %s
; CHECK: TagName: arch
-; CHECK: Value: rv64i2p0
+; CHECK: Value: rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0
target triple = "riscv64-unknown-linux-gnu"
Index: llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -65,11 +65,7 @@
return LowerRISCVMachineOperandToMCOperand(MO, MCOp, *this);
}
- void emitStartOfAsmFile(Module &M) override;
void emitEndOfAsmFile(Module &M) override;
-
-private:
- void emitAttributes();
};
}
@@ -177,23 +173,14 @@
return false;
}
-void RISCVAsmPrinter::emitStartOfAsmFile(Module &M) {
- if (TM.getTargetTriple().isOSBinFormatELF())
- emitAttributes();
-}
-
void RISCVAsmPrinter::emitEndOfAsmFile(Module &M) {
RISCVTargetStreamer &RTS =
static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer());
- if (TM.getTargetTriple().isOSBinFormatELF())
+ if (TM.getTargetTriple().isOSBinFormatELF()) {
+ RTS.emitTargetAttributes(*STI);
RTS.finishAttributeSection();
-}
-
-void RISCVAsmPrinter::emitAttributes() {
- RISCVTargetStreamer &RTS =
- static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer());
- RTS.emitTargetAttributes(*STI);
+ }
}
// Force static initialization.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102926.347052.patch
Type: text/x-patch
Size: 1621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210521/c4747da0/attachment.bin>
More information about the llvm-commits
mailing list