Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
Line
Count
Source (jump to first uncovered line)
1
//=- WebAssemblySubtarget.h - Define Subtarget for the WebAssembly -*- 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
/// \file
10
/// This file declares the WebAssembly-specific subclass of
11
/// TargetSubtarget.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
16
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYSUBTARGET_H
17
18
#include "WebAssemblyFrameLowering.h"
19
#include "WebAssemblyISelLowering.h"
20
#include "WebAssemblyInstrInfo.h"
21
#include "WebAssemblySelectionDAGInfo.h"
22
#include "llvm/CodeGen/TargetSubtargetInfo.h"
23
#include <string>
24
25
#define GET_SUBTARGETINFO_ENUM
26
#define GET_SUBTARGETINFO_HEADER
27
#include "WebAssemblyGenSubtargetInfo.inc"
28
29
namespace llvm {
30
31
// Defined in WebAssemblyGenSubtargetInfo.inc.
32
extern const SubtargetFeatureKV
33
    WebAssemblyFeatureKV[WebAssembly::NumSubtargetFeatures];
34
35
class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
36
  enum SIMDEnum {
37
    NoSIMD,
38
    SIMD128,
39
    UnimplementedSIMD128,
40
  } SIMDLevel = NoSIMD;
41
42
  bool HasAtomics = false;
43
  bool HasNontrappingFPToInt = false;
44
  bool HasSignExt = false;
45
  bool HasExceptionHandling = false;
46
  bool HasBulkMemory = false;
47
  bool HasMultivalue = false;
48
  bool HasMutableGlobals = false;
49
  bool HasTailCall = false;
50
51
  /// String name of used CPU.
52
  std::string CPUString;
53
54
  /// What processor and OS we're targeting.
55
  Triple TargetTriple;
56
57
  WebAssemblyFrameLowering FrameLowering;
58
  WebAssemblyInstrInfo InstrInfo;
59
  WebAssemblySelectionDAGInfo TSInfo;
60
  WebAssemblyTargetLowering TLInfo;
61
62
  /// Initializes using CPUString and the passed in feature string so that we
63
  /// can use initializer lists for subtarget initialization.
64
  WebAssemblySubtarget &initializeSubtargetDependencies(StringRef FS);
65
66
public:
67
  /// This constructor initializes the data members to match that
68
  /// of the specified triple.
69
  WebAssemblySubtarget(const Triple &TT, const std::string &CPU,
70
                       const std::string &FS, const TargetMachine &TM);
71
72
4.45k
  const WebAssemblySelectionDAGInfo *getSelectionDAGInfo() const override {
73
4.45k
    return &TSInfo;
74
4.45k
  }
75
55.8k
  const WebAssemblyFrameLowering *getFrameLowering() const override {
76
55.8k
    return &FrameLowering;
77
55.8k
  }
78
127k
  const WebAssemblyTargetLowering *getTargetLowering() const override {
79
127k
    return &TLInfo;
80
127k
  }
81
793k
  const WebAssemblyInstrInfo *getInstrInfo() const override {
82
793k
    return &InstrInfo;
83
793k
  }
84
562k
  const WebAssemblyRegisterInfo *getRegisterInfo() const override {
85
562k
    return &getInstrInfo()->getRegisterInfo();
86
562k
  }
87
5.01k
  const Triple &getTargetTriple() const { return TargetTriple; }
88
  bool enableAtomicExpand() const override;
89
4.50k
  bool enableIndirectBrExpand() const override { return true; }
90
  bool enableMachineScheduler() const override;
91
  bool useAA() const override;
92
93
  // Predicates used by WebAssemblyInstrInfo.td.
94
2.38k
  bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
95
17.1k
  bool hasSIMD128() const { return SIMDLevel >= SIMD128; }
96
14.1k
  bool hasUnimplementedSIMD128() const {
97
14.1k
    return SIMDLevel >= UnimplementedSIMD128;
98
14.1k
  }
99
4.76k
  bool hasAtomics() const { return HasAtomics; }
100
64
  bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
101
610
  bool hasSignExt() const { return HasSignExt; }
102
152
  bool hasExceptionHandling() const { return HasExceptionHandling; }
103
618
  bool hasBulkMemory() const { return HasBulkMemory; }
104
0
  bool hasMultivalue() const { return HasMultivalue; }
105
0
  bool hasMutableGlobals() const { return HasMutableGlobals; }
106
881
  bool hasTailCall() const { return HasTailCall; }
107
108
  /// Parses features string setting specified subtarget options. Definition of
109
  /// function is auto generated by tblgen.
110
  void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
111
};
112
113
} // end namespace llvm
114
115
#endif