blob: 7e0270159a843703752a6d5ac14bee298ff5610a [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"
Scott Michel564427e2007-12-05 01:24:05 +000021#include "SPUFrameInfo.h"
22#include "llvm/Target/TargetMachine.h"
23#include "llvm/Target/TargetData.h"
24
25namespace llvm {
26class PassManager;
27class GlobalValue;
28class TargetFrameInfo;
29
30/// SPUTargetMachine
31///
32class SPUTargetMachine : public LLVMTargetMachine {
33 SPUSubtarget Subtarget;
34 const TargetData DataLayout;
35 SPUInstrInfo InstrInfo;
36 SPUFrameInfo FrameInfo;
37 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:
Daniel Dunbare28039c2009-08-02 23:37:13 +000041 SPUTargetMachine(const Target &T, const std::string &TT,
42 const std::string &FS);
Scott Michel564427e2007-12-05 01:24:05 +000043
44 /// Return the subtarget implementation object
45 virtual const SPUSubtarget *getSubtargetImpl() const {
46 return &Subtarget;
47 }
48 virtual const SPUInstrInfo *getInstrInfo() const {
49 return &InstrInfo;
50 }
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000051 virtual const SPUFrameInfo *getFrameInfo() const {
Scott Michel564427e2007-12-05 01:24:05 +000052 return &FrameInfo;
53 }
54 /*!
55 \note Cell SPU does not support JIT today. It could support JIT at some
56 point.
57 */
58 virtual TargetJITInfo *getJITInfo() {
59 return NULL;
60 }
Scott Michel564427e2007-12-05 01:24:05 +000061
Dan Gohmand858e902010-04-17 15:26:15 +000062 virtual const SPUTargetLowering *getTargetLowering() const {
63 return &TLInfo;
Scott Michel564427e2007-12-05 01:24:05 +000064 }
65
Dan Gohmanff7a5622010-05-11 17:31:57 +000066 virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const {
67 return &TSInfo;
68 }
69
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000070 virtual const SPURegisterInfo *getRegisterInfo() const {
Scott Michel564427e2007-12-05 01:24:05 +000071 return &InstrInfo.getRegisterInfo();
72 }
73
74 virtual const TargetData *getTargetData() const {
75 return &DataLayout;
76 }
77
Anton Korobeynikove494b9e2009-06-19 19:36:55 +000078 virtual const InstrItineraryData getInstrItineraryData() const {
Scott Michel564427e2007-12-05 01:24:05 +000079 return InstrItins;
80 }
81
82 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000083 virtual bool addInstSelector(PassManagerBase &PM,
84 CodeGenOpt::Level OptLevel);
Scott Michel564427e2007-12-05 01:24:05 +000085};
86
87} // end namespace llvm
88
89#endif