Rename createAsmInfo to createMCAsmInfo and move registration code to MCTargetDesc to prepare for next round of changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135219 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2011-07-14 23:50:31 +00:00
parent e696436a7e
commit 1abf2cb59b
92 changed files with 304 additions and 201 deletions

View File

@@ -658,6 +658,7 @@ for a_target in $TARGETS_TO_BUILD; do
[LLVM architecture name for the native architecture, if available]) [LLVM architecture name for the native architecture, if available])
LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
LLVM_NATIVE_MCASMINFO="LLVMInitialize${LLVM_NATIVE_ARCH}MCAsmInfo"
LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser" LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
@@ -666,6 +667,8 @@ for a_target in $TARGETS_TO_BUILD; do
[LLVM name for the native Target init function, if available]) [LLVM name for the native Target init function, if available])
AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO, AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
[LLVM name for the native TargetInfo init function, if available]) [LLVM name for the native TargetInfo init function, if available])
AC_DEFINE_UNQUOTED(LLVM_NATIVE_MCASMINFO, $LLVM_NATIVE_MCASMINFO,
[LLVM name for the native MCAsmInfo init function, if available])
AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER, AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER,
[LLVM name for the native AsmPrinter init function, if available]) [LLVM name for the native AsmPrinter init function, if available])
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then

View File

@@ -336,6 +336,7 @@ else ()
message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}") message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}")
set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target) set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target)
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo) set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_MCASMINFO LLVMInitialize${LLVM_NATIVE_ARCH}MCAsmInfo)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter) set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
endif () endif ()

6
configure vendored
View File

@@ -5120,6 +5120,7 @@ _ACEOF
LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
LLVM_NATIVE_MCASMINFO="LLVMInitialize${LLVM_NATIVE_ARCH}MCAsmInfo"
LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser" LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
@@ -5135,6 +5136,11 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
cat >>confdefs.h <<_ACEOF
#define LLVM_NATIVE_MCASMINFO $LLVM_NATIVE_MCASMINFO
_ACEOF
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define LLVM_NATIVE_ASMPRINTER $LLVM_NATIVE_ASMPRINTER #define LLVM_NATIVE_ASMPRINTER $LLVM_NATIVE_ASMPRINTER
_ACEOF _ACEOF

View File

