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
diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp
index 6209fc4..fd8c7d1 100644
--- a/lib/Target/MSP430/MSP430AsmPrinter.cpp
+++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp
@@ -15,6 +15,7 @@
#define DEBUG_TYPE "asm-printer"
#include "MSP430.h"
#include "MSP430InstrInfo.h"
+#include "MSP430TargetAsmInfo.h"
#include "MSP430TargetMachine.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
@@ -25,7 +26,6 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
@@ -246,4 +246,5 @@
// Register the target.
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
RegisterAsmPrinter<MSP430AsmPrinter> Y(TheMSP430Target);
+ RegisterAsmInfo<MSP430TargetAsmInfo> Z(TheMSP430Target);
}
diff --git a/lib/Target/MSP430/MSP430TargetAsmInfo.cpp b/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
index 1aae9f2..56560d6 100644
--- a/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
+++ b/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
@@ -14,6 +14,6 @@
#include "MSP430TargetAsmInfo.h"
using namespace llvm;
-MSP430TargetAsmInfo::MSP430TargetAsmInfo() {
+MSP430TargetAsmInfo::MSP430TargetAsmInfo(const Target &T, const StringRef &TT) {
AlignmentIsInBytes = false;
}
diff --git a/lib/Target/MSP430/MSP430TargetAsmInfo.h b/lib/Target/MSP430/MSP430TargetAsmInfo.h
index 8b4580c..510e239 100644
--- a/lib/Target/MSP430/MSP430TargetAsmInfo.h
+++ b/lib/Target/MSP430/MSP430TargetAsmInfo.h
@@ -17,8 +17,10 @@
#include "llvm/Target/TargetAsmInfo.h"
namespace llvm {
+ class Target;
+ class StringRef;
struct MSP430TargetAsmInfo : public TargetAsmInfo {
- explicit MSP430TargetAsmInfo();
+ explicit MSP430TargetAsmInfo(const Target &T, const StringRef &TT);
};
} // namespace llvm
diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp
index f34e3db..56495e6 100644
--- a/lib/Target/MSP430/MSP430TargetMachine.cpp
+++ b/lib/Target/MSP430/MSP430TargetMachine.cpp
@@ -29,9 +29,6 @@
InstrInfo(*this), TLInfo(*this),
FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
-const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
- return new MSP430TargetAsmInfo();
-}
bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
CodeGenOpt::Level OptLevel) {
diff --git a/lib/Target/MSP430/MSP430TargetMachine.h b/lib/Target/MSP430/MSP430TargetMachine.h
index 44cdd54..d386140 100644
--- a/lib/Target/MSP430/MSP430TargetMachine.h
+++ b/lib/Target/MSP430/MSP430TargetMachine.h
@@ -37,9 +37,6 @@
// any MSP430 specific FrameInfo class.
TargetFrameInfo FrameInfo;
-protected:
- virtual const TargetAsmInfo *createTargetAsmInfo() const;
-
public:
MSP430TargetMachine(const Target &T, const std::string &TT,
const std::string &FS);