blob: 88201c653b9bce7c760b8487f6a52baba4f61520 [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 {
Scott Michel564427e2007-12-05 01:24:05 +000023 class GlobalValue;
Scott Michel564427e2007-12-05 01:24:05 +000024
25 namespace SPU {
26 enum {
Dale Johannesendb01c8b2008-02-14 23:35:16 +000027 PROC_NONE,
Scott Michel564427e2007-12-05 01:24:05 +000028 DEFAULT_PROC
29 };
30 }
31
32 class SPUSubtarget : public TargetSubtarget {
33 protected:
Scott Michel564427e2007-12-05 01:24:05 +000034 /// stackAlignment - The minimum alignment known to hold of the stack frame
35 /// on entry to the function and which must be maintained by every function.
36 unsigned StackAlignment;
37
38 /// Selected instruction itineraries (one entry per itinerary class.)
39 InstrItineraryData InstrItins;
40
41 /// Which SPU processor (this isn't really used, but it's there to keep
42 /// the C compiler happy)
43 unsigned ProcDirective;
44
45 /// Use (assume) large memory -- effectively disables the LQA/STQA
46 /// instructions that assume 259K local store.
47 bool UseLargeMem;
48
49 public:
50 /// This constructor initializes the data members to match that
Daniel Dunbar3be03402009-08-02 22:11:08 +000051 /// of the specified triple.
Scott Michel564427e2007-12-05 01:24:05 +000052 ///
Daniel Dunbar3be03402009-08-02 22:11:08 +000053 SPUSubtarget(const std::string &TT, const std::string &FS);
Scott Michel564427e2007-12-05 01:24:05 +000054
55 /// ParseSubtargetFeatures - Parses features string setting specified
56 /// subtarget options. Definition of function is auto generated by tblgen.
Anton Korobeynikov41a02432009-05-23 19:50:50 +000057 std::string ParseSubtargetFeatures(const std::string &FS,
58 const std::string &CPU);
59
Scott Michel564427e2007-12-05 01:24:05 +000060 /// SetJITMode - This is called to inform the subtarget info that we are
61 /// producing code for the JIT.
62 void SetJITMode();
63
64 /// getStackAlignment - Returns the minimum alignment known to hold of the
65 /// stack frame on entry to the function and which must be maintained by
66 /// every function for this subtarget.
67 unsigned getStackAlignment() const { return StackAlignment; }
68
69 /// getInstrItins - Return the instruction itineraies based on subtarget
70 /// selection.
71 const InstrItineraryData &getInstrItineraryData() const {
72 return InstrItins;
73 }
74
75 /// Use large memory addressing predicate
76 bool usingLargeMem() const {
77 return UseLargeMem;
78 }
79
80 /// getTargetDataString - Return the pointer size and type alignment
81 /// properties of this subtarget.
82 const char *getTargetDataString() const {
83 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 +000084 "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:128:128-v128:128:128"
Chris Lattner59a91782009-11-07 19:07:32 +000085 "-s:128:128-n32:64";
Scott Michel564427e2007-12-05 01:24:05 +000086 }
87 };
88} // End llvm namespace
89
90#endif