blob: d0172b1770eba148ee2a46ff82317722b4afa6aa [file] [log] [blame]
Scott Michel564427e2007-12-05 01:24:05 +00001//=====-- SPUSubtarget.h - Define Subtarget for the Cell SPU -----*- C++ -*--=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by a team from the Computer Systems Research
6// Department at The Aerospace Corporation.
7//
8// See README.txt for details.
9//
10//===----------------------------------------------------------------------===//
11//
12// This file declares the Cell SPU-specific subclass of TargetSubtarget.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef POWERPCSUBTARGET_H
17#define POWERPCSUBTARGET_H
18
19#include "llvm/Target/TargetInstrItineraries.h"
20#include "llvm/Target/TargetSubtarget.h"
21
22#include <string>
23
24namespace llvm {
25 class Module;
26 class GlobalValue;
27 class TargetMachine;
28
29 namespace SPU {
30 enum {
31 DEFAULT_PROC
32 };
33 }
34
35 class SPUSubtarget : public TargetSubtarget {
36 protected:
37 const TargetMachine &TM;
38
39 /// stackAlignment - The minimum alignment known to hold of the stack frame
40 /// on entry to the function and which must be maintained by every function.
41 unsigned StackAlignment;
42
43 /// Selected instruction itineraries (one entry per itinerary class.)
44 InstrItineraryData InstrItins;
45
46 /// Which SPU processor (this isn't really used, but it's there to keep
47 /// the C compiler happy)
48 unsigned ProcDirective;
49
50 /// Use (assume) large memory -- effectively disables the LQA/STQA
51 /// instructions that assume 259K local store.
52 bool UseLargeMem;
53
54 public:
55 /// This constructor initializes the data members to match that
56 /// of the specified module.
57 ///
58 SPUSubtarget(const TargetMachine &TM, const Module &M,
59 const std::string &FS);
60
61 /// ParseSubtargetFeatures - Parses features string setting specified
62 /// subtarget options. Definition of function is auto generated by tblgen.
63 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
64
65 /// SetJITMode - This is called to inform the subtarget info that we are
66 /// producing code for the JIT.
67 void SetJITMode();
68
69 /// getStackAlignment - Returns the minimum alignment known to hold of the
70 /// stack frame on entry to the function and which must be maintained by
71 /// every function for this subtarget.
72 unsigned getStackAlignment() const { return StackAlignment; }
73
74 /// getInstrItins - Return the instruction itineraies based on subtarget
75 /// selection.
76 const InstrItineraryData &getInstrItineraryData() const {
77 return InstrItins;
78 }
79
80 /// Use large memory addressing predicate
81 bool usingLargeMem() const {
82 return UseLargeMem;
83 }
84
85 /// getTargetDataString - Return the pointer size and type alignment
86 /// properties of this subtarget.
87 const char *getTargetDataString() const {
88 return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128"
89 "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v128:128:128"
90 "-s:128:128";
91 }
92 };
93} // End llvm namespace
94
95#endif