[MC] Always encode instruction into SmallVector
authorAlexis Engelke <engelke@in.tum.de>
Fri, 10 Mar 2023 14:20:30 +0000 (15:20 +0100)
committerAlexis Engelke <engelke@in.tum.de>
Thu, 6 Apr 2023 14:21:49 +0000 (16:21 +0200)
commit0c049ea60a9f214911eef7901b94bd6343c04409
tree651cb452f0b689efd96efdfd9bea56fb88b3d471
parentc471f26e81e0aa7a22ecc7f696957e4cfdf6fdec
[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
21 files changed:
bolt/include/bolt/Core/BinaryContext.h
bolt/lib/Core/BinaryContext.cpp
bolt/lib/Core/BinaryFunction.cpp
llvm/include/llvm/MC/MCCodeEmitter.h
llvm/include/llvm/MCA/CodeEmitter.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCCodeEmitter.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCMachOStreamer.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCSPIRVStreamer.cpp
llvm/lib/MC/MCWasmStreamer.cpp
llvm/lib/MC/MCWinCOFFStreamer.cpp
llvm/lib/MC/MCXCOFFStreamer.cpp
llvm/lib/MCA/CodeEmitter.cpp
llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/lib/Target/X86/X86MCInstLower.cpp
llvm/tools/llvm-exegesis/lib/LlvmState.cpp