@@ -41,6 +41,11 @@ typedef struct LLVMStructLayout *LLVMStructLayoutRef;
#include "llvm/Config/Targets.def" #include "llvm/Config/Targets.def"
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */ #undef LLVM_TARGET /* Explicit undef to make SWIG happier */
#define LLVM_TARGET(TargetName) \
void LLVMInitialize##TargetName##MCAsmInfo(void);
#include "llvm/Config/Targets.def"
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
/** LLVMInitializeAllTargetInfos - The main program should call this function if /** LLVMInitializeAllTargetInfos - The main program should call this function if
it wants access to all available targets that LLVM is configured to it wants access to all available targets that LLVM is configured to
support. */ support. */
@@ -67,6 +72,7 @@ static inline LLVMBool LLVMInitializeNativeTarget(void) {
#ifdef LLVM_NATIVE_TARGET #ifdef LLVM_NATIVE_TARGET
LLVM_NATIVE_TARGETINFO(); LLVM_NATIVE_TARGETINFO();
LLVM_NATIVE_TARGET(); LLVM_NATIVE_TARGET();
LLVM_NATIVE_MCASMINFO();
return 0; return 0;
#else #else
return 1; return 1;

View File

@@ -557,6 +557,9 @@
/* LLVM name for the native TargetInfo init function, if available */ /* LLVM name for the native TargetInfo init function, if available */
#cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo #cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo
/* LLVM name for the native MCAsmInfo init function, if available */
#cmakedefine LLVM_NATIVE_MCASMINFO LLVMInitialize${LLVM_NATIVE_ARCH}MCAsmInfo
/* Define if this is Unixish platform */ /* Define if this is Unixish platform */
#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} #cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}

View File

@@ -573,6 +573,9 @@
/* LLVM name for the native AsmPrinter init function, if available */ /* LLVM name for the native AsmPrinter init function, if available */
#undef LLVM_NATIVE_ASMPRINTER #undef LLVM_NATIVE_ASMPRINTER
/* LLVM name for the native MCAsmInfo init function, if available */
#undef LLVM_NATIVE_MCASMINFO
/* LLVM name for the native Target init function, if available */ /* LLVM name for the native Target init function, if available */
#undef LLVM_NATIVE_TARGET #undef LLVM_NATIVE_TARGET

View File

@@ -58,6 +58,9 @@
/* LLVM name for the native TargetInfo init function, if available */ /* LLVM name for the native TargetInfo init function, if available */
#cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo #cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo
/* LLVM name for the native MCAsmInfo init function, if available */
#cmakedefine LLVM_NATIVE_MCASMINFO LLVMInitialize${LLVM_NATIVE_ARCH}MCAsmInfo
/* LLVM name for the native AsmPrinter init function, if available */ /* LLVM name for the native AsmPrinter init function, if available */
#cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter #cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter

View File

@@ -58,6 +58,9 @@
/* LLVM name for the native TargetInfo init function, if available */ /* LLVM name for the native TargetInfo init function, if available */
#undef LLVM_NATIVE_TARGETINFO #undef LLVM_NATIVE_TARGETINFO
/* LLVM name for the native MCAsmInfo init function, if available */
#undef LLVM_NATIVE_MCASMINFO
/* LLVM name for the native AsmPrinter init function, if available */ /* LLVM name for the native AsmPrinter init function, if available */
#undef LLVM_NATIVE_ASMPRINTER #undef LLVM_NATIVE_ASMPRINTER

View File

@@ -66,7 +66,7 @@ namespace llvm {
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT); typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
typedef MCAsmInfo *(*AsmInfoCtorFnTy)(const Target &T, typedef MCAsmInfo *(*MCAsmInfoCtorFnTy)(const Target &T,
StringRef TT); StringRef TT);
typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void); typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void);
typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(void); typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(void);
@@ -128,9 +128,9 @@ namespace llvm {
/// HasJIT - Whether this target supports the JIT. /// HasJIT - Whether this target supports the JIT.
bool HasJIT; bool HasJIT;
/// AsmInfoCtorFn - Constructor function for this target's MCAsmInfo, if /// MCAsmInfoCtorFn - Constructor function for this target's MCAsmInfo, if
/// registered. /// registered.
AsmInfoCtorFnTy AsmInfoCtorFn; MCAsmInfoCtorFnTy MCAsmInfoCtorFn;
/// MCInstrInfoCtorFn - Constructor function for this target's MCInstrInfo, /// MCInstrInfoCtorFn - Constructor function for this target's MCInstrInfo,
/// if registered. /// if registered.
@@ -240,17 +240,17 @@ namespace llvm {
/// @name Feature Constructors /// @name Feature Constructors
/// @{ /// @{
/// createAsmInfo - Create a MCAsmInfo implementation for the specified /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified
/// target triple. /// target triple.
/// ///
/// \arg Triple - This argument is used to determine the target machine /// \arg Triple - This argument is used to determine the target machine
/// feature set; it should always be provided. Generally this should be /// feature set; it should always be provided. Generally this should be
/// either the target triple from the module, or the target triple of the /// either the target triple from the module, or the target triple of the
/// host if that does not exist. /// host if that does not exist.
MCAsmInfo *createAsmInfo(StringRef Triple) const { MCAsmInfo *createMCAsmInfo(StringRef Triple) const {
if (!AsmInfoCtorFn) if (!MCAsmInfoCtorFn)
return 0; return 0;
return AsmInfoCtorFn(*this, Triple); return MCAsmInfoCtorFn(*this, Triple);
} }
/// createMCInstrInfo - Create a MCInstrInfo implementation. /// createMCInstrInfo - Create a MCInstrInfo implementation.
@@ -485,7 +485,7 @@ namespace llvm {
Target::TripleMatchQualityFnTy TQualityFn, Target::TripleMatchQualityFnTy TQualityFn,
bool HasJIT = false); bool HasJIT = false);
/// RegisterAsmInfo - Register a MCAsmInfo implementation for the /// RegisterMCAsmInfo - Register a MCAsmInfo implementation for the
/// given target. /// given target.
/// ///
/// Clients are responsible for ensuring that registration doesn't occur /// Clients are responsible for ensuring that registration doesn't occur
@@ -494,10 +494,10 @@ namespace llvm {
/// ///
/// @param T - The target being registered. /// @param T - The target being registered.
/// @param Fn - A function to construct a MCAsmInfo for the target. /// @param Fn - A function to construct a MCAsmInfo for the target.
static void RegisterAsmInfo(Target &T, Target::AsmInfoCtorFnTy Fn) { static void RegisterMCAsmInfo(Target &T, Target::MCAsmInfoCtorFnTy Fn) {
// Ignore duplicate registration. // Ignore duplicate registration.
if (!T.AsmInfoCtorFn) if (!T.MCAsmInfoCtorFn)
T.AsmInfoCtorFn = Fn; T.MCAsmInfoCtorFn = Fn;
} }
/// RegisterMCInstrInfo - Register a MCInstrInfo implementation for the /// RegisterMCInstrInfo - Register a MCInstrInfo implementation for the
@@ -722,18 +722,18 @@ namespace llvm {
} }
}; };
/// RegisterAsmInfo - Helper template for registering a target assembly info /// RegisterMCAsmInfo - Helper template for registering a target assembly info
/// implementation. This invokes the static "Create" method on the class to /// implementation. This invokes the static "Create" method on the class to
/// actually do the construction. Usage: /// actually do the construction. Usage:
/// ///
/// extern "C" void LLVMInitializeFooTarget() { /// extern "C" void LLVMInitializeFooTarget() {
/// extern Target TheFooTarget; /// extern Target TheFooTarget;
/// RegisterAsmInfo<FooMCAsmInfo> X(TheFooTarget); /// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
/// } /// }
template<class MCAsmInfoImpl> template<class MCAsmInfoImpl>
struct RegisterAsmInfo { struct RegisterMCAsmInfo {
RegisterAsmInfo(Target &T) { RegisterMCAsmInfo(Target &T) {
TargetRegistry::RegisterAsmInfo(T, &Allocator); TargetRegistry::RegisterMCAsmInfo(T, &Allocator);
} }
private: private:
static MCAsmInfo *Allocator(const Target &T, StringRef TT) { static MCAsmInfo *Allocator(const Target &T, StringRef TT) {
@@ -742,17 +742,17 @@ namespace llvm {
}; };
/// RegisterAsmInfoFn - Helper template for registering a target assembly info /// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
/// implementation. This invokes the specified function to do the /// implementation. This invokes the specified function to do the
/// construction. Usage: /// construction. Usage:
/// ///
/// extern "C" void LLVMInitializeFooTarget() { /// extern "C" void LLVMInitializeFooTarget() {
/// extern Target TheFooTarget; /// extern Target TheFooTarget;
/// RegisterAsmInfoFn X(TheFooTarget, TheFunction); /// RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
/// } /// }
struct RegisterAsmInfoFn { struct RegisterMCAsmInfoFn {
RegisterAsmInfoFn(Target &T, Target::AsmInfoCtorFnTy Fn) { RegisterMCAsmInfoFn(Target &T, Target::MCAsmInfoCtorFnTy Fn) {
TargetRegistry::RegisterAsmInfo(T, Fn); TargetRegistry::RegisterMCAsmInfo(T, Fn);
} }
}; };

View File

@@ -26,6 +26,10 @@ extern "C" {
#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(); #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target();
#include "llvm/Config/Targets.def" #include "llvm/Config/Targets.def"
#define LLVM_TARGET(TargetName) \
void LLVMInitialize##TargetName##MCAsmInfo();
#include "llvm/Config/Targets.def"
#define LLVM_TARGET(TargetName) \ #define LLVM_TARGET(TargetName) \
void LLVMInitialize##TargetName##MCInstrInfo(); void LLVMInitialize##TargetName##MCInstrInfo();
#include "llvm/Config/Targets.def" #include "llvm/Config/Targets.def"
@@ -72,6 +76,17 @@ namespace llvm {
#include "llvm/Config/Targets.def" #include "llvm/Config/Targets.def"
} }
/// InitializeAllMCAsmInfos - The main program should call this function
/// if it wants access to all available assembly infos for targets that
/// LLVM is configured to support, to make them available via the
/// TargetRegistry.
///
/// It is legal for a client to make multiple calls to this function.
inline void InitializeAllMCAsmInfos() {
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##MCAsmInfo();
#include "llvm/Config/Targets.def"
}
/// InitializeAllMCInstrInfos - The main program should call this function /// InitializeAllMCInstrInfos - The main program should call this function
/// if it wants access to all available instruction infos for targets that /// if it wants access to all available instruction infos for targets that
/// LLVM is configured to support, to make them available via the /// LLVM is configured to support, to make them available via the
@@ -133,6 +148,7 @@ namespace llvm {
#ifdef LLVM_NATIVE_TARGET #ifdef LLVM_NATIVE_TARGET
LLVM_NATIVE_TARGETINFO(); LLVM_NATIVE_TARGETINFO();
LLVM_NATIVE_TARGET(); LLVM_NATIVE_TARGET();
LLVM_NATIVE_MCASMINFO();
return false; return false;
#else #else
return true; return true;

View File

@@ -105,7 +105,7 @@ EnableFastISelOption("fast-isel", cl::Hidden,
LLVMTargetMachine::LLVMTargetMachine(const Target &T, StringRef Triple, LLVMTargetMachine::LLVMTargetMachine(const Target &T, StringRef Triple,
StringRef CPU, StringRef FS) StringRef CPU, StringRef FS)
: TargetMachine(T, Triple, CPU, FS) { : TargetMachine(T, Triple, CPU, FS) {
AsmInfo = T.createAsmInfo(Triple); AsmInfo = T.createMCAsmInfo(Triple);
} }
// Set the default code model for the JIT for a generic target. // Set the default code model for the JIT for a generic target.

View File

@@ -40,6 +40,7 @@ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
llvm::InitializeAllTargetInfos(); llvm::InitializeAllTargetInfos();
// FIXME: We shouldn't need to initialize the Target(Machine)s. // FIXME: We shouldn't need to initialize the Target(Machine)s.
llvm::InitializeAllTargets(); llvm::InitializeAllTargets();
llvm::InitializeAllMCAsmInfos();
llvm::InitializeAllAsmPrinters(); llvm::InitializeAllAsmPrinters();
llvm::InitializeAllAsmParsers(); llvm::InitializeAllAsmParsers();
llvm::InitializeAllDisassemblers(); llvm::InitializeAllDisassemblers();
@@ -50,7 +51,7 @@ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
assert(TheTarget && "Unable to create target!"); assert(TheTarget && "Unable to create target!");
// Get the assembler info needed to setup the MCContext. // Get the assembler info needed to setup the MCContext.
const MCAsmInfo *MAI = TheTarget->createAsmInfo(TripleName); const MCAsmInfo *MAI = TheTarget->createMCAsmInfo(TripleName);
assert(MAI && "Unable to create target asm info!"); assert(MAI && "Unable to create target asm info!");
// Package up features to be passed to target/subtarget // Package up features to be passed to target/subtarget

View File

@@ -107,6 +107,7 @@ void EDDisassembler::initialize() {
InitializeAllTargetInfos(); InitializeAllTargetInfos();
InitializeAllTargets(); InitializeAllTargets();
InitializeAllMCAsmInfos();
InitializeAllAsmPrinters(); InitializeAllAsmPrinters();
InitializeAllAsmParsers(); InitializeAllAsmParsers();
InitializeAllDisassemblers(); InitializeAllDisassemblers();
@@ -180,7 +181,7 @@ EDDisassembler::EDDisassembler(CPUKey &key) :
initMaps(*registerInfo); initMaps(*registerInfo);
AsmInfo.reset(Tgt->createAsmInfo(tripleString)); AsmInfo.reset(Tgt->createMCAsmInfo(tripleString));
if (!AsmInfo) if (!AsmInfo)
return; return;

View File

@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "ARMTargetMachine.h" #include "ARMTargetMachine.h"
#include "ARMMCAsmInfo.h"
#include "ARMFrameLowering.h" #include "ARMFrameLowering.h"
#include "ARM.h" #include "ARM.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
@@ -22,15 +21,6 @@
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
using namespace llvm; using namespace llvm;
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
if (TheTriple.isOSDarwin())
return new ARMMCAsmInfoDarwin();
return new ARMELFMCAsmInfo();
}
// This is duplicated code. Refactor this. // This is duplicated code. Refactor this.
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
MCContext &Ctx, TargetAsmBackend &TAB, MCContext &Ctx, TargetAsmBackend &TAB,
@@ -56,10 +46,6 @@ extern "C" void LLVMInitializeARMTarget() {
RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget); RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget);
RegisterTargetMachine<ThumbTargetMachine> Y(TheThumbTarget); RegisterTargetMachine<ThumbTargetMachine> Y(TheThumbTarget);
// Register the target asm info.
RegisterAsmInfoFn A(TheARMTarget, createMCAsmInfo);
RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo);
// Register the MC Code Emitter // Register the MC Code Emitter
TargetRegistry::RegisterCodeEmitter(TheARMTarget, createARMMCCodeEmitter); TargetRegistry::RegisterCodeEmitter(TheARMTarget, createARMMCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheThumbTarget, createARMMCCodeEmitter); TargetRegistry::RegisterCodeEmitter(TheThumbTarget, createARMMCCodeEmitter);

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "ARMMCTargetDesc.h" #include "ARMMCTargetDesc.h"
#include "ARMMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -97,32 +98,47 @@ MCSubtargetInfo *ARM_MC::createARMMCSubtargetInfo(StringRef TT, StringRef CPU,
return X; return X;
} }
MCInstrInfo *createARMMCInstrInfo() { // Force static initialization.
extern "C" void LLVMInitializeARMMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget,
ARM_MC::createARMMCSubtargetInfo);
TargetRegistry::RegisterMCSubtargetInfo(TheThumbTarget,
ARM_MC::createARMMCSubtargetInfo);
}
static MCInstrInfo *createARMMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitARMMCInstrInfo(X); InitARMMCInstrInfo(X);
return X; return X;
} }
MCRegisterInfo *createARMMCRegisterInfo() {
MCRegisterInfo *X = new MCRegisterInfo();
InitARMMCRegisterInfo(X);
return X;
}
// Force static initialization.
extern "C" void LLVMInitializeARMMCInstrInfo() { extern "C" void LLVMInitializeARMMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheARMTarget, createARMMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheARMTarget, createARMMCInstrInfo);
TargetRegistry::RegisterMCInstrInfo(TheThumbTarget, createARMMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheThumbTarget, createARMMCInstrInfo);
} }
static MCRegisterInfo *createARMMCRegisterInfo() {
MCRegisterInfo *X = new MCRegisterInfo();
InitARMMCRegisterInfo(X);
return X;
}
extern "C" void LLVMInitializeARMMCRegInfo() { extern "C" void LLVMInitializeARMMCRegInfo() {
TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo); TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo);
TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo); TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo);
} }
extern "C" void LLVMInitializeARMMCSubtargetInfo() { static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget, Triple TheTriple(TT);
ARM_MC::createARMMCSubtargetInfo);
TargetRegistry::RegisterMCSubtargetInfo(TheThumbTarget, if (TheTriple.isOSDarwin())
ARM_MC::createARMMCSubtargetInfo); return new ARMMCAsmInfoDarwin();
return new ARMELFMCAsmInfo();
}
extern "C" void LLVMInitializeARMMCAsmInfo() {
// Register the target asm info.
RegisterMCAsmInfoFn A(TheARMTarget, createMCAsmInfo);
RegisterMCAsmInfoFn B(TheThumbTarget, createMCAsmInfo);
} }

