blob: b6a34099b2f7df832ba6dc2b1e3dc7ccebf551dc [file] [log] [blame]
Chris Lattner4ee451d2007-12-29 20:36:04 +00001//===-- SPUSubtarget.h - Define Subtarget for the 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 Cell SPU-specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattner4ee451d2007-12-29 20:36:04 +000014#ifndef CELLSUBTARGET_H
15#define CELLSUBTARGET_H
Scott Michel564427e2007-12-05 01:24:05 +000016
17#include "llvm/Target/TargetInstrItineraries.h"
18#include "llvm/Target/TargetSubtarget.h"
19
20#include <string>
21
22namespace llvm {
23 class Module;
24 class GlobalValue;
25 class TargetMachine;
26
27 namespace SPU {
28 enum {
Dale Johannesendb01c8b2008-02-14 23:35:16 +000029 PROC_NONE,
Scott Michel564427e2007-12-05 01:24:05 +000030 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.
Anton Korobeynikov41a02432009-05-23 19:50:50 +000062 std::string ParseSubtargetFeatures(const std::string &FS,
63 const std::string &CPU);
64
Scott Michel564427e2007-12-05 01:24:05 +000065 /// 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"
Scott Michel21213e72009-01-06 23:10:38 +000089 "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:128:128-v128:128:128"
Scott Michel564427e2007-12-05 01:24:05 +000090 "-s:128:128";
91 }
92 };
93} // End llvm namespace
94
95#endif