Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/Sparc/SparcSubtarget.h
Line
Count
Source (jump to first uncovered line)
1
//===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===//
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 declares the SPARC specific subclass of TargetSubtargetInfo.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
14
#define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
15
16
#include "SparcFrameLowering.h"
17
#include "SparcISelLowering.h"
18
#include "SparcInstrInfo.h"
19
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
20
#include "llvm/CodeGen/TargetFrameLowering.h"
21
#include "llvm/CodeGen/TargetSubtargetInfo.h"
22
#include "llvm/IR/DataLayout.h"
23
#include <string>
24
25
#define GET_SUBTARGETINFO_HEADER
26
#include "SparcGenSubtargetInfo.inc"
27
28
namespace llvm {
29
class StringRef;
30
31
class SparcSubtarget : public SparcGenSubtargetInfo {
32
  Triple TargetTriple;
33
  virtual void anchor();
34
  bool UseSoftMulDiv;
35
  bool IsV9;
36
  bool IsLeon;
37
  bool V8DeprecatedInsts;
38
  bool IsVIS, IsVIS2, IsVIS3;
39
  bool Is64Bit;
40
  bool HasHardQuad;
41
  bool UsePopc;
42
  bool UseSoftFloat;
43
  bool HasNoFSMULD;
44
  bool HasNoFMULS;
45
46
  // LEON features
47
  bool HasUmacSmac;
48
  bool HasLeonCasa;
49
  bool HasPWRPSR;
50
  bool InsertNOPLoad;
51
  bool FixAllFDIVSQRT;
52
  bool DetectRoundChange;
53
  bool HasLeonCycleCounter;
54
55
  SparcInstrInfo InstrInfo;
56
  SparcTargetLowering TLInfo;
57
  SelectionDAGTargetInfo TSInfo;
58
  SparcFrameLowering FrameLowering;
59
60
public:
61
  SparcSubtarget(const Triple &TT, const std::string &CPU,
62
                 const std::string &FS, const TargetMachine &TM, bool is64bit);
63
64
575k
  const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
65
19.2k
  const TargetFrameLowering *getFrameLowering() const override {
66
19.2k
    return &FrameLowering;
67
19.2k
  }
68
168k
  const SparcRegisterInfo *getRegisterInfo() const override {
69
168k
    return &InstrInfo.getRegisterInfo();
70
168k
  }
71
27.4k
  const SparcTargetLowering *getTargetLowering() const override {
72
27.4k
    return &TLInfo;
73
27.4k
  }
74
694
  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
75
694
    return &TSInfo;
76
694
  }
77
78
  bool enableMachineScheduler() const override;
79
80
425
  bool useSoftMulDiv() const { return UseSoftMulDiv; }
81
27.6k
  bool isV9() const { return IsV9; }
82
0
  bool isLeon() const { return IsLeon; }
83
0
  bool isVIS() const { return IsVIS; }
84
0
  bool isVIS2() const { return IsVIS2; }
85
0
  bool isVIS3() const { return IsVIS3; }
86
0
  bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
87
3.91k
  bool hasHardQuad() const { return HasHardQuad; }
88
556
  bool usePopc() const { return UsePopc; }
89
937
  bool useSoftFloat() const { return UseSoftFloat; }
90
6
  bool hasNoFSMULD() const { return HasNoFSMULD; }
91
432
  bool hasNoFMULS() const { return HasNoFMULS; }
92
93
  // Leon options
94
0
  bool hasUmacSmac() const { return HasUmacSmac; }
95
289
  bool hasLeonCasa() const { return HasLeonCasa; }
96
0
  bool hasPWRPSR() const { return HasPWRPSR; }
97
761
  bool insertNOPLoad() const { return InsertNOPLoad; }
98
1.18k
  bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
99
198
  bool detectRoundChange() const { return DetectRoundChange; }
100
425
  bool hasLeonCycleCounter() const { return HasLeonCycleCounter; }
101
102
  /// ParseSubtargetFeatures - Parses features string setting specified
103
  /// subtarget options.  Definition of function is auto generated by tblgen.
104
  void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
105
  SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
106
107
26.6k
  bool is64Bit() const { return Is64Bit; }
108
109
  /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
110
  /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
111
3.47k
  int64_t getStackPointerBias() const {
112
3.47k
    return is64Bit() ? 
2047213
:
03.26k
;
113
3.47k
  }
114
115
  /// Given a actual stack size as determined by FrameInfo, this function
116
  /// returns adjusted framesize which includes space for register window
117
  /// spills and arguments.
118
  int getAdjustedFrameSize(int stackSize) const;
119
120
16
  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
121
};
122
123
} // end namespace llvm
124
125
#endif