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");
40 Builder.defineMacro(
"__BPF_FEATURE_MAY_GOTO");
41 Builder.defineMacro(
"__BPF_FEATURE_ATOMIC_MEM_ORDERING");
46 if (CPU ==
"generic" || CPU ==
"v1") {
47 Builder.defineMacro(
"__BPF_CPU_VERSION__",
"1");
51 std::string CpuVerNumStr = CPU.substr(1);
52 Builder.defineMacro(
"__BPF_CPU_VERSION__", CpuVerNumStr);
54 int CpuVerNum = std::stoi(CpuVerNumStr);
56 Builder.defineMacro(
"__BPF_FEATURE_JMP_EXT");
59 Builder.defineMacro(
"__BPF_FEATURE_JMP32");
60 Builder.defineMacro(
"__BPF_FEATURE_ALU32");
64 Builder.defineMacro(
"__BPF_FEATURE_LDSX");
65 Builder.defineMacro(
"__BPF_FEATURE_MOVSX");
66 Builder.defineMacro(
"__BPF_FEATURE_BSWAP");
67 Builder.defineMacro(
"__BPF_FEATURE_SDIV_SMOD");
68 Builder.defineMacro(
"__BPF_FEATURE_GOTOL");
69 Builder.defineMacro(
"__BPF_FEATURE_ST");
73static constexpr llvm::StringLiteral
ValidCPUNames[] = {
"generic",
"v1",
"v2",
91 for (
const auto &Feature : Features) {
92 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.