diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-08 01:53:10 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-08 01:53:10 +0000 |
commit | ebdeeab812beec0385b445f3d4c41a114e0d972f (patch) | |
tree | 20eaafc6f227ca94201b0b6ac02d94b06b608229 /lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | |
parent | 1fb0955cab05ff71f5bbad523b0374db3b08b201 (diff) |
Eliminate asm parser's dependency on TargetMachine:
- Each target asm parser now creates its own MCSubtatgetInfo (if needed).
- Changed AssemblerPredicate to take subtarget features which tablegen uses
to generate asm matcher subtarget feature queries. e.g.
"ModeThumb,FeatureThumb2" is translated to
"(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp')
-rw-r--r-- | lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 99 |
1 files changed, 45 insertions, 54 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp index 1db33b5e92..0a8e3b171d 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp @@ -23,65 +23,12 @@ #define GET_INSTRINFO_MC_DESC #include "ARMGenInstrInfo.inc" +#define GET_SUBTARGETINFO_ENUM #define GET_SUBTARGETINFO_MC_DESC #include "ARMGenSubtargetInfo.inc" using namespace llvm; -MCInstrInfo *createARMMCInstrInfo() { - MCInstrInfo *X = new MCInstrInfo(); - InitARMMCInstrInfo(X); - return X; -} - -MCRegisterInfo *createARMMCRegisterInfo() { - MCRegisterInfo *X = new MCRegisterInfo(); - InitARMMCRegisterInfo(X); - return X; -} - -MCSubtargetInfo *createARMMCSubtargetInfo(StringRef TT, StringRef CPU, - StringRef FS) { - std::string ArchFS = ARM_MC::ParseARMTriple(TT); - if (!FS.empty()) { - if (!ArchFS.empty()) - ArchFS = ArchFS + "," + FS.str(); - else - ArchFS = FS; - } - - MCSubtargetInfo *X = new MCSubtargetInfo(); - InitARMMCSubtargetInfo(X, CPU, ArchFS); - return X; -} - -// Force static initialization. -extern "C" void LLVMInitializeARMMCInstrInfo() { - RegisterMCInstrInfo<MCInstrInfo> X(TheARMTarget); - RegisterMCInstrInfo<MCInstrInfo> Y(TheThumbTarget); - - TargetRegistry::RegisterMCInstrInfo(TheARMTarget, createARMMCInstrInfo); - TargetRegistry::RegisterMCInstrInfo(TheThumbTarget, createARMMCInstrInfo); -} - -extern "C" void LLVMInitializeARMMCRegInfo() { - RegisterMCRegInfo<MCRegisterInfo> X(TheARMTarget); - RegisterMCRegInfo<MCRegisterInfo> Y(TheThumbTarget); - - TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo); - TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo); -} - -extern "C" void LLVMInitializeARMMCSubtargetInfo() { - RegisterMCSubtargetInfo<MCSubtargetInfo> X(TheARMTarget); - RegisterMCSubtargetInfo<MCSubtargetInfo> Y(TheThumbTarget); - - TargetRegistry::RegisterMCSubtargetInfo(TheARMTarget, - createARMMCSubtargetInfo); - TargetRegistry::RegisterMCSubtargetInfo(TheThumbTarget, - createARMMCSubtargetInfo); -} - std::string ARM_MC::ParseARMTriple(StringRef TT) { // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. @@ -135,3 +82,47 @@ std::string ARM_MC::ParseARMTriple(StringRef TT) { return ARMArchFeature; } + +MCSubtargetInfo *ARM_MC::createARMMCSubtargetInfo(StringRef TT, StringRef CPU, + StringRef FS) { + std::string ArchFS = ARM_MC::ParseARMTriple(TT); + if (!FS.empty()) { + if (!ArchFS.empty()) + ArchFS = ArchFS + "," + FS.str(); + else + ArchFS = FS; + } + + MCSubtargetInfo *X = new MCSubtargetInfo(); + InitARMMCSubtargetInfo(X, CPU, ArchFS); + return X; +} + +MCInstrInfo *createARMMCInstrInfo() { + MCInstrInfo *X = new MCInstrInfo(); + InitARMMCInstrInfo(X); + return X; +} + +MCRegisterInfo *createARMMCRegisterInfo() { + MCRegisterInfo *X = new MCRegisterInfo(); + InitARMMCRegisterInfo(X); + return X; +} + +// Force static initialization. +extern "C" void LLVMInitializeARMMCInstrInfo() { + RegisterMCInstrInfo<MCInstrInfo> X(TheARMTarget); + RegisterMCInstrInfo<MCInstrInfo> Y(TheThumbTarget); + + TargetRegistry::RegisterMCInstrInfo(TheARMTarget, createARMMCInstrInfo); + TargetRegistry::RegisterMCInstrInfo(TheThumbTarget, createARMMCInstrInfo); +} + +extern "C" void LLVMInitializeARMMCRegInfo() { + RegisterMCRegInfo<MCRegisterInfo> X(TheARMTarget); + RegisterMCRegInfo<MCRegisterInfo> Y(TheThumbTarget); + + TargetRegistry::RegisterMCRegInfo(TheARMTarget, createARMMCRegisterInfo); + TargetRegistry::RegisterMCRegInfo(TheThumbTarget, createARMMCRegisterInfo); +} |