[PATCH] D152849: [BOLT][NFCI] Remove redundant instance of MCAsmBackend
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 12:22:45 PDT 2023
maksfb created this revision.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a subscriber: treapster.
Herald added a project: All.
maksfb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Use instance of MCAsmBackend from BinaryContext instead of creating a
new one.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152849
Files:
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -5730,10 +5730,6 @@
// Copy allocatable part of the input.
OS << InputFile->getData().substr(0, FirstNonAllocatableOffset);
- // We obtain an asm-specific writer so that we can emit nops in an
- // architecture-specific way at the end of the function.
- std::unique_ptr<MCAsmBackend> MAB(
- BC->TheTarget->createMCAsmBackend(*BC->STI, *BC->MRI, MCTargetOptions()));
auto Streamer = BC->createStreamer(OS);
// Make sure output stream has enough reserved space, otherwise
// pwrite() will fail.
@@ -5802,8 +5798,8 @@
if (Function->getMaxSize() != std::numeric_limits<uint64_t>::max()) {
uint64_t Pos = OS.tell();
OS.seek(Function->getFileOffset() + Function->getImageSize());
- MAB->writeNopData(OS, Function->getMaxSize() - Function->getImageSize(),
- &*BC->STI);
+ BC->MAB->writeNopData(
+ OS, Function->getMaxSize() - Function->getImageSize(), &*BC->STI);
OS.seek(Pos);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152849.531029.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/2d2baa67/attachment.bin>
More information about the llvm-commits
mailing list