Coverage Report

Created: 2019-07-24 05:18

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