1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[M68k] Make M68k TargetMachine use getter function

This makes M68k match other platforms in this regard.

This was done as part of the AsmParser/Disassembler work since the entry
functions of those modules usually reference `getTheXXXTarget()`.

Differential Revision: https://reviews.llvm.org/D98517
This commit is contained in:
Ricky Taylor 2021-03-14 11:51:58 -07:00 committed by Min-Yih Hsu
parent b94c972042
commit 784e884345
6 changed files with 32 additions and 11 deletions

View File

@ -18,6 +18,7 @@
#include "M68k.h"
#include "M68kMachineFunction.h"
#include "TargetInfo/M68kTargetInfo.h"
#include "llvm/Support/TargetRegistry.h"
@ -65,5 +66,5 @@ void M68kAsmPrinter::emitStartOfAsmFile(Module &M) {
void M68kAsmPrinter::emitEndOfAsmFile(Module &M) {}
extern "C" void LLVMInitializeM68kAsmPrinter() {
RegisterAsmPrinter<M68kAsmPrinter> X(TheM68kTarget);
RegisterAsmPrinter<M68kAsmPrinter> X(getTheM68kTarget());
}

View File

@ -13,6 +13,7 @@
#include "M68kTargetMachine.h"
#include "M68k.h"
#include "TargetInfo/M68kTargetInfo.h"
#include "M68kSubtarget.h"
#include "M68kTargetObjectFile.h"
@ -28,7 +29,7 @@ using namespace llvm;
#define DEBUG_TYPE "m68k"
extern "C" void LLVMInitializeM68kTarget() {
RegisterTargetMachine<M68kTargetMachine> X(TheM68kTarget);
RegisterTargetMachine<M68kTargetMachine> X(getTheM68kTarget());
}
namespace {

View File

@ -12,10 +12,9 @@
//===----------------------------------------------------------------------===//
#include "M68kMCTargetDesc.h"
#include "M68kMCAsmInfo.h"
#include "M68kInstPrinter.h"
#include "M68kMCAsmInfo.h"
#include "TargetInfo/M68kTargetInfo.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCInstPrinter.h"
@ -108,7 +107,7 @@ static MCInstPrinter *createM68kMCInstPrinter(const Triple &T,
}
extern "C" void LLVMInitializeM68kTargetMC() {
Target &T = TheM68kTarget;
Target &T = getTheM68kTarget();
// Register the MC asm info.
RegisterMCAsmInfoFn X(T, createM68kMCAsmInfo);

View File

@ -33,8 +33,6 @@ class StringRef;
class raw_ostream;
class raw_pwrite_stream;
extern Target TheM68kTarget;
MCAsmBackend *createM68kAsmBackend(const Target &T, const MCSubtargetInfo &STI,
const MCRegisterInfo &MRI,
const MCTargetOptions &Options);

View File

@ -10,14 +10,18 @@
/// This file contains M68k target initializer.
///
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/M68kMCTargetDesc.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
Target llvm::TheM68kTarget;
namespace llvm {
Target &getTheM68kTarget() {
static Target TheM68kTarget;
return TheM68kTarget;
}
} // namespace llvm
extern "C" void LLVMInitializeM68kTargetInfo() {
RegisterTarget<Triple::m68k, /*HasJIT=*/true> X(
TheM68kTarget, "m68k", "Motorola 68000 family", "M68k");
getTheM68kTarget(), "m68k", "Motorola 68000 family", "M68k");
}

View File

@ -0,0 +1,18 @@
//===-- M68kTargetInfo.h - M68k Target Implementation -----------*- 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_M68K_TARGETINFO_M68KTARGETINFO_H
#define LLVM_LIB_TARGET_M68K_TARGETINFO_M68KTARGETINFO_H
namespace llvm {
class Target;
Target &getTheM68kTarget();
} // namespace llvm
#endif // LLVM_LIB_TARGET_M68K_TARGETINFO_M68KTARGETINFO_H