[PATCH] D155426: [AVR][NFC] Merge AVRMCCodeEmitter::emitInstruction into AVRMCCodeEmitter::encodeInstruction.
Jianjian Guan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 19:57:58 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0d6530728ff2: [AVR][NFC] Merge AVRMCCodeEmitter::emitInstruction into AVRMCCodeEmitter… (authored by jacquesguan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155426/new/
https://reviews.llvm.org/D155426
Files:
llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h
Index: llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h
===================================================================
--- llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h
+++ llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h
@@ -95,9 +95,6 @@
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
- void emitInstruction(uint64_t Val, unsigned Size, const MCSubtargetInfo &STI,
- SmallVectorImpl<char> &CB) const;
-
void encodeInstruction(const MCInst &MI, SmallVectorImpl<char> &CB,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const override;
Index: llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
+++ 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<char> &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<char> &CB,
SmallVectorImpl<MCFixup> &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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155426.541306.patch
Type: text/x-patch
Size: 2130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230718/f1faebd5/attachment.bin>
More information about the llvm-commits
mailing list