View File

@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "Alpha.h" #include "Alpha.h"
#include "AlphaMCAsmInfo.h"
#include "AlphaTargetMachine.h" #include "AlphaTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"
@@ -21,7 +20,6 @@ using namespace llvm;
extern "C" void LLVMInitializeAlphaTarget() { extern "C" void LLVMInitializeAlphaTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget); RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
} }
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT, AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AlphaMCTargetDesc.h" #include "AlphaMCTargetDesc.h"
#include "AlphaMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -29,7 +30,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createAlphaMCInstrInfo() { static MCInstrInfo *createAlphaMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitAlphaMCInstrInfo(X); InitAlphaMCInstrInfo(X);
return X; return X;
@@ -39,8 +40,7 @@ extern "C" void LLVMInitializeAlphaMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheAlphaTarget, createAlphaMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheAlphaTarget, createAlphaMCInstrInfo);
} }
static MCSubtargetInfo *createAlphaMCSubtargetInfo(StringRef TT, StringRef CPU,
MCSubtargetInfo *createAlphaMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitAlphaMCSubtargetInfo(X, TT, CPU, FS); InitAlphaMCSubtargetInfo(X, TT, CPU, FS);
@@ -51,3 +51,7 @@ extern "C" void LLVMInitializeAlphaMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheAlphaTarget, TargetRegistry::RegisterMCSubtargetInfo(TheAlphaTarget,
createAlphaMCSubtargetInfo); createAlphaMCSubtargetInfo);
} }
extern "C" void LLVMInitializeAlphaMCAsmInfo() {
RegisterMCAsmInfo<AlphaMCAsmInfo> X(TheAlphaTarget);
}

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMAlphaDesc AlphaMCTargetDesc.cpp) add_llvm_library(LLVMAlphaDesc
AlphaMCTargetDesc.cpp
AlphaMCAsmInfo.cpp
)

View File

