blob: 43b0197ad5aad25dceaf1256054f015a286037b6 [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//
Evan Cheng5b1b44892011-07-01 21:01:15 +000010// This file declares the MBlaze specific subclass of TargetSubtargetInfo.
Wesley Pecka70f28c2010-02-23 19:15:24 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef MBLAZESUBTARGET_H
15#define MBLAZESUBTARGET_H
16
Evan Cheng5b1b44892011-07-01 21:01:15 +000017#include "llvm/Target/TargetSubtargetInfo.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
Evan Cheng385e9302011-07-01 22:36:09 +000022#include "MBlazeGenSubtargetInfo.inc"
Evan Cheng94214702011-07-01 20:45:01 +000023
Wesley Pecka70f28c2010-02-23 19:15:24 +000024namespace llvm {
Evan Cheng0ddff1b2011-07-07 07:07:08 +000025class StringRef;
Wesley Pecka70f28c2010-02-23 19:15:24 +000026
Evan Cheng94214702011-07-01 20:45:01 +000027class MBlazeSubtarget : public MBlazeGenSubtargetInfo {
Wesley Pecka70f28c2010-02-23 19:15:24 +000028
29protected:
Wesley Pecka70f28c2010-02-23 19:15:24 +000030 bool HasBarrel;
31 bool HasDiv;
32 bool HasMul;
Wesley Pecka70f28c2010-02-23 19:15:24 +000033 bool HasPatCmp;
34 bool HasFPU;
Wesley Pecka70f28c2010-02-23 19:15:24 +000035 bool HasMul64;
36 bool HasSqrt;
Wesley Peck3d820ba2011-04-11 22:31:52 +000037 bool HasItin;
Wesley Pecka70f28c2010-02-23 19:15:24 +000038
39 InstrItineraryData InstrItins;
40
41public:
42
43 /// This constructor initializes the data members to match that
44 /// of the specified triple.
Evan Cheng276365d2011-06-30 01:53:36 +000045 MBlazeSubtarget(const std::string &TT, const std::string &CPU,
46 const std::string &FS);
Wesley Pecka70f28c2010-02-23 19:15:24 +000047
48 /// ParseSubtargetFeatures - Parses features string setting specified
49 /// subtarget options. Definition of function is auto generated by tblgen.
Evan Cheng0ddff1b2011-07-07 07:07:08 +000050 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Wesley Pecka70f28c2010-02-23 19:15:24 +000051
Wesley Peck3d820ba2011-04-11 22:31:52 +000052 /// Compute the number of maximum number of issues per cycle for the
53 /// MBlaze scheduling itineraries.
54 void computeIssueWidth();
55
56 /// enablePostRAScheduler - True at 'More' optimization.
57 bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
Evan Cheng5b1b44892011-07-01 21:01:15 +000058 TargetSubtargetInfo::AntiDepBreakMode& Mode,
Wesley Peck3d820ba2011-04-11 22:31:52 +000059 RegClassVector& CriticalPathRCs) const;
60
61 /// getInstrItins - Return the instruction itineraies based on subtarget.
62 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
63
64 bool hasItin() const { return HasItin; }
65 bool hasPCMP() const { return HasPatCmp; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000066 bool hasFPU() const { return HasFPU; }
67 bool hasSqrt() const { return HasSqrt; }
68 bool hasMul() const { return HasMul; }
69 bool hasMul64() const { return HasMul64; }
70 bool hasDiv() const { return HasDiv; }
71 bool hasBarrel() const { return HasBarrel; }
Wesley Pecka70f28c2010-02-23 19:15:24 +000072};
73} // End llvm namespace
74
75#endif