1 //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the CellSPU-specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef SPU_TARGETMACHINE_H
15 #define SPU_TARGETMACHINE_H
17 #include "SPUSubtarget.h"
18 #include "SPUInstrInfo.h"
19 #include "SPUISelLowering.h"
20 #include "SPUFrameInfo.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "llvm/Target/TargetData.h"
27 class TargetFrameInfo;
31 class SPUTargetMachine : public LLVMTargetMachine {
32 SPUSubtarget Subtarget;
33 const TargetData DataLayout;
34 SPUInstrInfo InstrInfo;
35 SPUFrameInfo FrameInfo;
36 SPUTargetLowering TLInfo;
37 InstrItineraryData InstrItins;
40 virtual const TargetAsmInfo *createTargetAsmInfo() const;
42 // To avoid having target depend on the asmprinter stuff libraries, asmprinter
43 // set this functions to ctor pointer at startup time if they are linked in.
44 typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
46 CodeGenOpt::Level OptLevel,
48 static AsmPrinterCtorFn AsmPrinterCtor;
51 SPUTargetMachine(const Module &M, const std::string &FS);
53 /// Return the subtarget implementation object
54 virtual const SPUSubtarget *getSubtargetImpl() const {
57 virtual const SPUInstrInfo *getInstrInfo() const {
60 virtual const SPUFrameInfo *getFrameInfo() const {
64 \note Cell SPU does not support JIT today. It could support JIT at some
67 virtual TargetJITInfo *getJITInfo() {
71 //! Module match function
73 Module matching function called by TargetMachineRegistry().
75 static unsigned getModuleMatchQuality(const Module &M);
77 virtual SPUTargetLowering *getTargetLowering() const {
78 return const_cast<SPUTargetLowering*>(&TLInfo);
81 virtual const SPURegisterInfo *getRegisterInfo() const {
82 return &InstrInfo.getRegisterInfo();
85 virtual const TargetData *getTargetData() const {
89 virtual const InstrItineraryData getInstrItineraryData() const {
93 // Pass Pipeline Configuration
94 virtual bool addInstSelector(PassManagerBase &PM,
95 CodeGenOpt::Level OptLevel);
96 virtual bool addAssemblyEmitter(PassManagerBase &PM,
97 CodeGenOpt::Level OptLevel,
98 bool Verbose, raw_ostream &Out);
100 static void registerAsmPrinter(AsmPrinterCtorFn F) {
105 } // end namespace llvm