@@ -12,7 +12,6 @@
#include "BlackfinTargetMachine.h" #include "BlackfinTargetMachine.h"
#include "Blackfin.h" #include "Blackfin.h"
#include "BlackfinMCAsmInfo.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
@@ -20,8 +19,6 @@ using namespace llvm;
extern "C" void LLVMInitializeBlackfinTarget() { extern "C" void LLVMInitializeBlackfinTarget() {
RegisterTargetMachine<BlackfinTargetMachine> X(TheBlackfinTarget); RegisterTargetMachine<BlackfinTargetMachine> X(TheBlackfinTarget);
RegisterAsmInfo<BlackfinMCAsmInfo> Y(TheBlackfinTarget);
} }
BlackfinTargetMachine::BlackfinTargetMachine(const Target &T, BlackfinTargetMachine::BlackfinTargetMachine(const Target &T,

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "BlackfinMCTargetDesc.h" #include "BlackfinMCTargetDesc.h"
#include "BlackfinMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -29,7 +30,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createBlackfinMCInstrInfo() { static MCInstrInfo *createBlackfinMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitBlackfinMCInstrInfo(X); InitBlackfinMCInstrInfo(X);
return X; return X;
@@ -41,7 +42,8 @@ extern "C" void LLVMInitializeBlackfinMCInstrInfo() {
} }
MCSubtargetInfo *createBlackfinMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createBlackfinMCSubtargetInfo(StringRef TT,
StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitBlackfinMCSubtargetInfo(X, TT, CPU, FS); InitBlackfinMCSubtargetInfo(X, TT, CPU, FS);
@@ -52,3 +54,7 @@ extern "C" void LLVMInitializeBlackfinMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheBlackfinTarget, TargetRegistry::RegisterMCSubtargetInfo(TheBlackfinTarget,
createBlackfinMCSubtargetInfo); createBlackfinMCSubtargetInfo);
} }
extern "C" void LLVMInitializeBlackfinMCAsmInfo() {
RegisterMCAsmInfo<BlackfinMCAsmInfo> X(TheBlackfinTarget);
}

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMBlackfinDesc BlackfinMCTargetDesc.cpp) add_llvm_library(LLVMBlackfinDesc
BlackfinMCTargetDesc.cpp
BlackfinMCAsmInfo.cpp
)

View File

@@ -62,13 +62,11 @@ extern "C" void LLVMInitializeCBackendTarget() {
RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget); RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget);
} }
extern "C" void LLVMInitializeCBackendMCInstrInfo() { extern "C" void LLVMInitializeCBackendMCAsmInfo() {}
RegisterMCInstrInfo<MCInstrInfo> X(TheCBackendTarget);
}
extern "C" void LLVMInitializeCBackendMCSubtargetInfo() { extern "C" void LLVMInitializeCBackendMCInstrInfo() {}
RegisterMCSubtargetInfo<MCSubtargetInfo> X(TheCBackendTarget);
} extern "C" void LLVMInitializeCBackendMCSubtargetInfo() {}
namespace { namespace {
class CBEMCAsmInfo : public MCAsmInfo { class CBEMCAsmInfo : public MCAsmInfo {
@@ -1664,7 +1662,7 @@ bool CWriter::doInitialization(Module &M) {
std::string E; std::string E;
if (const Target *Match = TargetRegistry::lookupTarget(Triple, E)) if (const Target *Match = TargetRegistry::lookupTarget(Triple, E))
TAsm = Match->createAsmInfo(Triple); TAsm = Match->createMCAsmInfo(Triple);
#endif #endif
TAsm = new CBEMCAsmInfo(); TAsm = new CBEMCAsmInfo();
TCtx = new MCContext(*TAsm, NULL); TCtx = new MCContext(*TAsm, NULL);
@@ -3167,7 +3165,7 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) {
std::string E; std::string E;
if (const Target *Match = TargetRegistry::lookupTarget(Triple, E)) if (const Target *Match = TargetRegistry::lookupTarget(Triple, E))
TargetAsm = Match->createAsmInfo(Triple); TargetAsm = Match->createMCAsmInfo(Triple);
else else
return c.Codes[0]; return c.Codes[0];

View File

@@ -15,7 +15,6 @@ add_llvm_target(CellSPUCodeGen
SPUISelDAGToDAG.cpp SPUISelDAGToDAG.cpp
SPUISelLowering.cpp SPUISelLowering.cpp
SPUFrameLowering.cpp SPUFrameLowering.cpp
SPUMCAsmInfo.cpp
SPURegisterInfo.cpp SPURegisterInfo.cpp
SPUSubtarget.cpp SPUSubtarget.cpp
SPUTargetMachine.cpp SPUTargetMachine.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMCellSPUDesc SPUMCTargetDesc.cpp) add_llvm_library(LLVMCellSPUDesc
SPUMCTargetDesc.cpp
SPUMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "SPUMCTargetDesc.h" #include "SPUMCTargetDesc.h"
#include "SPUMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createSPUMCInstrInfo() { static MCInstrInfo *createSPUMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitSPUMCInstrInfo(X); InitSPUMCInstrInfo(X);
return X; return X;
@@ -38,7 +39,7 @@ extern "C" void LLVMInitializeCellSPUMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheCellSPUTarget, createSPUMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheCellSPUTarget, createSPUMCInstrInfo);
} }
MCSubtargetInfo *createSPUMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createSPUMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitSPUMCSubtargetInfo(X, TT, CPU, FS); InitSPUMCSubtargetInfo(X, TT, CPU, FS);
@@ -49,3 +50,7 @@ extern "C" void LLVMInitializeCellSPUMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheCellSPUTarget, TargetRegistry::RegisterMCSubtargetInfo(TheCellSPUTarget,
createSPUMCSubtargetInfo); createSPUMCSubtargetInfo);
} }
extern "C" void LLVMInitializeCellSPUMCAsmInfo() {
RegisterMCAsmInfo<SPULinuxMCAsmInfo> X(TheCellSPUTarget);
}

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "SPU.h" #include "SPU.h"
#include "SPUMCAsmInfo.h"
#include "SPUTargetMachine.h" #include "SPUTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/RegAllocRegistry.h"
@@ -24,7 +23,6 @@ using namespace llvm;
extern "C" void LLVMInitializeCellSPUTarget() { extern "C" void LLVMInitializeCellSPUTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget); RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
RegisterAsmInfo<SPULinuxMCAsmInfo> Y(TheCellSPUTarget);
} }
const std::pair<unsigned, int> * const std::pair<unsigned, int> *

View File

@@ -22,6 +22,7 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@@ -76,6 +77,8 @@ extern "C" void LLVMInitializeCppBackendTarget() {
RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget); RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget);
} }
extern "C" void LLVMInitializeCppBackendMCAsmInfo() {}
extern "C" void LLVMInitializeCppBackendMCInstrInfo() { extern "C" void LLVMInitializeCppBackendMCInstrInfo() {
RegisterMCInstrInfo<MCInstrInfo> X(TheCppBackendTarget); RegisterMCInstrInfo<MCInstrInfo> X(TheCppBackendTarget);
} }

View File

