diff options
author | Maksim Panchenko <maks@fb.com> | 2023-06-12 18:21:58 -0700 |
---|---|---|
committer | Maksim Panchenko <maks@fb.com> | 2023-06-13 13:14:05 -0700 |
commit | 1ebad216ef0471ddc25b27ab559f883029203411 (patch) | |
tree | 0fd6a0046bfa87a29e5fc4c9fbc40a79ee9460bd /bolt | |
parent | 54711a6a5872d5f97da4c0a1bd7e58d0546ca701 (diff) | |
download | llvm-1ebad216ef0471ddc25b27ab559f883029203411.zip llvm-1ebad216ef0471ddc25b27ab559f883029203411.tar.gz llvm-1ebad216ef0471ddc25b27ab559f883029203411.tar.bz2 |
[BOLT][NFCI] Remove redundant instance of MCAsmBackend
Use instance of MCAsmBackend from BinaryContext instead of creating a
new one.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152849
Diffstat (limited to 'bolt')
-rw-r--r-- | bolt/lib/Rewrite/RewriteInstance.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 3481787..4b9617e7 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -5730,10 +5730,6 @@ void RewriteInstance::rewriteFile() { // 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 @@ void RewriteInstance::rewriteFile() { 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); } |