[PATCH] D79626: [PowerPC][NFC] Split PPCELFStreamer::emitInstruction

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 25 05:19:37 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a4bcec8db42: [PowerPC][NFC] Split PPCELFStreamer::emitInstruction (authored by stefanp).

Changed prior to commit:
  https://reviews.llvm.org/D79626?vs=262855&id=266006#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79626/new/

https://reviews.llvm.org/D79626

Files:
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h


Index: llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
===================================================================
--- llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
+++ llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
@@ -41,6 +41,8 @@
 
   // 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,
Index: llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
===================================================================
--- llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -44,17 +44,8 @@
                     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,
+                                     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79626.266006.patch
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200525/4c78afea/attachment-0001.bin>


More information about the llvm-commits mailing list