Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/MSP430.h
Line
Count
Source (jump to first uncovered line)
1
//===--- MSP430.h - Declare MSP430 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 MSP430 TargetInfo objects.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
14
#define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
15
16
#include "clang/Basic/TargetInfo.h"
17
#include "clang/Basic/TargetOptions.h"
18
#include "llvm/ADT/Triple.h"
19
#include "llvm/Support/Compiler.h"
20
21
namespace clang {
22
namespace targets {
23
24
class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo {
25
  static const char *const GCCRegNames[];
26
27
public:
28
  MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
29
17
      : TargetInfo(Triple) {
30
17
    TLSSupported = false;
31
17
    IntWidth = 16;
32
17
    IntAlign = 16;
33
17
    LongWidth = 32;
34
17
    LongLongWidth = 64;
35
17
    LongAlign = LongLongAlign = 16;
36
17
    FloatWidth = 32;
37
17
    FloatAlign = 16;
38
17
    DoubleWidth = LongDoubleWidth = 64;
39
17
    DoubleAlign = LongDoubleAlign = 16;
40
17
    PointerWidth = 16;
41
17
    PointerAlign = 16;
42
17
    SuitableAlign = 16;
43
17
    SizeType = UnsignedInt;
44
17
    IntMaxType = SignedLongLong;
45
17
    IntPtrType = SignedInt;
46
17
    PtrDiffType = SignedInt;
47
17
    SigAtomicType = SignedLong;
48
17
    resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16");
49
17
  }
clang::targets::MSP430TargetInfo::MSP430TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
Line
Count
Source
29
17
      : TargetInfo(Triple) {
30
17
    TLSSupported = false;
31
17
    IntWidth = 16;
32
17
    IntAlign = 16;
33
17
    LongWidth = 32;
34
17
    LongLongWidth = 64;
35
17
    LongAlign = LongLongAlign = 16;
36
17
    FloatWidth = 32;
37
17
    FloatAlign = 16;
38
17
    DoubleWidth = LongDoubleWidth = 64;
39
17
    DoubleAlign = LongDoubleAlign = 16;
40
17
    PointerWidth = 16;
41
17
    PointerAlign = 16;
42
17
    SuitableAlign = 16;
43
17
    SizeType = UnsignedInt;
44
17
    IntMaxType = SignedLongLong;
45
17
    IntPtrType = SignedInt;
46
17
    PtrDiffType = SignedInt;
47
17
    SigAtomicType = SignedLong;
48
17
    resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16");
49
17
  }
Unexecuted instantiation: clang::targets::MSP430TargetInfo::MSP430TargetInfo(llvm::Triple const&, clang::TargetOptions const&)
50
  void getTargetDefines(const LangOptions &Opts,
51
                        MacroBuilder &Builder) const override;
52
53
17
  ArrayRef<Builtin::Info> getTargetBuiltins() const override {
54
    // FIXME: Implement.
55
17
    return None;
56
17
  }
57
58
103
  bool allowsLargerPreferedTypeAlignment() const override { return false; }
59
60
0
  bool hasFeature(StringRef Feature) const override {
61
0
    return Feature == "msp430";
62
0
  }
63
64
  ArrayRef<const char *> getGCCRegNames() const override;
65
66
32
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
67
    // Make r0 - r3 be recognized by llc (f.e., in clobber list)
68
32
    static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
69
32
        {{"r0"}, "pc"},
70
32
        {{"r1"}, "sp"},
71
32
        {{"r2"}, "sr"},
72
32
        {{"r3"}, "cg"},
73
32
    };
74
32
    return llvm::makeArrayRef(GCCRegAliases);
75
32
  }
76
77
  bool validateAsmConstraint(const char *&Name,
78
0
                             TargetInfo::ConstraintInfo &info) const override {
79
    // FIXME: implement
80
0
    switch (*Name) {
81
0
    case 'K': // the constant 1
82
0
    case 'L': // constant -1^20 .. 1^19
83
0
    case 'M': // constant 1-4:
84
0
      return true;
85
0
    }
86
    // No target constraints for now.
87
0
    return false;
88
0
  }
89
90
18
  const char *getClobbers() const override {
91
    // FIXME: Is this really right?
92
18
    return "";
93
18
  }
94
95
14
  BuiltinVaListKind getBuiltinVaListKind() const override {
96
    // FIXME: implement
97
14
    return TargetInfo::CharPtrBuiltinVaList;
98
14
  }
99
};
100
101
} // namespace targets
102
} // namespace clang
103
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H