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 | // |
| 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 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 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | class MBlazeSubtarget : public TargetSubtarget { |
| 24 | |
| 25 | protected: |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 26 | bool HasBarrel; |
| 27 | bool HasDiv; |
| 28 | bool HasMul; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 29 | bool HasPatCmp; |
| 30 | bool HasFPU; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 31 | bool HasMul64; |
| 32 | bool HasSqrt; |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 33 | bool HasItin; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 34 | |
| 35 | InstrItineraryData InstrItins; |
| 36 | |
| 37 | public: |
| 38 | |
| 39 | /// This constructor initializes the data members to match that |
| 40 | /// of the specified triple. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 41 | MBlazeSubtarget(const std::string &TT, const std::string &CPU, |
| 42 | const std::string &FS); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 43 | |
| 44 | /// ParseSubtargetFeatures - Parses features string setting specified |
| 45 | /// subtarget options. Definition of function is auto generated by tblgen. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 46 | void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 47 | |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 48 | /// 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 Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 62 | 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 Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 68 | }; |
| 69 | } // End llvm namespace |
| 70 | |
| 71 | #endif |