@@ -17,7 +17,6 @@ add_llvm_target(MBlazeCodeGen
MBlazeISelDAGToDAG.cpp MBlazeISelDAGToDAG.cpp
MBlazeISelLowering.cpp MBlazeISelLowering.cpp
MBlazeFrameLowering.cpp MBlazeFrameLowering.cpp
MBlazeMCAsmInfo.cpp
MBlazeRegisterInfo.cpp MBlazeRegisterInfo.cpp
MBlazeSubtarget.cpp MBlazeSubtarget.cpp
MBlazeTargetMachine.cpp MBlazeTargetMachine.cpp

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MBlaze.h" #include "MBlaze.h"
#include "MBlazeMCAsmInfo.h"
#include "MBlazeTargetMachine.h" #include "MBlazeTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/Passes.h"
@@ -21,14 +20,6 @@
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
using namespace llvm; using namespace llvm;
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
default:
return new MBlazeMCAsmInfo();
}
}
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
MCContext &Ctx, TargetAsmBackend &TAB, MCContext &Ctx, TargetAsmBackend &TAB,
raw_ostream &_OS, raw_ostream &_OS,
@@ -55,9 +46,6 @@ extern "C" void LLVMInitializeMBlazeTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<MBlazeTargetMachine> X(TheMBlazeTarget); RegisterTargetMachine<MBlazeTargetMachine> X(TheMBlazeTarget);
// Register the target asm info.
RegisterAsmInfoFn A(TheMBlazeTarget, createMCAsmInfo);
// Register the MC code emitter // Register the MC code emitter
TargetRegistry::RegisterCodeEmitter(TheMBlazeTarget, TargetRegistry::RegisterCodeEmitter(TheMBlazeTarget,
llvm::createMBlazeMCCodeEmitter); llvm::createMBlazeMCCodeEmitter);

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMMBlazeDesc MBlazeMCTargetDesc.cpp) add_llvm_library(LLVMMBlazeDesc
MBlazeMCTargetDesc.cpp
MBlazeMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MBlazeMCTargetDesc.h" #include "MBlazeMCTargetDesc.h"
#include "MBlazeMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -29,7 +30,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createMBlazeMCInstrInfo() { static MCInstrInfo *createMBlazeMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitMBlazeMCInstrInfo(X); InitMBlazeMCInstrInfo(X);
return X; return X;
@@ -39,7 +40,7 @@ extern "C" void LLVMInitializeMBlazeMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheMBlazeTarget, createMBlazeMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheMBlazeTarget, createMBlazeMCInstrInfo);
} }
MCSubtargetInfo *createMBlazeMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createMBlazeMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitMBlazeMCSubtargetInfo(X, TT, CPU, FS); InitMBlazeMCSubtargetInfo(X, TT, CPU, FS);
@@ -50,3 +51,15 @@ extern "C" void LLVMInitializeMBlazeMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget, TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget,
createMBlazeMCSubtargetInfo); createMBlazeMCSubtargetInfo);
} }
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
default:
return new MBlazeMCAsmInfo();
}
}
extern "C" void LLVMInitializeMBlazeMCAsmInfo() {
RegisterMCAsmInfoFn X(TheMBlazeTarget, createMCAsmInfo);
}

View File

@@ -13,7 +13,6 @@ add_llvm_target(MSP430CodeGen
MSP430ISelLowering.cpp MSP430ISelLowering.cpp
MSP430InstrInfo.cpp MSP430InstrInfo.cpp
MSP430FrameLowering.cpp MSP430FrameLowering.cpp
MSP430MCAsmInfo.cpp
MSP430RegisterInfo.cpp MSP430RegisterInfo.cpp
MSP430Subtarget.cpp MSP430Subtarget.cpp
MSP430TargetMachine.cpp MSP430TargetMachine.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMMSP430Desc MSP430MCTargetDesc.cpp) add_llvm_library(LLVMMSP430Desc
MSP430MCTargetDesc.cpp
MSP430MCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MSP430MCTargetDesc.h" #include "MSP430MCTargetDesc.h"
#include "MSP430MCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -29,7 +30,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createMSP430MCInstrInfo() { static MCInstrInfo *createMSP430MCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitMSP430MCInstrInfo(X); InitMSP430MCInstrInfo(X);
return X; return X;
@@ -40,7 +41,7 @@ extern "C" void LLVMInitializeMSP430MCInstrInfo() {
} }
MCSubtargetInfo *createMSP430MCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createMSP430MCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitMSP430MCSubtargetInfo(X, TT, CPU, FS); InitMSP430MCSubtargetInfo(X, TT, CPU, FS);
@@ -51,3 +52,7 @@ extern "C" void LLVMInitializeMSP430MCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target, TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target,
createMSP430MCSubtargetInfo); createMSP430MCSubtargetInfo);
} }
extern "C" void LLVMInitializeMSP430MCAsmInfo() {
RegisterMCAsmInfo<MSP430MCAsmInfo> X(TheMSP430Target);
}

View File

@@ -15,7 +15,6 @@
#define DEBUG_TYPE "asm-printer" #define DEBUG_TYPE "asm-printer"
#include "MSP430.h" #include "MSP430.h"
#include "MSP430InstrInfo.h" #include "MSP430InstrInfo.h"
#include "MSP430MCAsmInfo.h"
#include "MSP430MCInstLower.h" #include "MSP430MCInstLower.h"
#include "MSP430TargetMachine.h" #include "MSP430TargetMachine.h"
#include "InstPrinter/MSP430InstPrinter.h" #include "InstPrinter/MSP430InstPrinter.h"
@@ -28,6 +27,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstr.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MSP430.h" #include "MSP430.h"
#include "MSP430MCAsmInfo.h"
#include "MSP430TargetMachine.h" #include "MSP430TargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/Passes.h"
@@ -23,7 +22,6 @@ using namespace llvm;
extern "C" void LLVMInitializeMSP430Target() { extern "C" void LLVMInitializeMSP430Target() {
// Register the target. // Register the target.
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target); RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
RegisterAsmInfo<MSP430MCAsmInfo> Z(TheMSP430Target);
} }
MSP430TargetMachine::MSP430TargetMachine(const Target &T, MSP430TargetMachine::MSP430TargetMachine(const Target &T,

View File

@@ -16,7 +16,6 @@ add_llvm_target(MipsCodeGen
MipsISelDAGToDAG.cpp MipsISelDAGToDAG.cpp
MipsISelLowering.cpp MipsISelLowering.cpp
MipsFrameLowering.cpp MipsFrameLowering.cpp
MipsMCAsmInfo.cpp
MipsMCInstLower.cpp MipsMCInstLower.cpp
MipsMCSymbolRefExpr.cpp MipsMCSymbolRefExpr.cpp
MipsRegisterInfo.cpp MipsRegisterInfo.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMMipsDesc MipsMCTargetDesc.cpp) add_llvm_library(LLVMMipsDesc
MipsMCTargetDesc.cpp
MipsMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MipsMCTargetDesc.h" #include "MipsMCTargetDesc.h"
#include "MipsMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createMipsMCInstrInfo() { static MCInstrInfo *createMipsMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitMipsMCInstrInfo(X); InitMipsMCInstrInfo(X);
return X; return X;
@@ -39,7 +40,7 @@ extern "C" void LLVMInitializeMipsMCInstrInfo() {
} }
MCSubtargetInfo *createMipsMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createMipsMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitMipsMCSubtargetInfo(X, TT, CPU, FS); InitMipsMCSubtargetInfo(X, TT, CPU, FS);
@@ -50,3 +51,8 @@ extern "C" void LLVMInitializeMipsMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget, TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget,
createMipsMCSubtargetInfo); createMipsMCSubtargetInfo);
} }
extern "C" void LLVMInitializeMipsMCAsmInfo() {
RegisterMCAsmInfo<MipsMCAsmInfo> X(TheMipsTarget);
RegisterMCAsmInfo<MipsMCAsmInfo> Y(TheMipselTarget);
}

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "Mips.h" #include "Mips.h"
#include "MipsMCAsmInfo.h"
#include "MipsTargetMachine.h" #include "MipsTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
@@ -22,8 +21,6 @@ extern "C" void LLVMInitializeMipsTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget); RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget); RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
RegisterAsmInfo<MipsMCAsmInfo> A(TheMipsTarget);
RegisterAsmInfo<MipsMCAsmInfo> B(TheMipselTarget);
} }
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment

View File

