blob: fffe77cabba37b06d1c6a9ee726f1b47c9c75706 [file] [log] [blame]
Scott Michel564427e2007-12-05 01:24:05 +00001//===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel564427e2007-12-05 01:24:05 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the CellSPU-specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPU_TARGETMACHINE_H
15#define SPU_TARGETMACHINE_H
16
17#include "SPUSubtarget.h"
18#include "SPUInstrInfo.h"
19#include "SPUISelLowering.h"
Dan Gohmanff7a5622010-05-11 17:31:57 +000020#include "SPUSelectionDAGInfo.h"
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000021#include "SPUFrameLowering.h"
Scott Michel564427e2007-12-05 01:24:05 +000022#include "llvm/Target/TargetMachine.h"
23#include "llvm/Target/TargetData.h"
24
25namespace llvm {
26class PassManager;
27class GlobalValue;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000028class TargetFrameLowering;
Scott Michel564427e2007-12-05 01:24:05 +000029
30/// SPUTargetMachine
31///
32class SPUTargetMachine : public LLVMTargetMachine {
33 SPUSubtarget Subtarget;
34 const TargetData DataLayout;
35 SPUInstrInfo InstrInfo;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000036 SPUFrameLowering FrameLowering;
Scott Michel564427e2007-12-05 01:24:05 +000037 SPUTargetLowering TLInfo;
Dan Gohmanff7a5622010-05-11 17:31:57 +000038 SPUSelectionDAGInfo TSInfo;
Scott Michel564427e2007-12-05 01:24:05 +000039 InstrItineraryData InstrItins;
Scott Michel564427e2007-12-05 01:24:05 +000040public:
Evan Cheng43966132011-07-19 06:37:02 +000041 SPUTargetMachine(const Target &T, StringRef TT,
Evan Cheng34ad6db2011-07-20 07:51:56 +000042 StringRef CPU, StringRef FS,
43 Reloc::Model RM, CodeModel::Model CM);
Scott Michel564427e2007-12-05 01:24:05 +000044
45 /// Return the subtarget implementation object
46 virtual const SPUSubtarget *getSubtargetImpl() const {
47 return &Subtarget;
48 }
49 virtual const SPUInstrInfo *getInstrInfo() const {
50 return &InstrInfo;
51 }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000052 virtual const SPUFrameLowering *getFrameLowering() const {
53 return &FrameLowering;
Scott Michel564427e2007-12-05 01:24:05 +000054 }
55 /*!
56 \note Cell SPU does not support JIT today. It could support JIT at some
57 point.
58 */
59 virtual TargetJITInfo *getJITInfo() {
60 return NULL;
61 }
Scott Michel564427e2007-12-05 01:24:05 +000062
Dan Gohmand858e902010-04-17 15:26:15 +000063 virtual const SPUTargetLowering *getTargetLowering() const {
64 return &TLInfo;
Scott Michel564427e2007-12-05 01:24:05 +000065 }
66
Dan Gohmanff7a5622010-05-11 17:31:57 +000067 virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const {
68 return &TSInfo;
69 }
70
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000071 virtual const SPURegisterInfo *getRegisterInfo() const {
Scott Michel564427e2007-12-05 01:24:05 +000072 return &InstrInfo.getRegisterInfo();
73 }
74
75 virtual const TargetData *getTargetData() const {
76 return &DataLayout;
77 }
78
Evan Cheng3ef1c872010-09-10 01:29:16 +000079 virtual const InstrItineraryData *getInstrItineraryData() const {
80 return &InstrItins;
Scott Michel564427e2007-12-05 01:24:05 +000081 }
82
83 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000084 virtual bool addInstSelector(PassManagerBase &PM,
85 CodeGenOpt::Level OptLevel);
Kalle Raiskila76020ed2011-01-11 09:07:54 +000086 virtual bool addPreEmitPass(PassManagerBase &, CodeGenOpt::Level);
Scott Michel564427e2007-12-05 01:24:05 +000087};
88
89} // end namespace llvm
90
91#endif