[PATCH] D79626: [PowerPC][NFC] Split PPCELFStreamer::emitInstruction
Stefan Pintilie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 04:47:38 PDT 2020
stefanp created this revision.
stefanp added reviewers: nemanjai, lei, PowerPC, hfinkel.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: LLVM.
Split off PPCELFStreamer::emitPrefixInstruction from PPCELFStreamer::emitInstruction.
Repository:
rG LLVM Github Monorepo
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
@@ -46,6 +46,8 @@
bool emitRelocDirective(const MCExpr &Offset, StringRef Name,
const MCExpr *Expr, SMLoc Loc,
const MCSubtargetInfo &STI) override;
+private:
+ void emitPrefixInstruction(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
@@ -45,17 +45,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::emitPrefixInstruction(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
@@ -94,6 +85,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;
+ }
+ emitPrefixInstruction(Inst, STI);
+}
+
void PPCELFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
LastLabel = Symbol;
LastLabelLoc = Loc;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79626.262855.patch
Type: text/x-patch
Size: 2300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200508/bb42aec1/attachment.bin>
More information about the llvm-commits
mailing list