/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/BPF.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===--- BPF.h - Declare BPF 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 BPF TargetInfo objects. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_BPF_H |
14 | | #define LLVM_CLANG_LIB_BASIC_TARGETS_BPF_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 BPFTargetInfo : public TargetInfo { |
25 | | static const Builtin::Info BuiltinInfo[]; |
26 | | |
27 | | public: |
28 | | BPFTargetInfo(const llvm::Triple &Triple, const TargetOptions &) |
29 | 32 | : TargetInfo(Triple) { |
30 | 32 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; |
31 | 32 | SizeType = UnsignedLong; |
32 | 32 | PtrDiffType = SignedLong; |
33 | 32 | IntPtrType = SignedLong; |
34 | 32 | IntMaxType = SignedLong; |
35 | 32 | Int64Type = SignedLong; |
36 | 32 | RegParmMax = 5; |
37 | 32 | if (Triple.getArch() == llvm::Triple::bpfeb) { |
38 | 4 | resetDataLayout("E-m:e-p:64:64-i64:64-i128:128-n32:64-S128"); |
39 | 28 | } else { |
40 | 28 | resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"); |
41 | 28 | } |
42 | 32 | MaxAtomicPromoteWidth = 64; |
43 | 32 | MaxAtomicInlineWidth = 64; |
44 | 32 | TLSSupported = false; |
45 | 32 | } clang::targets::BPFTargetInfo::BPFTargetInfo(llvm::Triple const&, clang::TargetOptions const&) Line | Count | Source | 29 | 32 | : TargetInfo(Triple) { | 30 | 32 | LongWidth = LongAlign = PointerWidth = PointerAlign = 64; | 31 | 32 | SizeType = UnsignedLong; | 32 | 32 | PtrDiffType = SignedLong; | 33 | 32 | IntPtrType = SignedLong; | 34 | 32 | IntMaxType = SignedLong; | 35 | 32 | Int64Type = SignedLong; | 36 | 32 | RegParmMax = 5; | 37 | 32 | if (Triple.getArch() == llvm::Triple::bpfeb) { | 38 | 4 | resetDataLayout("E-m:e-p:64:64-i64:64-i128:128-n32:64-S128"); | 39 | 28 | } else { | 40 | 28 | resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"); | 41 | 28 | } | 42 | 32 | MaxAtomicPromoteWidth = 64; | 43 | 32 | MaxAtomicInlineWidth = 64; | 44 | 32 | TLSSupported = false; | 45 | 32 | } |
Unexecuted instantiation: clang::targets::BPFTargetInfo::BPFTargetInfo(llvm::Triple const&, clang::TargetOptions const&) |
46 | | |
47 | | void getTargetDefines(const LangOptions &Opts, |
48 | | MacroBuilder &Builder) const override; |
49 | | |
50 | 0 | bool hasFeature(StringRef Feature) const override { |
51 | 0 | return Feature == "bpf" || Feature == "alu32" || Feature == "dwarfris"; |
52 | 0 | } |
53 | | |
54 | | void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name, |
55 | 0 | bool Enabled) const override { |
56 | 0 | Features[Name] = Enabled; |
57 | 0 | } |
58 | | |
59 | | ArrayRef<Builtin::Info> getTargetBuiltins() const override; |
60 | | |
61 | 0 | const char *getClobbers() const override { return ""; } |
62 | | |
63 | 29 | BuiltinVaListKind getBuiltinVaListKind() const override { |
64 | 29 | return TargetInfo::VoidPtrBuiltinVaList; |
65 | 29 | } |
66 | | |
67 | 0 | bool isValidGCCRegisterName(StringRef Name) const override { return true; } |
68 | 0 | ArrayRef<const char *> getGCCRegNames() const override { return None; } |
69 | | |
70 | | bool validateAsmConstraint(const char *&Name, |
71 | 0 | TargetInfo::ConstraintInfo &info) const override { |
72 | 0 | return true; |
73 | 0 | } |
74 | | |
75 | 0 | ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { |
76 | 0 | return None; |
77 | 0 | } |
78 | | |
79 | 12 | bool allowDebugInfoForExternalVar() const override { return true; } |
80 | | |
81 | 0 | CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { |
82 | 0 | switch (CC) { |
83 | 0 | default: |
84 | 0 | return CCCR_Warning; |
85 | 0 | case CC_C: |
86 | 0 | case CC_OpenCLKernel: |
87 | 0 | return CCCR_OK; |
88 | 0 | } |
89 | 0 | } |
90 | | |
91 | | bool isValidCPUName(StringRef Name) const override; |
92 | | |
93 | | void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override; |
94 | | |
95 | 1 | bool setCPU(const std::string &Name) override { |
96 | 1 | StringRef CPUName(Name); |
97 | 1 | return isValidCPUName(CPUName); |
98 | 1 | } |
99 | | }; |
100 | | } // namespace targets |
101 | | } // namespace clang |
102 | | #endif // LLVM_CLANG_LIB_BASIC_TARGETS_BPF_H |