blob: 7f53ea6fbeb2a3692fc2f2ffd38fd3a5a210ebe6 [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU --*- C++ -*-===//
Scott Michel564427e2007-12-05 01:24:05 +00002//
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"
Nadav Roteme3d0e862012-10-10 22:04:55 +000023#include "llvm/Target/TargetTransformImpl.h"
Micah Villmow3574eca2012-10-08 16:38:25 +000024#include "llvm/DataLayout.h"
Scott Michel564427e2007-12-05 01:24:05 +000025
26namespace llvm {
Scott Michel564427e2007-12-05 01:24:05 +000027
28/// SPUTargetMachine
29///
30class SPUTargetMachine : public LLVMTargetMachine {
31 SPUSubtarget Subtarget;
Micah Villmow3574eca2012-10-08 16:38:25 +000032 const DataLayout DL;
Scott Michel564427e2007-12-05 01:24:05 +000033 SPUInstrInfo InstrInfo;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000034 SPUFrameLowering FrameLowering;
Scott Michel564427e2007-12-05 01:24:05 +000035 SPUTargetLowering TLInfo;
Dan Gohmanff7a5622010-05-11 17:31:57 +000036 SPUSelectionDAGInfo TSInfo;
Scott Michel564427e2007-12-05 01:24:05 +000037 InstrItineraryData InstrItins;
Nadav Roteme3d0e862012-10-10 22:04:55 +000038 ScalarTargetTransformImpl STTI;
39 VectorTargetTransformImpl VTTI;
Scott Michel564427e2007-12-05 01:24:05 +000040public:
Evan Cheng43966132011-07-19 06:37:02 +000041 SPUTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000042 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000043 Reloc::Model RM, CodeModel::Model CM,
44 CodeGenOpt::Level OL);
Scott Michel564427e2007-12-05 01:24:05 +000045
46 /// Return the subtarget implementation object
47 virtual const SPUSubtarget *getSubtargetImpl() const {
48 return &Subtarget;
49 }
50 virtual const SPUInstrInfo *getInstrInfo() const {
51 return &InstrInfo;
52 }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000053 virtual const SPUFrameLowering *getFrameLowering() const {
54 return &FrameLowering;
Scott Michel564427e2007-12-05 01:24:05 +000055 }
56 /*!
57 \note Cell SPU does not support JIT today. It could support JIT at some
58 point.
59 */
60 virtual TargetJITInfo *getJITInfo() {
61 return NULL;
62 }
Scott Michel564427e2007-12-05 01:24:05 +000063
Andrew Trick843ee2e2012-02-03 05:12:41 +000064 virtual const SPUTargetLowering *getTargetLowering() const {
Dan Gohmand858e902010-04-17 15:26:15 +000065 return &TLInfo;
Scott Michel564427e2007-12-05 01:24:05 +000066 }
67
Dan Gohmanff7a5622010-05-11 17:31:57 +000068 virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const {
69 return &TSInfo;
70 }
71
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000072 virtual const SPURegisterInfo *getRegisterInfo() const {
Scott Michel564427e2007-12-05 01:24:05 +000073 return &InstrInfo.getRegisterInfo();
74 }
Andrew Trick843ee2e2012-02-03 05:12:41 +000075
Micah Villmow3574eca2012-10-08 16:38:25 +000076 virtual const DataLayout *getDataLayout() const {
77 return &DL;
Scott Michel564427e2007-12-05 01:24:05 +000078 }
79
Evan Cheng3ef1c872010-09-10 01:29:16 +000080 virtual const InstrItineraryData *getInstrItineraryData() const {
81 return &InstrItins;
Scott Michel564427e2007-12-05 01:24:05 +000082 }
Nadav Roteme3d0e862012-10-10 22:04:55 +000083 virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
84 return &STTI;
85 }
86 virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
87 return &VTTI;
88 }
Andrew Trick843ee2e2012-02-03 05:12:41 +000089
Scott Michel564427e2007-12-05 01:24:05 +000090 // Pass Pipeline Configuration
Andrew Trick061efcf2012-02-04 02:56:59 +000091 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Scott Michel564427e2007-12-05 01:24:05 +000092};
93
94} // end namespace llvm
95
96#endif