Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 1 | //===- MBlazeSubtarget.cpp - MBlaze Subtarget Information -------*- 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 implements the MBlaze specific subclass of TargetSubtargetInfo. |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "MBlazeSubtarget.h" |
| 15 | #include "MBlaze.h" |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 16 | #include "MBlazeRegisterInfo.h" |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 17 | #include "llvm/Support/CommandLine.h" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 18 | |
Evan Cheng | ebdeeab | 2011-07-08 01:53:10 +0000 | [diff] [blame^] | 19 | #define GET_SUBTARGETINFO_ENUM |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 20 | #define GET_SUBTARGETINFO_MC_DESC |
| 21 | #define GET_SUBTARGETINFO_TARGET_DESC |
Evan Cheng | ebdeeab | 2011-07-08 01:53:10 +0000 | [diff] [blame^] | 22 | #define GET_SUBTARGETINFO_CTOR |
Evan Cheng | 385e930 | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 23 | #include "MBlazeGenSubtargetInfo.inc" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 24 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 25 | using namespace llvm; |
| 26 | |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 27 | MBlazeSubtarget::MBlazeSubtarget(const std::string &TT, |
| 28 | const std::string &CPU, |
| 29 | const std::string &FS): |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 30 | MBlazeGenSubtargetInfo(TT, CPU, FS), |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 31 | HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false), |
| 32 | HasFPU(false), HasMul64(false), HasSqrt(false) |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 33 | { |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 34 | // Parse features string. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 35 | std::string CPUName = CPU; |
| 36 | if (CPUName.empty()) |
| 37 | CPUName = "mblaze"; |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 38 | ParseSubtargetFeatures(CPUName, FS); |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 39 | |
| 40 | // Only use instruction scheduling if the selected CPU has an instruction |
| 41 | // itinerary (the default CPU is the only one that doesn't). |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 42 | HasItin = CPUName != "mblaze"; |
| 43 | DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n"); |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 44 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 45 | // Initialize scheduling itinerary for the specified CPU. |
| 46 | InstrItins = getInstrItineraryForCPU(CPUName); |
| 47 | |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 48 | // Compute the issue width of the MBlaze itineraries |
| 49 | computeIssueWidth(); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 50 | } |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 51 | |
| 52 | void MBlazeSubtarget::computeIssueWidth() { |
| 53 | InstrItins.IssueWidth = 1; |
| 54 | } |
| 55 | |
| 56 | bool MBlazeSubtarget:: |
| 57 | 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 { |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 60 | Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL; |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 61 | CriticalPathRCs.clear(); |
| 62 | CriticalPathRCs.push_back(&MBlaze::GPRRegClass); |
| 63 | return HasItin && OptLevel >= CodeGenOpt::Default; |
| 64 | } |