forked from OSchip/llvm-project
![]() Summary: When we encode an instruction, we need to know the number of bytes being emitted to determine the fixups in `X86MCCodeEmitter::emitImmediate`. There are only two callers for `emitImmediate`: `emitMemModRMByte` and `encodeInstruction`. Before this patch, we kept track of the current byte being emitted by passing a reference parameter `CurByte` across all the `emit*` funtions, which is ugly and unnecessary. For example, we don't have any fixups when emitting prefixes, so we don't need to track this value. In this patch, we use `StartByte` to record the initial status of the streamer, and use `OS.tell()` to get the current status of the streamer when we need to know the number of bytes being emitted. On one hand, this eliminates the parameter `CurByte` for most `emit*` functions, on the other hand, this make things clear: Only pass the parameter when we really need it. Reviewers: craig.topper, pengfei, MaskRay Reviewed By: craig.topper, MaskRay Subscribers: hiraditya, llvm-commits, annita.zhang Tags: #llvm Differential Revision: https://reviews.llvm.org/D78419 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
LLVMBuild.txt | ||
X86ATTInstPrinter.cpp | ||
X86ATTInstPrinter.h | ||
X86AsmBackend.cpp | ||
X86BaseInfo.h | ||
X86ELFObjectWriter.cpp | ||
X86FixupKinds.h | ||
X86InstComments.cpp | ||
X86InstComments.h | ||
X86InstPrinterCommon.cpp | ||
X86InstPrinterCommon.h | ||
X86IntelInstPrinter.cpp | ||
X86IntelInstPrinter.h | ||
X86MCAsmInfo.cpp | ||
X86MCAsmInfo.h | ||
X86MCCodeEmitter.cpp | ||
X86MCExpr.h | ||
X86MCTargetDesc.cpp | ||
X86MCTargetDesc.h | ||
X86MachObjectWriter.cpp | ||
X86ShuffleDecode.cpp | ||
X86ShuffleDecode.h | ||
X86TargetStreamer.h | ||
X86WinCOFFObjectWriter.cpp | ||
X86WinCOFFStreamer.cpp | ||
X86WinCOFFTargetStreamer.cpp |