diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h @@ -95,9 +95,6 @@ SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; - void emitInstruction(uint64_t Val, unsigned Size, const MCSubtargetInfo &STI, - SmallVectorImpl &CB) const; - void encodeInstruction(const MCInst &MI, SmallVectorImpl &CB, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const override; diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp @@ -270,17 +270,6 @@ return getExprOpValue(MO.getExpr(), Fixups, STI); } -void AVRMCCodeEmitter::emitInstruction(uint64_t Val, unsigned Size, - const MCSubtargetInfo &STI, - SmallVectorImpl &CB) const { - size_t WordCount = Size / 2; - - for (int64_t i = WordCount - 1; i >= 0; --i) { - uint16_t Word = (Val >> (i * 16)) & 0xFFFF; - support::endian::write(CB, Word, support::endianness::little); - } -} - void AVRMCCodeEmitter::encodeInstruction(const MCInst &MI, SmallVectorImpl &CB, SmallVectorImpl &Fixups, @@ -293,7 +282,11 @@ assert(Size > 0 && "Instruction size cannot be zero"); uint64_t BinaryOpCode = getBinaryCodeForInstr(MI, Fixups, STI); - emitInstruction(BinaryOpCode, Size, STI, CB); + + for (int64_t i = Size / 2 - 1; i >= 0; --i) { + uint16_t Word = (BinaryOpCode >> (i * 16)) & 0xFFFF; + support::endian::write(CB, Word, support::endianness::little); + } } MCCodeEmitter *createAVRMCCodeEmitter(const MCInstrInfo &MCII,