Change TargetAsmInfo to be constructed via TargetRegistry from a Target+Triple

pair instead of from a virtual method on TargetMachine.  This cuts the final
ties of TargetAsmInfo to TargetMachine, meaning that MC can now use 
TargetAsmInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-12 07:22:17 +00:00
parent 54d26fa799
commit a7ac47cee1
50 changed files with 210 additions and 168 deletions
+16 -10
View File
@@ -27,10 +27,26 @@ static cl::opt<bool> DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden,
static cl::opt<bool> DisableIfConversion("disable-arm-if-conversion",cl::Hidden,
cl::desc("Disable if-conversion pass"));
static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
const StringRef &TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
case Triple::Darwin:
return new ARMDarwinTargetAsmInfo();
default:
return new ARMELFTargetAsmInfo();
}
}
extern "C" void LLVMInitializeARMTarget() {
// Register the target.
RegisterTargetMachine<ARMTargetMachine> X(TheARMTarget);
RegisterTargetMachine<ThumbTargetMachine> Y(TheThumbTarget);
// Register the target asm info.
RegisterAsmInfoFn A(TheARMTarget, createTargetAsmInfo);
RegisterAsmInfoFn B(TheThumbTarget, createTargetAsmInfo);
}
/// TargetMachine ctor - Create an ARM architecture model.
@@ -73,16 +89,6 @@ ThumbTargetMachine::ThumbTargetMachine(const Target &T, const std::string &TT,
}
const TargetAsmInfo *ARMBaseTargetMachine::createTargetAsmInfo() const {
switch (Subtarget.TargetType) {
default: llvm_unreachable("Unknown ARM subtarget kind");
case ARMSubtarget::isDarwin:
return new ARMDarwinTargetAsmInfo();
case ARMSubtarget::isELF:
return new ARMELFTargetAsmInfo();
}
}
// Pass Pipeline Configuration
bool ARMBaseTargetMachine::addInstSelector(PassManagerBase &PM,