blob: 034b5ce49c1f502a68569e33006bc21a6db8889f [file] [log] [blame]
Wesley Pecka70f28c2010-02-23 19:15:24 +00001//===- 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 Peck3d820ba2011-04-11 22:31:52 +000016#include "MBlazeRegisterInfo.h"
Wesley Pecka70f28c2010-02-23 19:15:24 +000017#include "MBlazeGenSubtarget.inc"
18#include "llvm/Support/CommandLine.h"
19using namespace llvm;
20
Evan Cheng276365d2011-06-30 01:53:36 +000021MBlazeSubtarget::MBlazeSubtarget(const std::string &TT,
22 const std::string &CPU,
23 const std::string &FS):
Wesley Peck3d820ba2011-04-11 22:31:52 +000024 HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false),
25 HasFPU(false), HasMul64(false), HasSqrt(false)
Wesley Pecka70f28c2010-02-23 19:15:24 +000026{
Wesley Pecka70f28c2010-02-23 19:15:24 +000027 // Parse features string.
Evan Cheng276365d2011-06-30 01:53:36 +000028 std::string CPUName = CPU;
29 if (CPUName.empty())
30 CPUName = "mblaze";
31 ParseSubtargetFeatures(FS, CPUName);
Wesley Peck3d820ba2011-04-11 22:31:52 +000032
33 // Only use instruction scheduling if the selected CPU has an instruction
34 // itinerary (the default CPU is the only one that doesn't).
Evan Cheng276365d2011-06-30 01:53:36 +000035 HasItin = CPUName != "mblaze";
36 DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n");
Wesley Peck3d820ba2011-04-11 22:31:52 +000037
38 // Compute the issue width of the MBlaze itineraries
39 computeIssueWidth();
Wesley Pecka70f28c2010-02-23 19:15:24 +000040}
Wesley Peck3d820ba2011-04-11 22:31:52 +000041
42void MBlazeSubtarget::computeIssueWidth() {
43 InstrItins.IssueWidth = 1;
44}
45
46bool MBlazeSubtarget::
47enablePostRAScheduler(CodeGenOpt::Level OptLevel,
48 TargetSubtarget::AntiDepBreakMode& Mode,
49 RegClassVector& CriticalPathRCs) const {
50 Mode = TargetSubtarget::ANTIDEP_CRITICAL;
51 CriticalPathRCs.clear();
52 CriticalPathRCs.push_back(&MBlaze::GPRRegClass);
53 return HasItin && OptLevel >= CodeGenOpt::Default;
54}
55