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 | // |
| 10 | // This file implements the MBlaze specific subclass of TargetSubtarget. |
| 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 "MBlazeGenSubtarget.inc" |
| 18 | #include "llvm/Support/CommandLine.h" |
| 19 | using namespace llvm; |
| 20 | |
| 21 | MBlazeSubtarget::MBlazeSubtarget(const std::string &TT, const std::string &FS): |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame^] | 22 | HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false), |
| 23 | HasFPU(false), HasMul64(false), HasSqrt(false) |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 24 | { |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 25 | // Parse features string. |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame^] | 26 | std::string CPU = "mblaze"; |
| 27 | CPU = ParseSubtargetFeatures(FS, CPU); |
| 28 | |
| 29 | // Only use instruction scheduling if the selected CPU has an instruction |
| 30 | // itinerary (the default CPU is the only one that doesn't). |
| 31 | HasItin = CPU != "mblaze"; |
| 32 | DEBUG(dbgs() << "CPU " << CPU << "(" << HasItin << ")\n"); |
| 33 | |
| 34 | // Compute the issue width of the MBlaze itineraries |
| 35 | computeIssueWidth(); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 36 | } |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame^] | 37 | |
| 38 | void MBlazeSubtarget::computeIssueWidth() { |
| 39 | InstrItins.IssueWidth = 1; |
| 40 | } |
| 41 | |
| 42 | bool MBlazeSubtarget:: |
| 43 | enablePostRAScheduler(CodeGenOpt::Level OptLevel, |
| 44 | TargetSubtarget::AntiDepBreakMode& Mode, |
| 45 | RegClassVector& CriticalPathRCs) const { |
| 46 | Mode = TargetSubtarget::ANTIDEP_CRITICAL; |
| 47 | CriticalPathRCs.clear(); |
| 48 | CriticalPathRCs.push_back(&MBlaze::GPRRegClass); |
| 49 | return HasItin && OptLevel >= CodeGenOpt::Default; |
| 50 | } |
| 51 | |