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