diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-14 20:59:42 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-14 20:59:42 +0000 |
commit | bc153d49b73d493b1fe28cfac108f2d69ba56cee (patch) | |
tree | 2030f499d7a156ff60ba13b39242853a5fb180bc /llvm/lib/Target/MBlaze | |
parent | 0c134b52b9e9b0eb21b3faee27bcab8fb4fa1220 (diff) | |
download | bcm5719-llvm-bc153d49b73d493b1fe28cfac108f2d69ba56cee.tar.gz bcm5719-llvm-bc153d49b73d493b1fe28cfac108f2d69ba56cee.zip |
Next round of MC refactoring. This patch factor MC table instantiations, MC
registeration and creation code into XXXMCDesc libraries.
llvm-svn: 135184
Diffstat (limited to 'llvm/lib/Target/MBlaze')
-rw-r--r-- | llvm/lib/Target/MBlaze/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MBlaze.h | 11 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeSubtarget.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MCTargetDesc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.cpp | 52 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h | 38 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/MCTargetDesc/Makefile | 16 | ||||
-rw-r--r-- | llvm/lib/Target/MBlaze/Makefile | 2 |
11 files changed, 114 insertions, 39 deletions
diff --git a/llvm/lib/Target/MBlaze/CMakeLists.txt b/llvm/lib/Target/MBlaze/CMakeLists.txt index 536726d8039..d9896805164 100644 --- a/llvm/lib/Target/MBlaze/CMakeLists.txt +++ b/llvm/lib/Target/MBlaze/CMakeLists.txt @@ -35,3 +35,4 @@ add_subdirectory(AsmParser) add_subdirectory(Disassembler) add_subdirectory(InstPrinter) add_subdirectory(TargetInfo) +add_subdirectory(MCTargetDesc) diff --git a/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp b/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp index 14642742e34..0157b4eb038 100644 --- a/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp +++ b/llvm/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp @@ -27,10 +27,12 @@ // #include "MBlazeGenDecoderTables.inc" // #include "MBlazeGenRegisterNames.inc" -#define GET_INSTRINFO_MC_DESC -#include "MBlazeGenInstrInfo.inc" #include "MBlazeGenEDInfo.inc" +namespace llvm { +extern const MCInstrDesc MBlazeInsts[]; +} + using namespace llvm; const unsigned UNSUPPORTED = -1; diff --git a/llvm/lib/Target/MBlaze/MBlaze.h b/llvm/lib/Target/MBlaze/MBlaze.h index 26b869b143b..3390794c937 100644 --- a/llvm/lib/Target/MBlaze/MBlaze.h +++ b/llvm/lib/Target/MBlaze/MBlaze.h @@ -15,6 +15,7 @@ #ifndef TARGET_MBLAZE_H #define TARGET_MBLAZE_H +#include "MCTargetDesc/MBlazeMCTargetDesc.h" #include "llvm/Target/TargetMachine.h" namespace llvm { @@ -36,16 +37,6 @@ namespace llvm { FunctionPass *createMBlazeISelDag(MBlazeTargetMachine &TM); FunctionPass *createMBlazeDelaySlotFillerPass(MBlazeTargetMachine &TM); - extern Target TheMBlazeTarget; } // end namespace llvm; -// Defines symbolic names for MBlaze registers. This defines a mapping from -// register name to register number. -#define GET_REGINFO_ENUM -#include "MBlazeGenRegisterInfo.inc" - -// Defines symbolic names for the MBlaze instructions. -#define GET_INSTRINFO_ENUM -#include "MBlazeGenInstrInfo.inc" - #endif diff --git a/llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp b/llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp index 8f7d956ccba..188f10a3972 100644 --- a/llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp +++ b/llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp @@ -23,7 +23,6 @@ #include "llvm/ADT/STLExtras.h" #define GET_INSTRINFO_CTOR -#define GET_INSTRINFO_MC_DESC #include "MBlazeGenInstrInfo.inc" using namespace llvm; @@ -295,13 +294,3 @@ unsigned MBlazeInstrInfo::getGlobalBaseReg(MachineFunction *MF) const { MBlazeFI->setGlobalBaseReg(GlobalBaseReg); return GlobalBaseReg; } - -MCInstrInfo *createMBlazeMCInstrInfo() { - MCInstrInfo *X = new MCInstrInfo(); - InitMBlazeMCInstrInfo(X); - return X; -} - -extern "C" void LLVMInitializeMBlazeMCInstrInfo() { - TargetRegistry::RegisterMCInstrInfo(TheMBlazeTarget, createMBlazeMCInstrInfo); -} diff --git a/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp b/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp index 441ece10541..f0b201a6617 100644 --- a/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp +++ b/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp @@ -37,7 +37,6 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/STLExtras.h" -#define GET_REGINFO_MC_DESC #define GET_REGINFO_TARGET_DESC #include "MBlazeGenRegisterInfo.inc" diff --git a/llvm/lib/Target/MBlaze/MBlazeSubtarget.cpp b/llvm/lib/Target/MBlaze/MBlazeSubtarget.cpp index 54be1be37b6..eda141daf2b 100644 --- a/llvm/lib/Target/MBlaze/MBlazeSubtarget.cpp +++ b/llvm/lib/Target/MBlaze/MBlazeSubtarget.cpp @@ -17,8 +17,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetRegistry.h" -#define GET_SUBTARGETINFO_ENUM -#define GET_SUBTARGETINFO_MC_DESC #define GET_SUBTARGETINFO_TARGET_DESC #define GET_SUBTARGETINFO_CTOR #include "MBlazeGenSubtargetInfo.inc" @@ -63,15 +61,3 @@ enablePostRAScheduler(CodeGenOpt::Level OptLevel, CriticalPathRCs.push_back(&MBlaze::GPRRegClass); return HasItin && OptLevel >= CodeGenOpt::Default; } - -MCSubtargetInfo *createMBlazeMCSubtargetInfo(StringRef TT, StringRef CPU, - StringRef FS) { - MCSubtargetInfo *X = new MCSubtargetInfo(); - InitMBlazeMCSubtargetInfo(X, TT, CPU, FS); - return X; -} - -extern "C" void LLVMInitializeMBlazeMCSubtargetInfo() { - TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget, - createMBlazeMCSubtargetInfo); -} diff --git a/llvm/lib/Target/MBlaze/MCTargetDesc/CMakeLists.txt b/llvm/lib/Target/MBlaze/MCTargetDesc/CMakeLists.txt new file mode 100644 index 00000000000..a0f2ec448aa --- /dev/null +++ b/llvm/lib/Target/MBlaze/MCTargetDesc/CMakeLists.txt @@ -0,0 +1 @@ +add_llvm_library(LLVMMBlazeDesc MBlazeMCTargetDesc.cpp) diff --git a/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.cpp b/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.cpp new file mode 100644 index 00000000000..50714e47521 --- /dev/null +++ b/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.cpp @@ -0,0 +1,52 @@ +//===-- MBlazeMCTargetDesc.cpp - MBlaze Target Descriptions -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides MBlaze specific target descriptions. +// +//===----------------------------------------------------------------------===// + +#include "MBlazeMCTargetDesc.h" +#include "llvm/MC/MCInstrInfo.h" +#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/Target/TargetRegistry.h" + +#define GET_INSTRINFO_MC_DESC +#include "MBlazeGenInstrInfo.inc" + +#define GET_SUBTARGETINFO_MC_DESC +#include "MBlazeGenSubtargetInfo.inc" + +#define GET_REGINFO_MC_DESC +#include "MBlazeGenRegisterInfo.inc" + +using namespace llvm; + + +MCInstrInfo *createMBlazeMCInstrInfo() { + MCInstrInfo *X = new MCInstrInfo(); + InitMBlazeMCInstrInfo(X); + return X; +} + +extern "C" void LLVMInitializeMBlazeMCInstrInfo() { + TargetRegistry::RegisterMCInstrInfo(TheMBlazeTarget, createMBlazeMCInstrInfo); +} + +MCSubtargetInfo *createMBlazeMCSubtargetInfo(StringRef TT, StringRef CPU, + StringRef FS) { + MCSubtargetInfo *X = new MCSubtargetInfo(); + InitMBlazeMCSubtargetInfo(X, TT, CPU, FS); + return X; +} + +extern "C" void LLVMInitializeMBlazeMCSubtargetInfo() { + TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget, + createMBlazeMCSubtargetInfo); +} diff --git a/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h b/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h new file mode 100644 index 00000000000..b14772ef060 --- /dev/null +++ b/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h @@ -0,0 +1,38 @@ +//===-- MBlazeMCTargetDesc.h - MBlaze Target Descriptions -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides MBlaze specific target descriptions. +// +//===----------------------------------------------------------------------===// + +#ifndef MBLAZEMCTARGETDESC_H +#define MBLAZEMCTARGETDESC_H + +namespace llvm { +class MCSubtargetInfo; +class Target; +class StringRef; + +extern Target TheMBlazeTarget; + +} // End llvm namespace + +// Defines symbolic names for MBlaze registers. This defines a mapping from +// register name to register number. +#define GET_REGINFO_ENUM +#include "MBlazeGenRegisterInfo.inc" + +// Defines symbolic names for the MBlaze instructions. +#define GET_INSTRINFO_ENUM +#include "MBlazeGenInstrInfo.inc" + +#define GET_SUBTARGETINFO_ENUM +#include "MBlazeGenSubtargetInfo.inc" + +#endif diff --git a/llvm/lib/Target/MBlaze/MCTargetDesc/Makefile b/llvm/lib/Target/MBlaze/MCTargetDesc/Makefile new file mode 100644 index 00000000000..71075ffbf47 --- /dev/null +++ b/llvm/lib/Target/MBlaze/MCTargetDesc/Makefile @@ -0,0 +1,16 @@ +##===- lib/Target/MBlaze/TargetDesc/Makefile ---------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../../.. +LIBRARYNAME = LLVMMBlazeDesc + +# Hack: we need to include 'main' target directory to grab private headers +CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. + +include $(LEVEL)/Makefile.common diff --git a/llvm/lib/Target/MBlaze/Makefile b/llvm/lib/Target/MBlaze/Makefile index 829122f7e6f..83c2a7d34da 100644 --- a/llvm/lib/Target/MBlaze/Makefile +++ b/llvm/lib/Target/MBlaze/Makefile @@ -18,7 +18,7 @@ BUILT_SOURCES = MBlazeGenRegisterInfo.inc MBlazeGenInstrInfo.inc \ MBlazeGenSubtargetInfo.inc MBlazeGenIntrinsics.inc \ MBlazeGenEDInfo.inc -DIRS = InstPrinter AsmParser Disassembler TargetInfo +DIRS = InstPrinter AsmParser Disassembler TargetInfo MCTargetDesc include $(LEVEL)/Makefile.common |