blob: 69a60db2b93c90ac78e9a9a39535200b4df35b82 [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
Scott Michel564427e2007-12-05 01:24:05 +000017#include "llvm/Target/TargetSubtarget.h"
Evan Chengab8be962011-06-29 01:14:12 +000018#include "llvm/MC/MCInstrItineraries.h"
Scott Michel564427e2007-12-05 01:24:05 +000019#include <string>
20
21namespace llvm {
Scott Michel564427e2007-12-05 01:24:05 +000022 class GlobalValue;
Scott Michel564427e2007-12-05 01:24:05 +000023
24 namespace SPU {
25 enum {
Dale Johannesendb01c8b2008-02-14 23:35:16 +000026 PROC_NONE,
Scott Michel564427e2007-12-05 01:24:05 +000027 DEFAULT_PROC
28 };
29 }
30
31 class SPUSubtarget : public TargetSubtarget {
32 protected:
Scott Michel564427e2007-12-05 01:24:05 +000033 /// stackAlignment - The minimum alignment known to hold of the stack frame
34 /// on entry to the function and which must be maintained by every function.
35 unsigned StackAlignment;
36
37 /// Selected instruction itineraries (one entry per itinerary class.)
38 InstrItineraryData InstrItins;
39
40 /// Which SPU processor (this isn't really used, but it's there to keep
41 /// the C compiler happy)
42 unsigned ProcDirective;
43
44 /// Use (assume) large memory -- effectively disables the LQA/STQA
45 /// instructions that assume 259K local store.
46 bool UseLargeMem;
47
48 public:
49 /// This constructor initializes the data members to match that
Daniel Dunbar3be03402009-08-02 22:11:08 +000050 /// of the specified triple.
Scott Michel564427e2007-12-05 01:24:05 +000051 ///
Evan Cheng276365d2011-06-30 01:53:36 +000052 SPUSubtarget(const std::string &TT, const std::string &CPU,
53 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.
Evan Cheng276365d2011-06-30 01:53:36 +000057 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Anton Korobeynikov41a02432009-05-23 19:50:50 +000058
Scott Michel564427e2007-12-05 01:24:05 +000059 /// SetJITMode - This is called to inform the subtarget info that we are
60 /// producing code for the JIT.
61 void SetJITMode();
62
63 /// getStackAlignment - Returns the minimum alignment known to hold of the
64 /// stack frame on entry to the function and which must be maintained by
65 /// every function for this subtarget.
66 unsigned getStackAlignment() const { return StackAlignment; }
67
68 /// getInstrItins - Return the instruction itineraies based on subtarget
69 /// selection.
70 const InstrItineraryData &getInstrItineraryData() const {
71 return InstrItins;
72 }
73
74 /// Use large memory addressing predicate
75 bool usingLargeMem() const {
76 return UseLargeMem;
77 }
78
79 /// getTargetDataString - Return the pointer size and type alignment
80 /// properties of this subtarget.
81 const char *getTargetDataString() const {
82 return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128"
Kalle Raiskila505faa62010-10-26 10:45:47 +000083 "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:64:128-v128:128:128"
Chris Lattner59a91782009-11-07 19:07:32 +000084 "-s:128:128-n32:64";
Scott Michel564427e2007-12-05 01:24:05 +000085 }
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000086
87 bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
88 TargetSubtarget::AntiDepBreakMode& Mode,
89 RegClassVector& CriticalPathRCs) const;
Scott Michel564427e2007-12-05 01:24:05 +000090 };
91} // End llvm namespace
92
93#endif