2010-02-24 03:15:24 +08: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-02 05:01:15 +08:00
|
|
|
// This file implements the MBlaze specific subclass of TargetSubtargetInfo.
|
2010-02-24 03:15:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MBlazeSubtarget.h"
|
|
|
|
#include "MBlaze.h"
|
2011-04-12 06:31:52 +08:00
|
|
|
#include "MBlazeRegisterInfo.h"
|
2010-02-24 03:15:24 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "MBlazeGenSubtargetInfo.inc"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2010-02-24 03:15:24 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-06-30 09:53:36 +08:00
|
|
|
MBlazeSubtarget::MBlazeSubtarget(const std::string &TT,
|
|
|
|
const std::string &CPU,
|
|
|
|
const std::string &FS):
|
2011-07-07 15:07:08 +08:00
|
|
|
MBlazeGenSubtargetInfo(TT, CPU, FS),
|
2011-04-12 06:31:52 +08:00
|
|
|
HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false),
|
|
|
|
HasFPU(false), HasMul64(false), HasSqrt(false)
|
2010-02-24 03:15:24 +08:00
|
|
|
{
|
|
|
|
// Parse features string.
|
2011-06-30 09:53:36 +08:00
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty())
|
|
|
|
CPUName = "mblaze";
|
2011-07-07 15:07:08 +08:00
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
2011-04-12 06:31:52 +08: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 09:53:36 +08:00
|
|
|
HasItin = CPUName != "mblaze";
|
|
|
|
DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n");
|
2011-04-12 06:31:52 +08:00
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
// Initialize scheduling itinerary for the specified CPU.
|
|
|
|
InstrItins = getInstrItineraryForCPU(CPUName);
|
|
|
|
|
2011-04-12 06:31:52 +08:00
|
|
|
// Compute the issue width of the MBlaze itineraries
|
|
|
|
computeIssueWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MBlazeSubtarget::computeIssueWidth() {
|
|
|
|
InstrItins.IssueWidth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MBlazeSubtarget::
|
|
|
|
enablePostRAScheduler(CodeGenOpt::Level OptLevel,
|
2011-07-02 05:01:15 +08:00
|
|
|
TargetSubtargetInfo::AntiDepBreakMode& Mode,
|
2011-04-12 06:31:52 +08:00
|
|
|
RegClassVector& CriticalPathRCs) const {
|
2011-07-02 05:01:15 +08:00
|
|
|
Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL;
|
2011-04-12 06:31:52 +08:00
|
|
|
CriticalPathRCs.clear();
|
|
|
|
CriticalPathRCs.push_back(&MBlaze::GPRRegClass);
|
|
|
|
return HasItin && OptLevel >= CodeGenOpt::Default;
|
2010-02-24 03:15:24 +08:00
|
|
|
}
|
2011-04-12 06:31:52 +08:00
|
|
|
|