diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h @@ -41,6 +41,8 @@ // EmitLabel updates LastLabel and LastLabelLoc when a new label is emitted. void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; +private: + void emitPrefixedInstruction(const MCInst &Inst, const MCSubtargetInfo &STI); }; MCELFStreamer *createPPCELFStreamer(MCContext &Context, diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp @@ -44,17 +44,8 @@ std::move(Emitter)), LastLabel(NULL) { } -void PPCELFStreamer::emitInstruction(const MCInst &Inst, - const MCSubtargetInfo &STI) { - PPCMCCodeEmitter *Emitter = - static_cast(getAssembler().getEmitterPtr()); - - // Special handling is only for prefixed instructions. - if (!Emitter->isPrefixedInstruction(Inst)) { - MCELFStreamer::emitInstruction(Inst, STI); - return; - } - +void PPCELFStreamer::emitPrefixedInstruction(const MCInst &Inst, + const MCSubtargetInfo &STI) { // Prefixed instructions must not cross a 64-byte boundary (i.e. prefix is // before the boundary and the remaining 4-bytes are after the boundary). In // order to achieve this, a nop is added prior to any such boundary-crossing @@ -93,6 +84,19 @@ } } +void PPCELFStreamer::emitInstruction(const MCInst &Inst, + const MCSubtargetInfo &STI) { + PPCMCCodeEmitter *Emitter = + static_cast(getAssembler().getEmitterPtr()); + + // Special handling is only for prefixed instructions. + if (!Emitter->isPrefixedInstruction(Inst)) { + MCELFStreamer::emitInstruction(Inst, STI); + return; + } + emitPrefixedInstruction(Inst, STI); +} + void PPCELFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) { LastLabel = Symbol; LastLabelLoc = Loc;