2005-10-16 05:39:50 +00:00
|
|
|
//===-- PPCTargetMachine.h - Define TargetMachine for PowerPC -----*- C++ -*-=//
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-08-11 00:09:42 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-08-11 00:09:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 23:30:14 +00:00
|
|
|
//
|
2004-08-17 04:55:41 +00:00
|
|
|
// This file declares the PowerPC specific subclass of TargetMachine.
|
2004-08-11 00:09:42 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2005-10-16 05:39:50 +00:00
|
|
|
#ifndef PPC_TARGETMACHINE_H
|
|
|
|
#define PPC_TARGETMACHINE_H
|
2004-08-11 00:09:42 +00:00
|
|
|
|
2005-10-14 23:51:18 +00:00
|
|
|
#include "PPCFrameInfo.h"
|
|
|
|
#include "PPCSubtarget.h"
|
2005-10-14 23:53:41 +00:00
|
|
|
#include "PPCJITInfo.h"
|
2005-10-14 23:59:06 +00:00
|
|
|
#include "PPCInstrInfo.h"
|
2006-03-13 23:20:37 +00:00
|
|
|
#include "PPCISelLowering.h"
|
2007-01-24 03:41:36 +00:00
|
|
|
#include "PPCMachOWriterInfo.h"
|
2005-10-14 23:44:05 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2006-05-12 06:33:49 +00:00
|
|
|
#include "llvm/Target/TargetData.h"
|
2004-08-11 00:09:42 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2005-10-15 21:58:54 +00:00
|
|
|
class PassManager;
|
2005-10-14 23:44:05 +00:00
|
|
|
class GlobalValue;
|
2004-08-11 00:09:42 +00:00
|
|
|
|
2006-06-16 01:37:27 +00:00
|
|
|
/// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
|
|
|
|
///
|
2006-09-04 04:14:57 +00:00
|
|
|
class PPCTargetMachine : public LLVMTargetMachine {
|
2006-06-16 01:37:27 +00:00
|
|
|
PPCSubtarget Subtarget;
|
|
|
|
const TargetData DataLayout; // Calculates type size & alignment
|
|
|
|
PPCInstrInfo InstrInfo;
|
|
|
|
PPCFrameInfo FrameInfo;
|
|
|
|
PPCJITInfo JITInfo;
|
|
|
|
PPCTargetLowering TLInfo;
|
|
|
|
InstrItineraryData InstrItins;
|
2007-01-24 03:41:36 +00:00
|
|
|
PPCMachOWriterInfo MachOWriterInfo;
|
|
|
|
|
2006-09-07 23:39:26 +00:00
|
|
|
protected:
|
|
|
|
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
2008-08-17 13:54:28 +00:00
|
|
|
|
|
|
|
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
|
|
|
// set this functions to ctor pointer at startup time if they are linked in.
|
2008-08-21 00:14:44 +00:00
|
|
|
typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
|
2009-02-24 08:30:20 +00:00
|
|
|
PPCTargetMachine &tm,
|
2009-04-29 23:29:43 +00:00
|
|
|
bool verbose);
|
2008-08-17 13:54:28 +00:00
|
|
|
static AsmPrinterCtorFn AsmPrinterCtor;
|
|
|
|
|
2005-10-14 23:44:05 +00:00
|
|
|
public:
|
2006-06-16 01:37:27 +00:00
|
|
|
PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
|
2005-10-16 05:39:50 +00:00
|
|
|
|
|
|
|
virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
2008-05-14 01:58:56 +00:00
|
|
|
virtual const PPCFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
|
|
|
virtual PPCJITInfo *getJITInfo() { return &JITInfo; }
|
2006-05-12 21:09:57 +00:00
|
|
|
virtual PPCTargetLowering *getTargetLowering() const {
|
|
|
|
return const_cast<PPCTargetLowering*>(&TLInfo);
|
|
|
|
}
|
2008-05-14 01:58:56 +00:00
|
|
|
virtual const PPCRegisterInfo *getRegisterInfo() const {
|
2004-08-17 04:55:41 +00:00
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
2006-06-16 01:37:27 +00:00
|
|
|
|
|
|
|
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
|
|
|
virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
2005-11-01 20:06:59 +00:00
|
|
|
virtual const InstrItineraryData getInstrItineraryData() const {
|
|
|
|
return InstrItins;
|
|
|
|
}
|
2007-01-24 03:41:36 +00:00
|
|
|
virtual const PPCMachOWriterInfo *getMachOWriterInfo() const {
|
|
|
|
return &MachOWriterInfo;
|
|
|
|
}
|
2008-08-17 13:54:28 +00:00
|
|
|
|
|
|
|
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
|
|
|
AsmPrinterCtor = F;
|
|
|
|
}
|
|
|
|
|
2006-09-04 04:14:57 +00:00
|
|
|
// Pass Pipeline Configuration
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
|
|
|
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
|
|
|
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
2009-03-25 01:47:28 +00:00
|
|
|
bool Verbose, raw_ostream &Out);
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
2007-07-20 21:56:13 +00:00
|
|
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
2009-05-30 20:51:52 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
|
|
|
bool DumpAsm, JITCodeEmitter &JCE);
|
2009-07-06 05:09:34 +00:00
|
|
|
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
|
|
|
|
bool DumpAsm, ObjectCodeEmitter &OCE);
|
2009-04-29 23:29:43 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
2007-07-20 21:56:13 +00:00
|
|
|
bool DumpAsm, MachineCodeEmitter &MCE);
|
2009-05-30 20:51:52 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
bool DumpAsm, JITCodeEmitter &JCE);
|
2009-07-06 05:09:34 +00:00
|
|
|
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel,
|
|
|
|
bool DumpAsm, ObjectCodeEmitter &OCE);
|
2007-11-19 20:46:23 +00:00
|
|
|
virtual bool getEnableTailMergeDefault() const;
|
2004-08-11 00:09:42 +00:00
|
|
|
};
|
2006-06-16 01:37:27 +00:00
|
|
|
|
|
|
|
/// PPC32TargetMachine - PowerPC 32-bit target machine.
|
|
|
|
///
|
|
|
|
class PPC32TargetMachine : public PPCTargetMachine {
|
|
|
|
public:
|
|
|
|
PPC32TargetMachine(const Module &M, const std::string &FS);
|
2005-10-16 05:39:50 +00:00
|
|
|
|
2006-06-16 01:37:27 +00:00
|
|
|
static unsigned getJITMatchQuality();
|
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
|
|
|
};
|
|
|
|
|
|
|
|
/// PPC64TargetMachine - PowerPC 64-bit target machine.
|
|
|
|
///
|
|
|
|
class PPC64TargetMachine : public PPCTargetMachine {
|
|
|
|
public:
|
|
|
|
PPC64TargetMachine(const Module &M, const std::string &FS);
|
|
|
|
|
|
|
|
static unsigned getJITMatchQuality();
|
|
|
|
static unsigned getModuleMatchQuality(const Module &M);
|
|
|
|
};
|
|
|
|
|
2004-08-11 00:09:42 +00:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|