blob: 63acee2e7ba1c5c6f4fb6c6df531ff069564f8c7 [file] [log] [blame]
Wesley Pecka70f28c2010-02-23 19:15:24 +00001//=====-- MBlazeSubtarget.h - Define Subtarget for the MBlaze -*- 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 MBlaze specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MBLAZESUBTARGET_H
15#define MBLAZESUBTARGET_H
16
17#include "llvm/Target/TargetSubtarget.h"
Evan Chengab8be962011-06-29 01:14:12 +000018#include "llvm/MC/MCInstrItineraries.h"
Wesley Pecka70f28c2010-02-23 19:15:24 +000019#include <string>
20
Evan Cheng94214702011-07-01 20:45:01 +000021#define GET_SUBTARGETINFO_HEADER
22#include "MBlazeGenSubtarget.inc"
23
Wesley Pecka70f28c2010-02-23 19:15:24 +000024namespace llvm {
25
Evan Cheng94214702011-07-01 20:45:01 +000026class MBlazeSubtarget : public MBlazeGenSubtargetInfo {
Wesley Pecka70f28c2010-02-23 19:15:24 +000027
28protected:
Wesley Pecka70f28c2010-02-23 19:15:24 +000029 bool HasBarrel;
30 bool HasDiv;
31 bool HasMul;
Wesley Pecka70f28c2010-02-23 19:15:24 +000032 bool HasPatCmp;
33 bool HasFPU;
Wesley Pecka70f28c2010-02-23 19:15:24 +000034 bool HasMul64;
35 bool HasSqrt;
Wesley Peck3d820ba2011-04-11 22:31:52 +000036 bool HasItin;
Wesley Pecka70f28c2010-02-23 19:15:24 +000037
38 InstrItineraryData InstrItins;
39
40public:
41
42 /// This constructor initializes the data members to match that
43 /// of the specified triple.
Evan Cheng276365d2011-06-30 01:53:36 +000044 MBlazeSubtarget(const std::string &TT, const std::string &CPU,
45 const std::string &FS);
Wesley Pecka70f28c2010-02-23 19:15:24 +000046
47 /// ParseSubtargetFeatures - Parses features string setting specified
48 /// subtarget options. Definition of function is auto generated by tblgen.
Evan Cheng276365d2011-06-30 01:53:36 +000049 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Wesley Pecka70f28c2010-02-23 19:15:24 +000050
Wesley Peck3d820ba2011-04-11 22:31:52 +000051 /// Compute the number of maximum number of issues per cycle for the
52 /// MBlaze scheduling itineraries.
53 void computeIssueWidth();
54
55 /// enablePostRAScheduler - True at 'More' optimization.
56 bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
57 TargetSubtarget::AntiDepBreakMode& Mode,
58 RegClassVector& CriticalPathRCs) const;
59
60 /// getInstrItins - Return the instruction itineraies based on subtarget.
61 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
62
63 bool hasItin() const { return HasItin; }
64 bool hasPCMP() const { return HasPatCmp; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000065 bool hasFPU() const { return HasFPU; }
66 bool hasSqrt() const { return HasSqrt; }
67 bool hasMul() const { return HasMul; }
68 bool hasMul64() const { return HasMul64; }
69 bool hasDiv() const { return HasDiv; }
70 bool hasBarrel() const { return HasBarrel; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000071};
72} // End llvm namespace
73
74#endif