mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Some refactoring so TargetRegistry.h no longer has to include any files
from MC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
acc8f2d938
commit
7801136b95
@ -15,18 +15,10 @@
|
||||
#ifndef LLVM_MC_MCCODEGENINFO_H
|
||||
#define LLVM_MC_MCCODEGENINFO_H
|
||||
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// Relocation model types.
|
||||
namespace Reloc {
|
||||
enum Model { Default, Static, PIC_, DynamicNoPIC };
|
||||
}
|
||||
|
||||
// Code model types.
|
||||
namespace CodeModel {
|
||||
enum Model { Default, JITDefault, Small, Kernel, Medium, Large };
|
||||
}
|
||||
|
||||
class MCCodeGenInfo {
|
||||
/// RelocationModel - Relocation model: statcic, pic, etc.
|
||||
///
|
||||
|
@ -23,8 +23,9 @@ protected:
|
||||
friend class Target;
|
||||
const MCInstrInfo *Info;
|
||||
|
||||
MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
|
||||
public:
|
||||
MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
|
||||
|
||||
virtual ~MCInstrAnalysis() {}
|
||||
|
||||
virtual bool isBranch(const MCInst &Inst) const {
|
||||
|
32
include/llvm/Support/CodeGen.h
Normal file
32
include/llvm/Support/CodeGen.h
Normal file
@ -0,0 +1,32 @@
|
||||
//===-- llvm/Support/CodeGen.h - CodeGen Concepts ---------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file define some types which define code generation concepts. For
|
||||
// example, relocation model.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_CODEGEN_H
|
||||
#define LLVM_SUPPORT_CODEGEN_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// Relocation model types.
|
||||
namespace Reloc {
|
||||
enum Model { Default, Static, PIC_, DynamicNoPIC };
|
||||
}
|
||||
|
||||
// Code model types.
|
||||
namespace CodeModel {
|
||||
enum Model { Default, JITDefault, Small, Kernel, Medium, Large };
|
||||
}
|
||||
|
||||
} // end llvm namespace
|
||||
|
||||
#endif
|
@ -19,8 +19,7 @@
|
||||
#ifndef LLVM_TARGET_TARGETREGISTRY_H
|
||||
#define LLVM_TARGET_TARGETREGISTRY_H
|
||||
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrAnalysis.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
@ -36,6 +35,7 @@ namespace llvm {
|
||||
class MCCodeGenInfo;
|
||||
class MCContext;
|
||||
class MCDisassembler;
|
||||
class MCInstrAnalysis;
|
||||
class MCInstPrinter;
|
||||
class MCInstrInfo;
|
||||
class MCRegisterInfo;
|
||||
@ -291,7 +291,7 @@ namespace llvm {
|
||||
///
|
||||
MCInstrAnalysis *createMCInstrAnalysis(const MCInstrInfo *Info) const {
|
||||
if (!MCInstrAnalysisCtorFn)
|
||||
return new MCInstrAnalysis(Info);
|
||||
return 0;
|
||||
return MCInstrAnalysisCtorFn(Info);
|
||||
}
|
||||
|
||||
@ -890,6 +890,39 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
/// RegisterMCInstrAnalysis - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the static "Create"
|
||||
/// method on the class to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCInstrAnalysisImpl>
|
||||
struct RegisterMCInstrAnalysis {
|
||||
RegisterMCInstrAnalysis(Target &T) {
|
||||
TargetRegistry::RegisterMCInstrAnalysis(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
|
||||
return new MCInstrAnalysisImpl(Info);
|
||||
}
|
||||
};
|
||||
|
||||
/// RegisterMCInstrAnalysisFn - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the specified function
|
||||
/// to do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCInstrAnalysisFn {
|
||||
RegisterMCInstrAnalysisFn(Target &T, Target::MCInstrAnalysisCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCInstrAnalysis(T, Fn);
|
||||
}
|
||||
};
|
||||
|
||||
/// RegisterMCRegInfo - Helper template for registering a target register info
|
||||
/// implementation. This invokes the static "Create" method on the class to
|
||||
/// actually do the construction. Usage:
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/MCTargetAsmParser.h"
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "ARMMCAsmInfo.h"
|
||||
#include "ARMBaseInfo.h"
|
||||
#include "InstPrinter/ARMInstPrinter.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrAnalysis.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
@ -216,17 +218,18 @@ extern "C" void LLVMInitializeARMTargetMC() {
|
||||
TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo);
|
||||
TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo);
|
||||
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheARMTarget,
|
||||
createARMMCInstrAnalysis);
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheThumbTarget,
|
||||
createARMMCInstrAnalysis);
|
||||
|
||||
// Register the MC subtarget info.
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget,
|
||||
ARM_MC::createARMMCSubtargetInfo);
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheThumbTarget,
|
||||
ARM_MC::createARMMCSubtargetInfo);
|
||||
|
||||
// Register the MC instruction analyzer.
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheARMTarget,
|
||||
createARMMCInstrAnalysis);
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheThumbTarget,
|
||||
createARMMCInstrAnalysis);
|
||||
|
||||
// Register the MC Code Emitter
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheARMTarget, createARMMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheThumbTarget, createARMMCCodeEmitter);
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "AlphaMCTargetDesc.h"
|
||||
#include "AlphaMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "BlackfinMCTargetDesc.h"
|
||||
#include "BlackfinMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "SPUMCTargetDesc.h"
|
||||
#include "SPUMCAsmInfo.h"
|
||||
#include "llvm/MC/MachineLocation.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "MBlazeMCTargetDesc.h"
|
||||
#include "MBlazeMCAsmInfo.h"
|
||||
#include "InstPrinter/MBlazeInstPrinter.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "MSP430MCTargetDesc.h"
|
||||
#include "MSP430MCAsmInfo.h"
|
||||
#include "InstPrinter/MSP430InstPrinter.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "MipsMCAsmInfo.h"
|
||||
#include "InstPrinter/MipsInstPrinter.h"
|
||||
#include "llvm/MC/MachineLocation.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "PTXMCTargetDesc.h"
|
||||
#include "PTXMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "PPCMCAsmInfo.h"
|
||||
#include "InstPrinter/PPCInstPrinter.h"
|
||||
#include "llvm/MC/MachineLocation.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "SparcMCTargetDesc.h"
|
||||
#include "SparcMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "SystemZMCTargetDesc.h"
|
||||
#include "SystemZMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "InstPrinter/X86ATTInstPrinter.h"
|
||||
#include "InstPrinter/X86IntelInstPrinter.h"
|
||||
#include "llvm/MC/MachineLocation.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrAnalysis.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
@ -393,6 +395,10 @@ static MCInstPrinter *createX86MCInstPrinter(const Target &T,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MCInstrAnalysis *createX86MCInstrAnalysis(const MCInstrInfo *Info) {
|
||||
return new MCInstrAnalysis(Info);
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeX86TargetMC() {
|
||||
// Register the MC asm info.
|
||||
@ -417,6 +423,12 @@ extern "C" void LLVMInitializeX86TargetMC() {
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheX86_64Target,
|
||||
X86_MC::createX86MCSubtargetInfo);
|
||||
|
||||
// Register the MC instruction analyzer.
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheX86_32Target,
|
||||
createX86MCInstrAnalysis);
|
||||
TargetRegistry::RegisterMCInstrAnalysis(TheX86_64Target,
|
||||
createX86MCInstrAnalysis);
|
||||
|
||||
// Register the code emitter.
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheX86_32Target,
|
||||
createX86MCCodeEmitter);
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "XCoreMCTargetDesc.h"
|
||||
#include "XCoreMCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeGenInfo.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "llvm/MC/MCDisassembler.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstPrinter.h"
|
||||
#include "llvm/MC/MCInstrAnalysis.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
|
Loading…
Reference in New Issue
Block a user