[PATCH] D98533: [M68k] Forward declare getMCInstrBeads in one place

Ricky Taylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 12 11:57:53 PST 2021


ricky26 created this revision.
Herald added a subscriber: hiraditya.
ricky26 published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

At the moment `getMCInstrBeads` is forward-declared in a few places,
bring this together into a single header file.

This was done as part of the disassembler work, since the disassembler
would otherwise add one more forward declaration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98533

Files:
  llvm/lib/Target/M68k/M68kInstrInfo.cpp
  llvm/lib/Target/M68k/M68kInstrInfo.h
  llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp
  llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.h


Index: llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.h
===================================================================
--- /dev/null
+++ llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.h
@@ -0,0 +1,28 @@
+//===-- M68kMCCodeEmitter.h - M68k Code Emitter ----------------*- C++ -*--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the declarations for the code emitter which are useful
+/// outside of the emitter itself.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_M68K_MCTARGETDESC_M68KMCCODEEMITTER_H
+#define LLVM_LIB_TARGET_M68K_MCTARGETDESC_M68KMCCODEEMITTER_H
+
+#include <cstdint>
+
+namespace llvm {
+namespace M68k {
+
+const uint8_t *getMCInstrBeads(unsigned);
+
+} // namespace M68k
+} // namespace llvm
+
+#endif
Index: llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp
+++ llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp
@@ -11,6 +11,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#include "MCTargetDesc/M68kMCCodeEmitter.h"
 #include "MCTargetDesc/M68kBaseInfo.h"
 #include "MCTargetDesc/M68kFixupKinds.h"
 #include "MCTargetDesc/M68kMCTargetDesc.h"
@@ -27,12 +28,7 @@
 #include "llvm/Support/EndianStream.h"
 #include "llvm/Support/raw_ostream.h"
 
-namespace llvm {
-namespace M68k {
-// Forward declarations
-const uint8_t *getMCInstrBeads(unsigned);
-} // end namespace M68k
-} // end namespace llvm
+#include "M68kGenMCCodeBeads.inc"
 
 using namespace llvm;
 
@@ -315,8 +311,6 @@
   return EmitConstant(Imm & ((1 << Size) - 1), Size, Pad, Buffer, Offset);
 }
 
-#include "M68kGenMCCodeBeads.inc"
-
 void M68kMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
                                           SmallVectorImpl<MCFixup> &Fixups,
                                           const MCSubtargetInfo &STI) const {
Index: llvm/lib/Target/M68k/M68kInstrInfo.h
===================================================================
--- llvm/lib/Target/M68k/M68kInstrInfo.h
+++ llvm/lib/Target/M68k/M68kInstrInfo.h
@@ -30,9 +30,6 @@
 class M68kSubtarget;
 
 namespace M68k {
-// Forward declaration
-const uint8_t *getMCInstrBeads(unsigned Opcode);
-
 // These MUST be kept in sync with codes definitions in M68kInstrInfo.td
 enum CondCode {
   COND_T = 0,   // True
Index: llvm/lib/Target/M68k/M68kInstrInfo.cpp
===================================================================
--- llvm/lib/Target/M68k/M68kInstrInfo.cpp
+++ llvm/lib/Target/M68k/M68kInstrInfo.cpp
@@ -16,6 +16,7 @@
 #include "M68kInstrBuilder.h"
 #include "M68kMachineFunction.h"
 #include "M68kTargetMachine.h"
+#include "MCTargetDesc/M68kMCCodeEmitter.h"
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98533.330301.patch
Type: text/x-patch
Size: 3190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/ddc45a0d/attachment.bin>


More information about the llvm-commits mailing list