aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCMachOStreamer.cpp
diff options
context:
space:
mode:
authorAlexis Engelke <engelke@in.tum.de>2023-03-10 15:20:30 +0100
committerAlexis Engelke <engelke@in.tum.de>2023-04-06 16:21:49 +0200
commit0c049ea60a9f214911eef7901b94bd6343c04409 (patch)
tree651cb452f0b689efd96efdfd9bea56fb88b3d471 /llvm/lib/MC/MCMachOStreamer.cpp
parentc471f26e81e0aa7a22ecc7f696957e4cfdf6fdec (diff)
downloadllvm-0c049ea60a9f214911eef7901b94bd6343c04409.zip
llvm-0c049ea60a9f214911eef7901b94bd6343c04409.tar.gz
llvm-0c049ea60a9f214911eef7901b94bd6343c04409.tar.bz2
[MC] Always encode instruction into SmallVector
All users of MCCodeEmitter::encodeInstruction use a raw_svector_ostream to encode the instruction into a SmallVector. The raw_ostream however incurs some overhead for the actual encoding. This change allows an MCCodeEmitter to directly emit an instruction into a SmallVector without using a raw_ostream and therefore allow for performance improvments in encoding. A default path that uses existing raw_ostream implementations is provided. Reviewed By: MaskRay, Amir Differential Revision: https://reviews.llvm.org/D145791
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 699742f..986c0c2c 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -31,7 +31,6 @@
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <vector>
@@ -486,8 +485,7 @@ void MCMachOStreamer::emitInstToData(const MCInst &Inst,
SmallVector<MCFixup, 4> Fixups;
SmallString<256> Code;
- raw_svector_ostream VecOS(Code);
- getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
+ getAssembler().getEmitter().encodeInstruction(Inst, Code, Fixups, STI);
// Add the fixups and data.
for (MCFixup &Fixup : Fixups) {