mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user