@@ -13,7 +13,6 @@ add_llvm_target(PTXCodeGen
PTXISelLowering.cpp PTXISelLowering.cpp
PTXInstrInfo.cpp PTXInstrInfo.cpp
PTXFrameLowering.cpp PTXFrameLowering.cpp
PTXMCAsmInfo.cpp
PTXMCAsmStreamer.cpp PTXMCAsmStreamer.cpp
PTXMFInfoExtract.cpp PTXMFInfoExtract.cpp
PTXRegisterInfo.cpp PTXRegisterInfo.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMPTXDesc PTXMCTargetDesc.cpp) add_llvm_library(LLVMPTXDesc
PTXMCTargetDesc.cpp
PTXMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PTXMCTargetDesc.h" #include "PTXMCTargetDesc.h"
#include "PTXMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createPTXMCInstrInfo() { static MCInstrInfo *createPTXMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitPTXMCInstrInfo(X); InitPTXMCInstrInfo(X);
return X; return X;
@@ -39,7 +40,7 @@ extern "C" void LLVMInitializePTXMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(ThePTX64Target, createPTXMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(ThePTX64Target, createPTXMCInstrInfo);
} }
MCSubtargetInfo *createPTXMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createPTXMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitPTXMCSubtargetInfo(X, TT, CPU, FS); InitPTXMCSubtargetInfo(X, TT, CPU, FS);
@@ -52,3 +53,8 @@ extern "C" void LLVMInitializePTXMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(ThePTX64Target, TargetRegistry::RegisterMCSubtargetInfo(ThePTX64Target,
createPTXMCSubtargetInfo); createPTXMCSubtargetInfo);
} }
extern "C" void LLVMInitializePTXMCAsmInfo() {
RegisterMCAsmInfo<PTXMCAsmInfo> X(ThePTX32Target);
RegisterMCAsmInfo<PTXMCAsmInfo> Y(ThePTX64Target);
}

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PTX.h" #include "PTX.h"
#include "PTXMCAsmInfo.h"
#include "PTXTargetMachine.h" #include "PTXTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
@@ -35,9 +34,6 @@ extern "C" void LLVMInitializePTXTarget() {
RegisterTargetMachine<PTX32TargetMachine> X(ThePTX32Target); RegisterTargetMachine<PTX32TargetMachine> X(ThePTX32Target);
RegisterTargetMachine<PTX64TargetMachine> Y(ThePTX64Target); RegisterTargetMachine<PTX64TargetMachine> Y(ThePTX64Target);
RegisterAsmInfo<PTXMCAsmInfo> Z(ThePTX32Target);
RegisterAsmInfo<PTXMCAsmInfo> W(ThePTX64Target);
TargetRegistry::RegisterAsmStreamer(ThePTX32Target, createPTXAsmStreamer); TargetRegistry::RegisterAsmStreamer(ThePTX32Target, createPTXAsmStreamer);
TargetRegistry::RegisterAsmStreamer(ThePTX64Target, createPTXAsmStreamer); TargetRegistry::RegisterAsmStreamer(ThePTX64Target, createPTXAsmStreamer);
} }

View File

@@ -20,7 +20,6 @@ add_llvm_target(PowerPCCodeGen
PPCISelLowering.cpp PPCISelLowering.cpp
PPCFrameLowering.cpp PPCFrameLowering.cpp
PPCJITInfo.cpp PPCJITInfo.cpp
PPCMCAsmInfo.cpp
PPCMCCodeEmitter.cpp PPCMCCodeEmitter.cpp
PPCMCInstLower.cpp PPCMCInstLower.cpp
PPCPredicates.cpp PPCPredicates.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMPowerPCDesc PPCMCTargetDesc.cpp) add_llvm_library(LLVMPowerPCDesc
PPCMCTargetDesc.cpp
PPCMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PPCMCTargetDesc.h" #include "PPCMCTargetDesc.h"
#include "PPCMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createPPCMCInstrInfo() { static MCInstrInfo *createPPCMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitPPCMCInstrInfo(X); InitPPCMCInstrInfo(X);
return X; return X;
@@ -40,7 +41,7 @@ extern "C" void LLVMInitializePowerPCMCInstrInfo() {
} }
MCSubtargetInfo *createPPCMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createPPCMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitPPCMCSubtargetInfo(X, TT, CPU, FS); InitPPCMCSubtargetInfo(X, TT, CPU, FS);
@@ -53,3 +54,17 @@ extern "C" void LLVMInitializePowerPCMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(ThePPC64Target, TargetRegistry::RegisterMCSubtargetInfo(ThePPC64Target,
createPPCMCSubtargetInfo); createPPCMCSubtargetInfo);
} }
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
if (TheTriple.isOSDarwin())
return new PPCMCAsmInfoDarwin(isPPC64);
return new PPCLinuxMCAsmInfo(isPPC64);
}
extern "C" void LLVMInitializePowerPCMCAsmInfo() {
RegisterMCAsmInfoFn C(ThePPC32Target, createMCAsmInfo);
RegisterMCAsmInfoFn D(ThePPC64Target, createMCAsmInfo);
}

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PPC.h" #include "PPC.h"
#include "PPCMCAsmInfo.h"
#include "PPCTargetMachine.h" #include "PPCTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
@@ -21,15 +20,6 @@
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"
using namespace llvm; using namespace llvm;
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
if (TheTriple.isOSDarwin())
return new PPCMCAsmInfoDarwin(isPPC64);
return new PPCLinuxMCAsmInfo(isPPC64);
}
// This is duplicated code. Refactor this. // This is duplicated code. Refactor this.
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
MCContext &Ctx, TargetAsmBackend &TAB, MCContext &Ctx, TargetAsmBackend &TAB,
@@ -48,9 +38,6 @@ extern "C" void LLVMInitializePowerPCTarget() {
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target); RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target); RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
RegisterAsmInfoFn C(ThePPC32Target, createMCAsmInfo);
RegisterAsmInfoFn D(ThePPC64Target, createMCAsmInfo);
// Register the MC Code Emitter // Register the MC Code Emitter
TargetRegistry::RegisterCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter); TargetRegistry::RegisterCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter); TargetRegistry::RegisterCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter);

View File

@@ -15,7 +15,6 @@ add_llvm_target(SparcCodeGen
SparcISelDAGToDAG.cpp SparcISelDAGToDAG.cpp
SparcISelLowering.cpp SparcISelLowering.cpp
SparcFrameLowering.cpp SparcFrameLowering.cpp
SparcMCAsmInfo.cpp
SparcRegisterInfo.cpp SparcRegisterInfo.cpp
SparcSubtarget.cpp SparcSubtarget.cpp
SparcTargetMachine.cpp SparcTargetMachine.cpp

View File

@@ -1 +1,4 @@
add_llvm_library(LLVMSparcDesc SparcMCTargetDesc.cpp) add_llvm_library(LLVMSparcDesc
SparcMCTargetDesc.cpp
SparcMCAsmInfo.cpp
)

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "SparcMCTargetDesc.h" #include "SparcMCTargetDesc.h"
#include "SparcMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createSparcMCInstrInfo() { static MCInstrInfo *createSparcMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitSparcMCInstrInfo(X); InitSparcMCInstrInfo(X);
return X; return X;
@@ -38,7 +39,7 @@ extern "C" void LLVMInitializeSparcMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheSparcTarget, createSparcMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheSparcTarget, createSparcMCInstrInfo);
} }
MCSubtargetInfo *createSparcMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createSparcMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitSparcMCSubtargetInfo(X, TT, CPU, FS); InitSparcMCSubtargetInfo(X, TT, CPU, FS);
@@ -49,3 +50,8 @@ extern "C" void LLVMInitializeSparcMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheSparcTarget, TargetRegistry::RegisterMCSubtargetInfo(TheSparcTarget,
createSparcMCSubtargetInfo); createSparcMCSubtargetInfo);
} }
extern "C" void LLVMInitializeSparcMCAsmInfo() {
RegisterMCAsmInfo<SparcELFMCAsmInfo> X(TheSparcTarget);
RegisterMCAsmInfo<SparcELFMCAsmInfo> Y(TheSparcV9Target);
}

