1 //===- MBlazeSubtarget.cpp - MBlaze Subtarget Information -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the MBlaze specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "MBlazeSubtarget.h"
16 #include "MBlazeRegisterInfo.h"
17 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Target/TargetRegistry.h"
20 #define GET_SUBTARGETINFO_ENUM
21 #define GET_SUBTARGETINFO_MC_DESC
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #define GET_SUBTARGETINFO_CTOR
24 #include "MBlazeGenSubtargetInfo.inc"
28 MBlazeSubtarget::MBlazeSubtarget(const std::string
&TT
,
29 const std::string
&CPU
,
30 const std::string
&FS
):
31 MBlazeGenSubtargetInfo(TT
, CPU
, FS
),
32 HasBarrel(false), HasDiv(false), HasMul(false), HasPatCmp(false),
33 HasFPU(false), HasMul64(false), HasSqrt(false)
35 // Parse features string.
36 std::string CPUName
= CPU
;
39 ParseSubtargetFeatures(CPUName
, FS
);
41 // Only use instruction scheduling if the selected CPU has an instruction
42 // itinerary (the default CPU is the only one that doesn't).
43 HasItin
= CPUName
!= "mblaze";
44 DEBUG(dbgs() << "CPU " << CPUName
<< "(" << HasItin
<< ")\n");
46 // Initialize scheduling itinerary for the specified CPU.
47 InstrItins
= getInstrItineraryForCPU(CPUName
);
49 // Compute the issue width of the MBlaze itineraries
53 void MBlazeSubtarget::computeIssueWidth() {
54 InstrItins
.IssueWidth
= 1;
57 bool MBlazeSubtarget::
58 enablePostRAScheduler(CodeGenOpt::Level OptLevel
,
59 TargetSubtargetInfo::AntiDepBreakMode
& Mode
,
60 RegClassVector
& CriticalPathRCs
) const {
61 Mode
= TargetSubtargetInfo::ANTIDEP_CRITICAL
;
62 CriticalPathRCs
.clear();
63 CriticalPathRCs
.push_back(&MBlaze::GPRRegClass
);
64 return HasItin
&& OptLevel
>= CodeGenOpt::Default
;
67 MCSubtargetInfo
*createMBlazeMCSubtargetInfo(StringRef TT
, StringRef CPU
,
69 MCSubtargetInfo
*X
= new MCSubtargetInfo();
70 InitMBlazeMCSubtargetInfo(X
, CPU
, FS
);
74 extern "C" void LLVMInitializeMBlazeMCSubtargetInfo() {
75 TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget
,
76 createMBlazeMCSubtargetInfo
);