blob: a1a9f51b73900b04ab2ea9876e598f725be03c53 [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//
10// This file implements the CellSPU-specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
14#include "SPUSubtarget.h"
15#include "SPU.h"
Scott Michel564427e2007-12-05 01:24:05 +000016#include "SPUGenSubtarget.inc"
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000017#include "llvm/ADT/SmallVector.h"
18#include "SPURegisterInfo.h"
Scott Michel564427e2007-12-05 01:24:05 +000019
20using namespace llvm;
21
Evan Cheng276365d2011-06-30 01:53:36 +000022SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &CPU,
23 const std::string &FS) :
Scott Michel564427e2007-12-05 01:24:05 +000024 StackAlignment(16),
25 ProcDirective(SPU::DEFAULT_PROC),
26 UseLargeMem(false)
27{
28 // Should be the target SPU processor type. For now, since there's only
29 // one, simply default to the current "v0" default:
30 std::string default_cpu("v0");
31
32 // Parse features string.
33 ParseSubtargetFeatures(FS, default_cpu);
34}
35
36/// SetJITMode - This is called to inform the subtarget info that we are
37/// producing code for the JIT.
38void SPUSubtarget::SetJITMode() {
39}
Kalle Raiskilac2ebfd42010-11-29 10:30:25 +000040
41/// Enable PostRA scheduling for optimization levels -O2 and -O3.
42bool SPUSubtarget::enablePostRAScheduler(
43 CodeGenOpt::Level OptLevel,
44 TargetSubtarget::AntiDepBreakMode& Mode,
45 RegClassVector& CriticalPathRCs) const {
46 Mode = TargetSubtarget::ANTIDEP_CRITICAL;
47 // CriticalPathsRCs seems to be the set of
48 // RegisterClasses that antidep breakings are performed for.
49 // Do it for all register classes
50 CriticalPathRCs.clear();
51 CriticalPathRCs.push_back(&SPU::R8CRegClass);
52 CriticalPathRCs.push_back(&SPU::R16CRegClass);
53 CriticalPathRCs.push_back(&SPU::R32CRegClass);
54 CriticalPathRCs.push_back(&SPU::R32FPRegClass);
55 CriticalPathRCs.push_back(&SPU::R64CRegClass);
56 CriticalPathRCs.push_back(&SPU::VECREGRegClass);
57 return OptLevel >= CodeGenOpt::Default;
58}