Coverage Report

Created: 2023-11-11 10:31

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/PNaCl.h
Line
Count
Source (jump to first uncovered line)
1
//===--- PNaCl.h - Declare PNaCl target feature support ---------*- 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 PNaCl TargetInfo objects.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
14
#define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
15
16
#include "Mips.h"
17
#include "clang/Basic/TargetInfo.h"
18
#include "clang/Basic/TargetOptions.h"
19
#include "llvm/Support/Compiler.h"
20
#include "llvm/TargetParser/Triple.h"
21
22
namespace clang {
23
namespace targets {
24
25
class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {
26
public:
27
  PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
28
1
      : TargetInfo(Triple) {
29
1
    this->LongAlign = 32;
30
1
    this->LongWidth = 32;
31
1
    this->PointerAlign = 32;
32
1
    this->PointerWidth = 32;
33
1
    this->IntMaxType = TargetInfo::SignedLongLong;
34
1
    this->Int64Type = TargetInfo::SignedLongLong;
35
1
    this->DoubleAlign = 64;
36
1
    this->LongDoubleWidth = 64;
37
1
    this->LongDoubleAlign = 64;
38
1
    this->SizeType = TargetInfo::UnsignedInt;
39
1
    this->PtrDiffType = TargetInfo::SignedInt;
40
1
    this->IntPtrType = TargetInfo::SignedInt;
41
1
    this->RegParmMax = 0; // Disallow regparm
42
1
  }
43
44
  void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const;
45
46
  void getTargetDefines(const LangOptions &Opts,
47
1
                        MacroBuilder &Builder) const override {
48
1
    getArchDefines(Opts, Builder);
49
1
  }
50
51
0
  bool hasFeature(StringRef Feature) const override {
52
0
    return Feature == "pnacl";
53
0
  }
54
55
1
  ArrayRef<Builtin::Info> getTargetBuiltins() const override {
56
1
    return std::nullopt;
57
1
  }
58
59
0
  BuiltinVaListKind getBuiltinVaListKind() const override {
60
0
    return TargetInfo::PNaClABIBuiltinVaList;
61
0
  }
62
63
  ArrayRef<const char *> getGCCRegNames() const override;
64
65
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
66
67
  bool validateAsmConstraint(const char *&Name,
68
0
                             TargetInfo::ConstraintInfo &Info) const override {
69
0
    return false;
70
0
  }
71
72
0
  std::string_view getClobbers() const override { return ""; }
73
74
0
  bool hasBitIntType() const override { return true; }
75
};
76
77
// We attempt to use PNaCl (le32) frontend and Mips32EL backend.
78
class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo {
79
public:
80
  NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
81
4
      : MipsTargetInfo(Triple, Opts) {}
82
83
3
  BuiltinVaListKind getBuiltinVaListKind() const override {
84
3
    return TargetInfo::PNaClABIBuiltinVaList;
85
3
  }
86
};
87
} // namespace targets
88
} // namespace clang
89
90
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H