Move TargetRegistry and TargetSelect from Target to Support where they belong.
[oota-llvm.git] / lib / Target / MBlaze / MBlazeSubtarget.cpp
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 TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "MBlazeSubtarget.h"
15 #include "MBlaze.h"
16 #include "MBlazeRegisterInfo.h"
17 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Support/TargetRegistry.h"
19
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "MBlazeGenSubtargetInfo.inc"
23
24 using namespace llvm;
25
26 MBlazeSubtarget::MBlazeSubtarget(const std::string &TT,
27                                  const std::string &CPU,
28                                  const std::string &FS):
29   MBlazeGenSubtargetInfo(TT, CPU, FS),
30   HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false),
31   HasFPU(false), HasMul64(false), HasSqrt(false)
32 {
33   // Parse features string.
34   std::string CPUName = CPU;
35   if (CPUName.empty())
36     CPUName = "mblaze";
37   ParseSubtargetFeatures(CPUName, FS);
38
39   // Only use instruction scheduling if the selected CPU has an instruction
40   // itinerary (the default CPU is the only one that doesn't).
41   HasItin = CPUName != "mblaze";
42   DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n");
43
44   // Initialize scheduling itinerary for the specified CPU.
45   InstrItins = getInstrItineraryForCPU(CPUName);
46
47   // Compute the issue width of the MBlaze itineraries
48   computeIssueWidth();
49 }
50
51 void MBlazeSubtarget::computeIssueWidth() {
52   InstrItins.IssueWidth = 1;
53 }
54
55 bool MBlazeSubtarget::
56 enablePostRAScheduler(CodeGenOpt::Level OptLevel,
57                       TargetSubtargetInfo::AntiDepBreakMode& Mode,
58                       RegClassVector& CriticalPathRCs) const {
59   Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL;
60   CriticalPathRCs.clear();
61   CriticalPathRCs.push_back(&MBlaze::GPRRegClass);
62   return HasItin && OptLevel >= CodeGenOpt::Default;
63 }