View File

@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "Sparc.h" #include "Sparc.h"
#include "SparcMCAsmInfo.h"
#include "SparcTargetMachine.h" #include "SparcTargetMachine.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
@@ -21,10 +20,6 @@ extern "C" void LLVMInitializeSparcTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget); RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget);
RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target); RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target);
RegisterAsmInfo<SparcELFMCAsmInfo> A(TheSparcTarget);
RegisterAsmInfo<SparcELFMCAsmInfo> B(TheSparcV9Target);
} }
/// SparcTargetMachine ctor - Create an ILP32 architecture model /// SparcTargetMachine ctor - Create an ILP32 architecture model

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "SystemZMCTargetDesc.h" #include "SystemZMCTargetDesc.h"
#include "SystemZMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createSystemZMCInstrInfo() { static MCInstrInfo *createSystemZMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitSystemZMCInstrInfo(X); InitSystemZMCInstrInfo(X);
return X; return X;
@@ -39,7 +40,8 @@ extern "C" void LLVMInitializeSystemZMCInstrInfo() {
createSystemZMCInstrInfo); createSystemZMCInstrInfo);
} }
MCSubtargetInfo *createSystemZMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createSystemZMCSubtargetInfo(StringRef TT,
StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitSystemZMCSubtargetInfo(X, TT, CPU, FS); InitSystemZMCSubtargetInfo(X, TT, CPU, FS);
@@ -50,3 +52,7 @@ extern "C" void LLVMInitializeSystemZMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheSystemZTarget, TargetRegistry::RegisterMCSubtargetInfo(TheSystemZTarget,
createSystemZMCSubtargetInfo); createSystemZMCSubtargetInfo);
} }
extern "C" void LLVMInitializeSystemZMCAsmInfo() {
RegisterMCAsmInfo<SystemZMCAsmInfo> X(TheSystemZTarget);
}

View File

@@ -7,7 +7,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "SystemZMCAsmInfo.h"
#include "SystemZTargetMachine.h" #include "SystemZTargetMachine.h"
#include "SystemZ.h" #include "SystemZ.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
@@ -17,7 +16,6 @@ using namespace llvm;
extern "C" void LLVMInitializeSystemZTarget() { extern "C" void LLVMInitializeSystemZTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget); RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
RegisterAsmInfo<SystemZMCAsmInfo> Y(TheSystemZTarget);
} }
/// SystemZTargetMachine ctor - Create an ILP64 architecture model /// SystemZTargetMachine ctor - Create an ILP64 architecture model

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "X86MCTargetDesc.h" #include "X86MCTargetDesc.h"
#include "X86MCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -130,33 +131,55 @@ MCSubtargetInfo *X86_MC::createX86MCSubtargetInfo(StringRef TT, StringRef CPU,
return X; return X;
} }
MCInstrInfo *createX86MCInstrInfo() { // Force static initialization.
extern "C" void LLVMInitializeX86MCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheX86_32Target,
X86_MC::createX86MCSubtargetInfo);
TargetRegistry::RegisterMCSubtargetInfo(TheX86_64Target,
X86_MC::createX86MCSubtargetInfo);
}
static MCInstrInfo *createX86MCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitX86MCInstrInfo(X); InitX86MCInstrInfo(X);
return X; return X;
} }
MCRegisterInfo *createX86MCRegisterInfo() {
MCRegisterInfo *X = new MCRegisterInfo();
InitX86MCRegisterInfo(X);
return X;
}
// Force static initialization.
extern "C" void LLVMInitializeX86MCInstrInfo() { extern "C" void LLVMInitializeX86MCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheX86_32Target, createX86MCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheX86_32Target, createX86MCInstrInfo);
TargetRegistry::RegisterMCInstrInfo(TheX86_64Target, createX86MCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheX86_64Target, createX86MCInstrInfo);
} }
static MCRegisterInfo *createX86MCRegisterInfo() {
MCRegisterInfo *X = new MCRegisterInfo();
InitX86MCRegisterInfo(X);
return X;
}
extern "C" void LLVMInitializeX86MCRegInfo() { extern "C" void LLVMInitializeX86MCRegInfo() {
TargetRegistry::RegisterMCRegInfo(TheX86_32Target, createX86MCRegisterInfo); TargetRegistry::RegisterMCRegInfo(TheX86_32Target, createX86MCRegisterInfo);
TargetRegistry::RegisterMCRegInfo(TheX86_64Target, createX86MCRegisterInfo); TargetRegistry::RegisterMCRegInfo(TheX86_64Target, createX86MCRegisterInfo);
} }
extern "C" void LLVMInitializeX86MCSubtargetInfo() { static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
TargetRegistry::RegisterMCSubtargetInfo(TheX86_32Target, Triple TheTriple(TT);
X86_MC::createX86MCSubtargetInfo);
TargetRegistry::RegisterMCSubtargetInfo(TheX86_64Target, if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) {
X86_MC::createX86MCSubtargetInfo); if (TheTriple.getArch() == Triple::x86_64)
return new X86_64MCAsmInfoDarwin(TheTriple);
else
return new X86MCAsmInfoDarwin(TheTriple);
}
if (TheTriple.isOSWindows())
return new X86MCAsmInfoCOFF(TheTriple);
return new X86ELFMCAsmInfo(TheTriple);
}
extern "C" void LLVMInitializeX86MCAsmInfo() {
// Register the target asm info.
RegisterMCAsmInfoFn A(TheX86_32Target, createMCAsmInfo);
RegisterMCAsmInfoFn B(TheX86_64Target, createMCAsmInfo);
} }

View File

@@ -16,8 +16,8 @@
#include "X86MCInstLower.h" #include "X86MCInstLower.h"
#include "X86AsmPrinter.h" #include "X86AsmPrinter.h"
#include "X86COFFMachineModuleInfo.h" #include "X86COFFMachineModuleInfo.h"
#include "X86MCAsmInfo.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"

View File

@@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "X86MCAsmInfo.h"
#include "X86TargetMachine.h" #include "X86TargetMachine.h"
#include "X86.h" #include "X86.h"
#include "llvm/PassManager.h" #include "llvm/PassManager.h"
@@ -24,22 +23,6 @@
#include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetRegistry.h"
using namespace llvm; using namespace llvm;
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) {
if (TheTriple.getArch() == Triple::x86_64)
return new X86_64MCAsmInfoDarwin(TheTriple);
else
return new X86MCAsmInfoDarwin(TheTriple);
}
if (TheTriple.isOSWindows())
return new X86MCAsmInfoCOFF(TheTriple);
return new X86ELFMCAsmInfo(TheTriple);
}
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
MCContext &Ctx, TargetAsmBackend &TAB, MCContext &Ctx, TargetAsmBackend &TAB,
raw_ostream &_OS, raw_ostream &_OS,
@@ -62,10 +45,6 @@ extern "C" void LLVMInitializeX86Target() {
RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target); RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target);
RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target); RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target);
// Register the target asm info.
RegisterAsmInfoFn A(TheX86_32Target, createMCAsmInfo);
RegisterAsmInfoFn B(TheX86_64Target, createMCAsmInfo);
// Register the code emitter. // Register the code emitter.
TargetRegistry::RegisterCodeEmitter(TheX86_32Target, TargetRegistry::RegisterCodeEmitter(TheX86_32Target,
createX86MCCodeEmitter); createX86MCCodeEmitter);

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "XCoreMCTargetDesc.h" #include "XCoreMCTargetDesc.h"
#include "XCoreMCAsmInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@@ -28,7 +29,7 @@
using namespace llvm; using namespace llvm;
MCInstrInfo *createXCoreMCInstrInfo() { static MCInstrInfo *createXCoreMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo(); MCInstrInfo *X = new MCInstrInfo();
InitXCoreMCInstrInfo(X); InitXCoreMCInstrInfo(X);
return X; return X;
@@ -38,7 +39,7 @@ extern "C" void LLVMInitializeXCoreMCInstrInfo() {
TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo); TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
} }
MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU, static MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU,
StringRef FS) { StringRef FS) {
MCSubtargetInfo *X = new MCSubtargetInfo(); MCSubtargetInfo *X = new MCSubtargetInfo();
InitXCoreMCSubtargetInfo(X, TT, CPU, FS); InitXCoreMCSubtargetInfo(X, TT, CPU, FS);
@@ -49,3 +50,7 @@ extern "C" void LLVMInitializeXCoreMCSubtargetInfo() {
TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget, TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
createXCoreMCSubtargetInfo); createXCoreMCSubtargetInfo);
} }
extern "C" void LLVMInitializeXCoreMCAsmInfo() {
RegisterMCAsmInfo<XCoreMCAsmInfo> X(TheXCoreTarget);
}

