LLVM API Documentation
00001 //===-- MBlazeSubtarget.cpp - MBlaze Subtarget Information ----------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements the MBlaze specific subclass of TargetSubtargetInfo. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "MBlazeSubtarget.h" 00015 #include "MBlaze.h" 00016 #include "MBlazeRegisterInfo.h" 00017 #include "llvm/Support/CommandLine.h" 00018 #include "llvm/Support/TargetRegistry.h" 00019 00020 #define GET_SUBTARGETINFO_TARGET_DESC 00021 #define GET_SUBTARGETINFO_CTOR 00022 #include "MBlazeGenSubtargetInfo.inc" 00023 00024 using namespace llvm; 00025 00026 MBlazeSubtarget::MBlazeSubtarget(const std::string &TT, 00027 const std::string &CPU, 00028 const std::string &FS): 00029 MBlazeGenSubtargetInfo(TT, CPU, FS), 00030 HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false), 00031 HasFPU(false), HasMul64(false), HasSqrt(false) 00032 { 00033 // Parse features string. 00034 std::string CPUName = CPU; 00035 if (CPUName.empty()) 00036 CPUName = "mblaze"; 00037 ParseSubtargetFeatures(CPUName, FS); 00038 00039 // Only use instruction scheduling if the selected CPU has an instruction 00040 // itinerary (the default CPU is the only one that doesn't). 00041 HasItin = CPUName != "mblaze"; 00042 DEBUG(dbgs() << "CPU " << CPUName << "(" << HasItin << ")\n"); 00043 00044 // Initialize scheduling itinerary for the specified CPU. 00045 InstrItins = getInstrItineraryForCPU(CPUName); 00046 } 00047 00048 bool MBlazeSubtarget:: 00049 enablePostRAScheduler(CodeGenOpt::Level OptLevel, 00050 TargetSubtargetInfo::AntiDepBreakMode& Mode, 00051 RegClassVector& CriticalPathRCs) const { 00052 Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL; 00053 CriticalPathRCs.clear(); 00054 CriticalPathRCs.push_back(&MBlaze::GPRRegClass); 00055 return HasItin && OptLevel >= CodeGenOpt::Default; 00056 }