Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 1 | //=====-- 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 Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 10 | // This file declares the MBlaze specific subclass of TargetSubtargetInfo. |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef MBLAZESUBTARGET_H |
| 15 | #define MBLAZESUBTARGET_H |
| 16 | |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 17 | #include "llvm/Target/TargetSubtargetInfo.h" |
Evan Cheng | ab8be96 | 2011-06-29 01:14:12 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCInstrItineraries.h" |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 19 | #include <string> |
| 20 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 21 | #define GET_SUBTARGETINFO_HEADER |
Evan Cheng | 385e930 | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 22 | #include "MBlazeGenSubtargetInfo.inc" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 23 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 24 | namespace llvm { |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame^] | 25 | class StringRef; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 26 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 27 | class MBlazeSubtarget : public MBlazeGenSubtargetInfo { |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 28 | |
| 29 | protected: |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 30 | bool HasBarrel; |
| 31 | bool HasDiv; |
| 32 | bool HasMul; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 33 | bool HasPatCmp; |
| 34 | bool HasFPU; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 35 | bool HasMul64; |
| 36 | bool HasSqrt; |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 37 | bool HasItin; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 38 | |
| 39 | InstrItineraryData InstrItins; |
| 40 | |
| 41 | public: |
| 42 | |
| 43 | /// This constructor initializes the data members to match that |
| 44 | /// of the specified triple. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 45 | MBlazeSubtarget(const std::string &TT, const std::string &CPU, |
| 46 | const std::string &FS); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 47 | |
| 48 | /// ParseSubtargetFeatures - Parses features string setting specified |
| 49 | /// subtarget options. Definition of function is auto generated by tblgen. |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame^] | 50 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 51 | |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 52 | /// 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 Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 58 | TargetSubtargetInfo::AntiDepBreakMode& Mode, |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 59 | 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 Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 66 | 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 Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 72 | }; |
| 73 | } // End llvm namespace |
| 74 | |
| 75 | #endif |