Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 1 | //===- SPUSubtarget.cpp - STI Cell SPU Subtarget Information --------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 10 | // This file implements the CellSPU-specific subclass of TargetSubtargetInfo. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "SPUSubtarget.h" |
| 15 | #include "SPU.h" |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 16 | #include "SPURegisterInfo.h" |
Evan Cheng | ebdeeab | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/SmallVector.h" |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 18 | |
Evan Cheng | ebdeeab | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 19 | #define GET_SUBTARGETINFO_ENUM |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 20 | #define GET_SUBTARGETINFO_MC_DESC |
| 21 | #define GET_SUBTARGETINFO_TARGET_DESC |
Evan Cheng | ebdeeab | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 22 | #define GET_SUBTARGETINFO_CTOR |
Evan Cheng | 385e930 | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 23 | #include "SPUGenSubtargetInfo.inc" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 24 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 25 | using namespace llvm; |
| 26 | |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 27 | SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &CPU, |
| 28 | const std::string &FS) : |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 29 | SPUGenSubtargetInfo(TT, CPU, FS), |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 30 | StackAlignment(16), |
| 31 | ProcDirective(SPU::DEFAULT_PROC), |
| 32 | UseLargeMem(false) |
| 33 | { |
| 34 | // Should be the target SPU processor type. For now, since there's only |
| 35 | // one, simply default to the current "v0" default: |
| 36 | std::string default_cpu("v0"); |
| 37 | |
| 38 | // Parse features string. |
Evan Cheng | 0ddff1b | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 39 | ParseSubtargetFeatures(default_cpu, FS); |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 40 | |
| 41 | // Initialize scheduling itinerary for the specified CPU. |
| 42 | InstrItins = getInstrItineraryForCPU(default_cpu); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | /// SetJITMode - This is called to inform the subtarget info that we are |
| 46 | /// producing code for the JIT. |
| 47 | void SPUSubtarget::SetJITMode() { |
| 48 | } |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 49 | |
| 50 | /// Enable PostRA scheduling for optimization levels -O2 and -O3. |
| 51 | bool SPUSubtarget::enablePostRAScheduler( |
| 52 | CodeGenOpt::Level OptLevel, |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 53 | TargetSubtargetInfo::AntiDepBreakMode& Mode, |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 54 | RegClassVector& CriticalPathRCs) const { |
Evan Cheng | 5b1b4489 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 55 | Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL; |
Kalle Raiskila | c2ebfd4 | 2010-11-29 10:30:25 +0000 | [diff] [blame] | 56 | // CriticalPathsRCs seems to be the set of |
| 57 | // RegisterClasses that antidep breakings are performed for. |
| 58 | // Do it for all register classes |
| 59 | CriticalPathRCs.clear(); |
| 60 | CriticalPathRCs.push_back(&SPU::R8CRegClass); |
| 61 | CriticalPathRCs.push_back(&SPU::R16CRegClass); |
| 62 | CriticalPathRCs.push_back(&SPU::R32CRegClass); |
| 63 | CriticalPathRCs.push_back(&SPU::R32FPRegClass); |
| 64 | CriticalPathRCs.push_back(&SPU::R64CRegClass); |
| 65 | CriticalPathRCs.push_back(&SPU::VECREGRegClass); |
| 66 | return OptLevel >= CodeGenOpt::Default; |
| 67 | } |