View File

@@ -16,7 +16,6 @@
#include "XCore.h" #include "XCore.h"
#include "XCoreInstrInfo.h" #include "XCoreInstrInfo.h"
#include "XCoreSubtarget.h" #include "XCoreSubtarget.h"
#include "XCoreMCAsmInfo.h"
#include "XCoreTargetMachine.h" #include "XCoreTargetMachine.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
@@ -27,6 +26,7 @@
#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h" #include "llvm/Target/Mangler.h"

View File

@@ -10,7 +10,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "XCoreMCAsmInfo.h"
#include "XCoreTargetMachine.h" #include "XCoreTargetMachine.h"
#include "XCore.h" #include "XCore.h"
#include "llvm/Module.h" #include "llvm/Module.h"
@@ -42,5 +41,4 @@ bool XCoreTargetMachine::addInstSelector(PassManagerBase &PM,
// Force static initialization. // Force static initialization.
extern "C" void LLVMInitializeXCoreTarget() { extern "C" void LLVMInitializeXCoreTarget() {
RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget); RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
RegisterAsmInfo<XCoreMCAsmInfo> Y(TheXCoreTarget);
} }

View File

@@ -201,6 +201,7 @@ int main(int argc, char **argv) {
// Initialize targets first, so that --version shows registered targets. // Initialize targets first, so that --version shows registered targets.
InitializeAllTargets(); InitializeAllTargets();
InitializeAllMCAsmInfos();
InitializeAllMCInstrInfos(); InitializeAllMCInstrInfos();
InitializeAllMCSubtargetInfos(); InitializeAllMCSubtargetInfos();
InitializeAllAsmPrinters(); InitializeAllAsmPrinters();

View File

@@ -132,7 +132,7 @@ int Disassembler::disassemble(const Target &T,
MemoryBuffer &Buffer, MemoryBuffer &Buffer,
raw_ostream &Out) { raw_ostream &Out) {
// Set up disassembler. // Set up disassembler.
OwningPtr<const MCAsmInfo> AsmInfo(T.createAsmInfo(Triple)); OwningPtr<const MCAsmInfo> AsmInfo(T.createMCAsmInfo(Triple));
if (!AsmInfo) { if (!AsmInfo) {
errs() << "error: no assembly info for target " << Triple << "\n"; errs() << "error: no assembly info for target " << Triple << "\n";

View File

@@ -196,7 +196,7 @@ static int AsLexInput(const char *ProgName) {
if (!TheTarget) if (!TheTarget)
return 1; return 1;
llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createAsmInfo(TripleName)); llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(TripleName));
assert(MAI && "Unable to create target asm info!"); assert(MAI && "Unable to create target asm info!");
AsmLexer Lexer(*MAI); AsmLexer Lexer(*MAI);
@@ -306,7 +306,7 @@ static int AssembleInput(const char *ProgName) {
SrcMgr.setIncludeDirs(IncludeDirs); SrcMgr.setIncludeDirs(IncludeDirs);
llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createAsmInfo(TripleName)); llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(TripleName));
assert(MAI && "Unable to create target asm info!"); assert(MAI && "Unable to create target asm info!");
// Package up features to be passed to target/subtarget // Package up features to be passed to target/subtarget
@@ -436,6 +436,7 @@ int main(int argc, char **argv) {
llvm::InitializeAllTargetInfos(); llvm::InitializeAllTargetInfos();
// FIXME: We shouldn't need to initialize the Target(Machine)s. // FIXME: We shouldn't need to initialize the Target(Machine)s.
llvm::InitializeAllTargets(); llvm::InitializeAllTargets();
llvm::InitializeAllMCAsmInfos();
llvm::InitializeAllMCInstrInfos(); llvm::InitializeAllMCInstrInfos();
llvm::InitializeAllMCSubtargetInfos(); llvm::InitializeAllMCSubtargetInfos();
llvm::InitializeAllAsmPrinters(); llvm::InitializeAllAsmPrinters();

View File

@@ -174,7 +174,7 @@ static void DisassembleInput(const StringRef &Filename) {
outs() << "Disassembly of section " << name << ":\n\n"; outs() << "Disassembly of section " << name << ":\n\n";
// Set up disassembler. // Set up disassembler.
OwningPtr<const MCAsmInfo> AsmInfo(TheTarget->createAsmInfo(TripleName)); OwningPtr<const MCAsmInfo> AsmInfo(TheTarget->createMCAsmInfo(TripleName));
if (!AsmInfo) { if (!AsmInfo) {
errs() << "error: no assembly info for target " << TripleName << "\n"; errs() << "error: no assembly info for target " << TripleName << "\n";
@@ -236,6 +236,7 @@ int main(int argc, char **argv) {
llvm::InitializeAllTargetInfos(); llvm::InitializeAllTargetInfos();
// FIXME: We shouldn't need to initialize the Target(Machine)s. // FIXME: We shouldn't need to initialize the Target(Machine)s.
llvm::InitializeAllTargets(); llvm::InitializeAllTargets();
llvm::InitializeAllMCAsmInfos();
llvm::InitializeAllAsmPrinters(); llvm::InitializeAllAsmPrinters();
llvm::InitializeAllAsmParsers(); llvm::InitializeAllAsmParsers();
llvm::InitializeAllDisassemblers(); llvm::InitializeAllDisassemblers();

View File

@@ -73,6 +73,7 @@ LTOCodeGenerator::LTOCodeGenerator()
_nativeObjectFile(NULL) _nativeObjectFile(NULL)
{ {
InitializeAllTargets(); InitializeAllTargets();
InitializeAllMCAsmInfos();
InitializeAllMCSubtargetInfos(); InitializeAllMCSubtargetInfos();
InitializeAllAsmPrinters(); InitializeAllAsmPrinters();
} }

View File

@@ -135,6 +135,7 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
static bool Initialized = false; static bool Initialized = false;
if (!Initialized) { if (!Initialized) {
InitializeAllTargets(); InitializeAllTargets();
InitializeAllMCAsmInfos();
InitializeAllMCSubtargetInfos(); InitializeAllMCSubtargetInfos();
InitializeAllAsmParsers(); InitializeAllAsmParsers();
Initialized = true; Initialized = true;