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
This commit is contained in:
Jim Laskey 2006-09-07 23:39:26 +00:00
parent f93f68347f
commit fde1b3bb2f
14 changed files with 61 additions and 41 deletions

View File

@ -76,6 +76,10 @@ protected: // Can only create subclasses.
///
mutable const TargetAsmInfo *AsmInfo;
/// createTargetAsmInfo - Create a new instance of target specific asm
/// information.
virtual const TargetAsmInfo *createTargetAsmInfo() const { return NULL; }
public:
virtual ~TargetMachine();
@ -111,10 +115,6 @@ public:
return AsmInfo;
}
/// createTargetAsmInfo - Create a new instance of target specific asm
/// information.
virtual const TargetAsmInfo *createTargetAsmInfo() const { return NULL; }
/// getSubtarget - This method returns a pointer to the specified type of
/// TargetSubtarget. In debug builds, it verifies that the object being
/// returned is of the correct type.

View File

@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "ARMTargetAsmInfo.h"
#include "ARMTargetMachine.h"
#include "ARMFrameInfo.h"
#include "ARM.h"
@ -24,6 +25,12 @@ namespace {
RegisterTarget<ARMTargetMachine> X("arm", " ARM");
}
const TargetAsmInfo *ARMTargetMachine::createTargetAsmInfo() const {
return new ARMTargetAsmInfo(*this);
}
/// TargetMachine ctor - Create an ILP32 architecture model
///
ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS)

View File

@ -20,7 +20,6 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "ARMInstrInfo.h"
#include "ARMFrameInfo.h"
#include "ARMTargetAsmInfo.h"
namespace llvm {
@ -30,6 +29,10 @@ class ARMTargetMachine : public LLVMTargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
ARMInstrInfo InstrInfo;
ARMFrameInfo FrameInfo;
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
ARMTargetMachine(const Module &M, const std::string &FS);
@ -41,10 +44,6 @@ public:
virtual const TargetData *getTargetData() const { return &DataLayout; }
static unsigned getModuleMatchQuality(const Module &M);
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new ARMTargetAsmInfo(*this));
}
// Pass Pipeline Configuration
virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,

View File

@ -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 @@ namespace {
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 @@ AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS)
: DataLayout("e"),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
JITInfo(*this),
Subtarget(M, FS),
AsmInfo(NULL) {
Subtarget(M, FS) {
}

View File

@ -20,7 +20,6 @@
#include "AlphaInstrInfo.h"
#include "AlphaJITInfo.h"
#include "AlphaSubtarget.h"
#include "AlphaTargetAsmInfo.h"
namespace llvm {
@ -32,13 +31,12 @@ class AlphaTargetMachine : public LLVMTargetMachine {
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 @@ public:
return &JITInfo;
}
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new AlphaTargetAsmInfo(*this));
}
static unsigned getJITMatchQuality();
static unsigned getModuleMatchQuality(const Module &M);

View File

@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "IA64TargetAsmInfo.h"
#include "IA64TargetMachine.h"
#include "IA64.h"
#include "llvm/Module.h"
@ -29,6 +30,10 @@ namespace {
RegisterTarget<IA64TargetMachine> X("ia64", " IA-64 (Itanium)");
}
const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
return new IA64TargetAsmInfo(*this);
}
unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
// we match [iI][aA]*64
bool seenIA64=false;

View File

@ -19,7 +19,6 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "IA64InstrInfo.h"
#include "IA64ISelLowering.h"
#include "IA64TargetAsmInfo.h"
namespace llvm {
@ -29,6 +28,10 @@ class IA64TargetMachine : public LLVMTargetMachine {
TargetFrameInfo FrameInfo;
//IA64JITInfo JITInfo;
IA64TargetLowering TLInfo;
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
IA64TargetMachine(const Module &M, const std::string &FS);
@ -42,10 +45,6 @@ public:
}
virtual const TargetData *getTargetData() const { return &DataLayout; }
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new IA64TargetAsmInfo(*this));
}
static unsigned getModuleMatchQuality(const Module &M);
// Pass Pipeline Configuration

View File

@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "PPC.h"
#include "PPCTargetAsmInfo.h"
#include "PPCTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
@ -26,6 +27,10 @@ namespace {
Y("ppc64", " PowerPC 64");
}
const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
return new DarwinTargetAsmInfo(*this);
}
unsigned PPC32TargetMachine::getJITMatchQuality() {
#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)
if (sizeof(void*) == 4)

View File

@ -19,7 +19,6 @@
#include "PPCJITInfo.h"
#include "PPCInstrInfo.h"
#include "PPCISelLowering.h"
#include "PPCTargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetData.h"
@ -37,6 +36,10 @@ class PPCTargetMachine : public LLVMTargetMachine {
PPCJITInfo JITInfo;
PPCTargetLowering TLInfo;
InstrItineraryData InstrItins;
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
@ -56,10 +59,6 @@ public:
return InstrItins;
}
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new DarwinTargetAsmInfo(*this));
}
// Pass Pipeline Configuration
virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);

View File

@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
#include "SparcTargetAsmInfo.h"
#include "SparcTargetMachine.h"
#include "Sparc.h"
#include "llvm/Module.h"
@ -23,6 +24,10 @@ namespace {
RegisterTarget<SparcTargetMachine> X("sparc", " SPARC");
}
const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
return new SparcTargetAsmInfo(*this);
}
/// SparcTargetMachine ctor - Create an ILP32 architecture model
///
SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS)

View File

@ -19,7 +19,6 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "SparcInstrInfo.h"
#include "SparcSubtarget.h"
#include "SparcTargetAsmInfo.h"
namespace llvm {
@ -30,6 +29,10 @@ class SparcTargetMachine : public LLVMTargetMachine {
SparcSubtarget Subtarget;
SparcInstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
SparcTargetMachine(const Module &M, const std::string &FS);
@ -42,10 +45,6 @@ public:
virtual const TargetData *getTargetData() const { return &DataLayout; }
static unsigned getModuleMatchQuality(const Module &M);
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new SparcTargetAsmInfo(*this));
}
// Pass Pipeline Configuration
virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);

View File

@ -96,7 +96,7 @@ namespace {
//
TargetMachine::~TargetMachine() {
if (AsmInfo) delete AsmInfo;
delete AsmInfo;
}
/// getRelocationModel - Returns the code generation relocation model. The

View File

@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "X86TargetAsmInfo.h"
#include "X86TargetMachine.h"
#include "X86.h"
#include "llvm/Module.h"
@ -35,6 +36,10 @@ namespace {
RegisterTarget<X86TargetMachine> X("x86", " IA-32 (Pentium and above)");
}
const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
return new X86TargetAsmInfo(*this);
}
unsigned X86TargetMachine::getJITMatchQuality() {
#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
return 10;

View File

@ -21,7 +21,6 @@
#include "X86InstrInfo.h"
#include "X86JITInfo.h"
#include "X86Subtarget.h"
#include "X86TargetAsmInfo.h"
#include "X86ISelLowering.h"
namespace llvm {
@ -33,6 +32,10 @@ class X86TargetMachine : public LLVMTargetMachine {
X86InstrInfo InstrInfo;
X86JITInfo JITInfo;
X86TargetLowering TLInfo;
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
public:
X86TargetMachine(const Module &M, const std::string &FS);
@ -51,10 +54,6 @@ public:
static unsigned getModuleMatchQuality(const Module &M);
static unsigned getJITMatchQuality();
virtual const TargetAsmInfo *createTargetAsmInfo() const {
return static_cast<const TargetAsmInfo *>(new X86TargetAsmInfo(*this));
}
// Set up the pass pipeline.
virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast);