Index: llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h =================================================================== --- llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h +++ llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h @@ -46,6 +46,8 @@ bool emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI) override; +private: + void emitPrefixInstruction(const MCInst &Inst, const MCSubtargetInfo &STI); }; MCELFStreamer *createPPCELFStreamer(MCContext &Context, Index: llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp =================================================================== --- llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp +++ llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp @@ -45,17 +45,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::emitPrefixInstruction(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 @@ -94,6 +85,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; + } + emitPrefixInstruction(Inst, STI); +} + void PPCELFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) { LastLabel = Symbol; LastLabelLoc = Loc;