[llvm] 5a4bcec - [PowerPC][NFC] Split PPCELFStreamer::emitInstruction
Stefan Pintilie via llvm-commits
llvm-commits at lists.llvm.org
Mon May 25 04:51:32 PDT 2020
Author: Stefan Pintilie
Date: 2020-05-25T06:48:58-05:00
New Revision: 5a4bcec8db420cf22b06720d45a9f9981b0297bf
URL: https://github.com/llvm/llvm-project/commit/5a4bcec8db420cf22b06720d45a9f9981b0297bf
DIFF: https://github.com/llvm/llvm-project/commit/5a4bcec8db420cf22b06720d45a9f9981b0297bf.diff
LOG: [PowerPC][NFC] Split PPCELFStreamer::emitInstruction
Split off PPCELFStreamer::emitPrefixedInstruction from
PPCELFStreamer::emitInstruction.
Differential Revision: https://reviews.llvm.org/D79626
Added:
Modified:
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index c9760ed38bcc..4373778cc96c 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -44,17 +44,8 @@ PPCELFStreamer::PPCELFStreamer(MCContext &Context,
std::move(Emitter)), LastLabel(NULL) {
}
-void PPCELFStreamer::emitInstruction(const MCInst &Inst,
- const MCSubtargetInfo &STI) {
- PPCMCCodeEmitter *Emitter =
- static_cast<PPCMCCodeEmitter*>(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,
}
}
+void PPCELFStreamer::emitInstruction(const MCInst &Inst,
+ const MCSubtargetInfo &STI) {
+ PPCMCCodeEmitter *Emitter =
+ static_cast<PPCMCCodeEmitter*>(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;
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
index 403681ed383a..51863232d071 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
@@ -41,6 +41,8 @@ class PPCELFStreamer : public MCELFStreamer {
// 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,
More information about the llvm-commits
mailing list