clang  9.0.0
BPF.cpp
Go to the documentation of this file.
1 //===--- BPF.cpp - Implement BPF target feature support -------------------===//
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 implements BPF TargetInfo objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "BPF.h"
14 #include "Targets.h"
16 #include "llvm/ADT/StringRef.h"
17 
18 using namespace clang;
19 using namespace clang::targets;
20 
22  MacroBuilder &Builder) const {
23  Builder.defineMacro("__bpf__");
24  Builder.defineMacro("__BPF__");
25 }
26 
27 static constexpr llvm::StringLiteral ValidCPUNames[] = {"generic", "v1", "v2",
28  "v3", "probe"};
29 
30 bool BPFTargetInfo::isValidCPUName(StringRef Name) const {
31  return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
32 }
33 
35  Values.append(std::begin(ValidCPUNames), std::end(ValidCPUNames));
36 }
Defines the clang::MacroBuilder utility class.
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
Definition: BPF.cpp:34
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:49
static constexpr llvm::StringLiteral ValidCPUNames[]
Definition: BPF.cpp:27
bool isValidCPUName(StringRef Name) const override
brief Determine whether this TargetInfo supports the given CPU name.
Definition: BPF.cpp:30
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
Definition: BPF.cpp:21
Dataflow Directional Tag Classes.
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
Definition: MacroBuilder.h:29