blob: 3ce96b81a94f00ff24fdddc2bfdec2e350f86f77 [file] [log] [blame]
Scott Michel564427e2007-12-05 01:24:05 +00001//===- SPUSubtarget.cpp - STI Cell SPU Subtarget Information --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel564427e2007-12-05 01:24:05 +00007//
8//===----------------------------------------------------------------------===//
9//
Evan Cheng5b1b44892011-07-01 21:01:15 +000010// This file implements the CellSPU-specific subclass of TargetSubtargetInfo.
Scott Michel564427e2007-12-05 01:24:05 +000011//
12//===----------------------------------------------------------------------===//
13
14#include "SPUSubtarget.h"
15#include "SPU.h"
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000016#include "SPURegisterInfo.h"
Evan Chengffc0e732011-07-09 05:47:46 +000017#include "llvm/Target/TargetRegistry.h"
Evan Chengebdeeab2011-07-08 01:53:10 +000018#include "llvm/ADT/SmallVector.h"
Scott Michel564427e2007-12-05 01:24:05 +000019
Evan Chengebdeeab2011-07-08 01:53:10 +000020#define GET_SUBTARGETINFO_ENUM
Evan Cheng94214702011-07-01 20:45:01 +000021#define GET_SUBTARGETINFO_MC_DESC
22#define GET_SUBTARGETINFO_TARGET_DESC
Evan Chengebdeeab2011-07-08 01:53:10 +000023#define GET_SUBTARGETINFO_CTOR
Evan Cheng385e9302011-07-01 22:36:09 +000024#include "SPUGenSubtargetInfo.inc"
Evan Cheng94214702011-07-01 20:45:01 +000025
Scott Michel564427e2007-12-05 01:24:05 +000026using namespace llvm;
27
Evan Cheng276365d2011-06-30 01:53:36 +000028SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &CPU,
29 const std::string &FS) :
Evan Cheng0ddff1b2011-07-07 07:07:08 +000030 SPUGenSubtargetInfo(TT, CPU, FS),
Scott Michel564427e2007-12-05 01:24:05 +000031 StackAlignment(16),
32 ProcDirective(SPU::DEFAULT_PROC),
33 UseLargeMem(false)
34{
35 // Should be the target SPU processor type. For now, since there's only
36 // one, simply default to the current "v0" default:
37 std::string default_cpu("v0");
38
39 // Parse features string.
Evan Cheng0ddff1b2011-07-07 07:07:08 +000040 ParseSubtargetFeatures(default_cpu, FS);
Evan Cheng94214702011-07-01 20:45:01 +000041
42 // Initialize scheduling itinerary for the specified CPU.
43 InstrItins = getInstrItineraryForCPU(default_cpu);
Scott Michel564427e2007-12-05 01:24:05 +000044}
45
46/// SetJITMode - This is called to inform the subtarget info that we are
47/// producing code for the JIT.
48void SPUSubtarget::SetJITMode() {
49}
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000050
51/// Enable PostRA scheduling for optimization levels -O2 and -O3.
52bool SPUSubtarget::enablePostRAScheduler(
53 CodeGenOpt::Level OptLevel,
Evan Cheng5b1b44892011-07-01 21:01:15 +000054 TargetSubtargetInfo::AntiDepBreakMode& Mode,
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000055 RegClassVector& CriticalPathRCs) const {
Evan Cheng5b1b44892011-07-01 21:01:15 +000056 Mode = TargetSubtargetInfo::ANTIDEP_CRITICAL;
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000057 // CriticalPathsRCs seems to be the set of
58 // RegisterClasses that antidep breakings are performed for.
59 // Do it for all register classes
60 CriticalPathRCs.clear();
61 CriticalPathRCs.push_back(&SPU::R8CRegClass);
62 CriticalPathRCs.push_back(&SPU::R16CRegClass);
63 CriticalPathRCs.push_back(&SPU::R32CRegClass);
64 CriticalPathRCs.push_back(&SPU::R32FPRegClass);
65 CriticalPathRCs.push_back(&SPU::R64CRegClass);
66 CriticalPathRCs.push_back(&SPU::VECREGRegClass);
67 return OptLevel >= CodeGenOpt::Default;
68}
Evan Chengffc0e732011-07-09 05:47:46 +000069
70MCSubtargetInfo *createSPUMCSubtargetInfo(StringRef TT, StringRef CPU,
71 StringRef FS) {
72 MCSubtargetInfo *X = new MCSubtargetInfo();
73 InitSPUMCSubtargetInfo(X, CPU, FS);
74 return X;
75}
76
77extern "C" void LLVMInitializeCellSPUMCSubtargetInfo() {
78 TargetRegistry::RegisterMCSubtargetInfo(TheCellSPUTarget,
79 createSPUMCSubtargetInfo);
80}