blob: f5e0b4ce9b3607f4d58969cff466c9604e226899 [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
21namespace llvm {
22
23class MBlazeSubtarget : public TargetSubtarget {
24
25protected:
Wesley Pecka70f28c2010-02-23 19:15:24 +000026 bool HasBarrel;
27 bool HasDiv;
28 bool HasMul;
Wesley Pecka70f28c2010-02-23 19:15:24 +000029 bool HasPatCmp;
30 bool HasFPU;
Wesley Pecka70f28c2010-02-23 19:15:24 +000031 bool HasMul64;
32 bool HasSqrt;
Wesley Peck3d820ba2011-04-11 22:31:52 +000033 bool HasItin;
Wesley Pecka70f28c2010-02-23 19:15:24 +000034
35 InstrItineraryData InstrItins;
36
37public:
38
39 /// This constructor initializes the data members to match that
40 /// of the specified triple.
Evan Cheng276365d2011-06-30 01:53:36 +000041 MBlazeSubtarget(const std::string &TT, const std::string &CPU,
42 const std::string &FS);
Wesley Pecka70f28c2010-02-23 19:15:24 +000043
44 /// ParseSubtargetFeatures - Parses features string setting specified
45 /// subtarget options. Definition of function is auto generated by tblgen.
Evan Cheng276365d2011-06-30 01:53:36 +000046 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
Wesley Pecka70f28c2010-02-23 19:15:24 +000047
Wesley Peck3d820ba2011-04-11 22:31:52 +000048 /// Compute the number of maximum number of issues per cycle for the
49 /// MBlaze scheduling itineraries.
50 void computeIssueWidth();
51
52 /// enablePostRAScheduler - True at 'More' optimization.
53 bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
54 TargetSubtarget::AntiDepBreakMode& Mode,
55 RegClassVector& CriticalPathRCs) const;
56
57 /// getInstrItins - Return the instruction itineraies based on subtarget.
58 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
59
60 bool hasItin() const { return HasItin; }
61 bool hasPCMP() const { return HasPatCmp; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000062 bool hasFPU() const { return HasFPU; }
63 bool hasSqrt() const { return HasSqrt; }
64 bool hasMul() const { return HasMul; }
65 bool hasMul64() const { return HasMul64; }
66 bool hasDiv() const { return HasDiv; }
67 bool hasBarrel() const { return HasBarrel; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000068};
69} // End llvm namespace
70
71#endif