/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/Sparc/SparcSubtarget.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- SparcSubtarget.cpp - SPARC Subtarget Information ------------------===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file implements the SPARC specific subclass of TargetSubtargetInfo. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #include "SparcSubtarget.h" |
15 | | #include "Sparc.h" |
16 | | #include "llvm/Support/MathExtras.h" |
17 | | #include "llvm/Support/TargetRegistry.h" |
18 | | |
19 | | using namespace llvm; |
20 | | |
21 | | #define DEBUG_TYPE "sparc-subtarget" |
22 | | |
23 | | #define GET_SUBTARGETINFO_TARGET_DESC |
24 | | #define GET_SUBTARGETINFO_CTOR |
25 | | #include "SparcGenSubtargetInfo.inc" |
26 | | |
27 | 0 | void SparcSubtarget::anchor() { } |
28 | | |
29 | | SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU, |
30 | 376 | StringRef FS) { |
31 | 376 | UseSoftMulDiv = false; |
32 | 376 | IsV9 = false; |
33 | 376 | IsLeon = false; |
34 | 376 | V8DeprecatedInsts = false; |
35 | 376 | IsVIS = false; |
36 | 376 | HasHardQuad = false; |
37 | 376 | UsePopc = false; |
38 | 376 | UseSoftFloat = false; |
39 | 376 | HasNoFSMULD = false; |
40 | 376 | HasNoFMULS = false; |
41 | 376 | |
42 | 376 | // Leon features |
43 | 376 | HasLeonCasa = false; |
44 | 376 | HasUmacSmac = false; |
45 | 376 | PerformSDIVReplace = false; |
46 | 376 | InsertNOPLoad = false; |
47 | 376 | FixAllFDIVSQRT = false; |
48 | 376 | DetectRoundChange = false; |
49 | 376 | |
50 | 376 | // Determine default and user specified characteristics |
51 | 376 | std::string CPUName = CPU; |
52 | 376 | if (CPUName.empty()) |
53 | 320 | CPUName = (Is64Bit) ? 320 "v9"119 : "v8"201 ; |
54 | 376 | |
55 | 376 | // Parse features string. |
56 | 376 | ParseSubtargetFeatures(CPUName, FS); |
57 | 376 | |
58 | 376 | // Popc is a v9-only instruction. |
59 | 376 | if (!IsV9) |
60 | 233 | UsePopc = false; |
61 | 376 | |
62 | 376 | return *this; |
63 | 376 | } |
64 | | |
65 | | SparcSubtarget::SparcSubtarget(const Triple &TT, const std::string &CPU, |
66 | | const std::string &FS, const TargetMachine &TM, |
67 | | bool is64Bit) |
68 | | : SparcGenSubtargetInfo(TT, CPU, FS), TargetTriple(TT), Is64Bit(is64Bit), |
69 | | InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this), |
70 | 376 | FrameLowering(*this) {} |
71 | | |
72 | 477 | int SparcSubtarget::getAdjustedFrameSize(int frameSize) const { |
73 | 477 | |
74 | 477 | if (is64Bit()477 ) { |
75 | 164 | // All 64-bit stack frames must be 16-byte aligned, and must reserve space |
76 | 164 | // for spilling the 16 window registers at %sp+BIAS..%sp+BIAS+128. |
77 | 164 | frameSize += 128; |
78 | 164 | // Frames with calls must also reserve space for 6 outgoing arguments |
79 | 164 | // whether they are used or not. LowerCall_64 takes care of that. |
80 | 164 | frameSize = alignTo(frameSize, 16); |
81 | 477 | } else { |
82 | 313 | // Emit the correct save instruction based on the number of bytes in |
83 | 313 | // the frame. Minimum stack frame size according to V8 ABI is: |
84 | 313 | // 16 words for register window spill |
85 | 313 | // 1 word for address of returned aggregate-value |
86 | 313 | // + 6 words for passing parameters on the stack |
87 | 313 | // ---------- |
88 | 313 | // 23 words * 4 bytes per word = 92 bytes |
89 | 313 | frameSize += 92; |
90 | 313 | |
91 | 313 | // Round up to next doubleword boundary -- a double-word boundary |
92 | 313 | // is required by the ABI. |
93 | 313 | frameSize = alignTo(frameSize, 8); |
94 | 313 | } |
95 | 477 | return frameSize; |
96 | 477 | } |
97 | | |
98 | 1.92k | bool SparcSubtarget::enableMachineScheduler() const { |
99 | 1.92k | return true; |
100 | 1.92k | } |