2010-02-23 19:15:24 +00:00
|
|
|
//===- MBlazeSubtarget.cpp - MBlaze Subtarget Information -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 21:01:15 +00:00
|
|
|
// This file implements the MBlaze specific subclass of TargetSubtargetInfo.
|
2010-02-23 19:15:24 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MBlazeSubtarget.h"
|
|
|
|
#include "MBlaze.h"
|
2011-04-11 22:31:52 +00:00
|
|
|
#include "MBlazeRegisterInfo.h"
|
2010-02-23 19:15:24 +00:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-01 22:36:09 +00:00
|
|
|
#include "MBlazeGenSubtargetInfo.inc"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
2010-02-23 19:15:24 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-06-30 01:53:36 +00:00
|
|
|
MBlazeSubtarget::MBlazeSubtarget(const std::string &TT,
|
|
|
|
const std::string &CPU,
|
|
|
|
const std::string &FS):
|
2011-07-07 07:07:08 +00:00
|
|
|
MBlazeGenSubtargetInfo(TT, CPU, FS),
|
2011-04-11 22:31:52 +00:00
|
|
|
HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false),
|
|
|
|
HasFPU(false), HasMul64(false), HasSqrt(false)
|
2010-02-23 19:15:24 +00:00
|
|
|
{
|
|
|
|
// Parse features string.
|
2011-06-30 01:53:36 +00:00
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty())
|
|
|
|
CPUName = "mblaze";
|
2011-07-07 07:07:08 +00:00
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
2011-04-11 22:31:52 +00:00
|
|
|
|
|
|
|
// Only use instruction scheduling if the selected CPU has an instruction
|
|
|
|
// itinerary (the default CPU is the only one that doesn't).
|
2011-06-30 01:53:36 +00:00
|
|
|
HasItin = CPUName != "mblaze";
|
|
|
|
DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n");
|
2011-04-11 22:31:52 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
// Initialize scheduling itinerary for the specified CPU.
|
|
|
|
InstrItins = getInstrItineraryForCPU(CPUName);
|
|
|
|
|
2011-04-11 22:31:52 +00:00
|
|
|
// Compute the issue width of the MBlaze itineraries
|
|
|
|
computeIssueWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MBlazeSubtarget::computeIssueWidth() {
|
|
|
|
InstrItins.IssueWidth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MBlazeSubtarget::
|
|
|
|
enablePostRAScheduler(CodeGenOpt::Level OptLevel,
|
2011-07-01 21:01:15 +00:00
|
|
|
TargetSubtargetInfo::AntiDepBreakMode& Mode,
|
2011-04-11 22:31:52 +00:00
|
|
|
RegClassVector& CriticalPathRCs) const {
|
2011-07-01 21:01:15 +00:00
|
|
|
Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL;
|
2011-04-11 22:31:52 +00:00
|
|
|
CriticalPathRCs.clear();
|
|
|
|
CriticalPathRCs.push_back(&MBlaze::GPRRegClass);
|
|
|
|
return HasItin && OptLevel >= CodeGenOpt::Default;
|
2010-02-23 19:15:24 +00:00
|
|
|
}
|
2011-04-11 22:31:52 +00:00
|
|
|
|