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