1. Remove condition on delete.
2. Protect and outline createTargetAsmInfo.
3. Misc. kruft.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30169 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp
index cbe0cdb..b752e4c 100644
--- a/lib/Target/Alpha/AlphaTargetMachine.cpp
+++ b/lib/Target/Alpha/AlphaTargetMachine.cpp
@@ -12,6 +12,7 @@
#include "Alpha.h"
#include "AlphaJITInfo.h"
+#include "AlphaTargetAsmInfo.h"
#include "AlphaTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
@@ -24,6 +25,10 @@
RegisterTarget<AlphaTargetMachine> X("alpha", " Alpha (incomplete)");
}
+const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
+ return new AlphaTargetAsmInfo(*this);
+}
+
unsigned AlphaTargetMachine::getModuleMatchQuality(const Module &M) {
// We strongly match "alpha*".
std::string TT = M.getTargetTriple();
@@ -53,8 +58,7 @@
: DataLayout("e"),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
JITInfo(*this),
- Subtarget(M, FS),
- AsmInfo(NULL) {
+ Subtarget(M, FS) {
}
diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h
index d47ca82..c00e71c 100644
--- a/lib/Target/Alpha/AlphaTargetMachine.h
+++ b/lib/Target/Alpha/AlphaTargetMachine.h
@@ -20,7 +20,6 @@
#include "AlphaInstrInfo.h"
#include "AlphaJITInfo.h"
#include "AlphaSubtarget.h"
-#include "AlphaTargetAsmInfo.h"
namespace llvm {
@@ -32,13 +31,12 @@
TargetFrameInfo FrameInfo;
AlphaJITInfo JITInfo;
AlphaSubtarget Subtarget;
- AlphaTargetAsmInfo *AsmInfo;
+
+protected:
+ virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
AlphaTargetMachine(const Module &M, const std::string &FS);
- ~AlphaTargetMachine() {
- if (AsmInfo) delete AsmInfo;
- }
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
@@ -51,10 +49,6 @@
return &JITInfo;
}
- virtual const TargetAsmInfo *createTargetAsmInfo() const {
- return static_cast<const TargetAsmInfo *>(new AlphaTargetAsmInfo(*this));
- }
-
static unsigned getJITMatchQuality();
static unsigned getModuleMatchQuality(const Module &M);