1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

malloc elimination: it's a bad idea to use raw_svector_ostream on a

small heap-allocated SmallString because it unconditionally forces a malloc.

(Revised version of r129688, with the necessary flush() call.)

llvm-svn: 129716
This commit is contained in:
Eli Friedman 2011-04-18 20:54:46 +00:00
parent 7220c1a021
commit 9009047cff

View File

@ -191,8 +191,11 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst) {
void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) {
MCInstFragment *IF = new MCInstFragment(Inst, getCurrentSectionData());
raw_svector_ostream VecOS(IF->getCode());
SmallString<128> Code;
raw_svector_ostream VecOS(Code);
getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, IF->getFixups());
VecOS.flush();
IF->getCode().append(Code.begin(), Code.end());
}
static const MCExpr *BuildSymbolDiff(MCContext &Context,