17#include "llvm/ADT/StringRef.h"
23#define BUILTIN(ID, TYPE, ATTRS) \
24 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
25#include "clang/Basic/BuiltinsBPF.inc"
30 Builder.defineMacro(
"__bpf__");
31 Builder.defineMacro(
"__BPF__");
35 Builder.defineMacro(
"__BPF_CPU_VERSION__",
"0");
39 Builder.defineMacro(
"__BPF_FEATURE_ADDR_SPACE_CAST");
41 if (CPU.empty() || CPU ==
"generic" || CPU ==
"v1") {
42 Builder.defineMacro(
"__BPF_CPU_VERSION__",
"1");
46 std::string CpuVerNumStr = CPU.substr(1);
47 Builder.defineMacro(
"__BPF_CPU_VERSION__", CpuVerNumStr);
48 Builder.defineMacro(
"__BPF_FEATURE_MAY_GOTO");
50 int CpuVerNum = std::stoi(CpuVerNumStr);
52 Builder.defineMacro(
"__BPF_FEATURE_JMP_EXT");
55 Builder.defineMacro(
"__BPF_FEATURE_JMP32");
56 Builder.defineMacro(
"__BPF_FEATURE_ALU32");
60 Builder.defineMacro(
"__BPF_FEATURE_LDSX");
61 Builder.defineMacro(
"__BPF_FEATURE_MOVSX");
62 Builder.defineMacro(
"__BPF_FEATURE_BSWAP");
63 Builder.defineMacro(
"__BPF_FEATURE_SDIV_SMOD");
64 Builder.defineMacro(
"__BPF_FEATURE_GOTOL");
65 Builder.defineMacro(
"__BPF_FEATURE_ST");
69static constexpr llvm::StringLiteral
ValidCPUNames[] = {
"generic",
"v1",
"v2",
87 for (
const auto &Feature : Features) {
88 if (Feature ==
"+alu32") {
static constexpr Builtin::Info BuiltinInfo[]
static constexpr llvm::StringLiteral ValidCPUNames[]
static constexpr Builtin::Info BuiltinInfo[]
Defines the clang::MacroBuilder utility class.
Enumerates target-specific builtins in their own namespaces within namespace clang.
Concrete class used by the front-end to report problems and issues.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetOptions & getTargetOpts() const
Retrieve the target options.
std::string CPU
If given, the name of the target CPU to generate code for.
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
The JSON file list parser is used to communicate input to InstallAPI.