16#include "llvm/ADT/StringRef.h"
24#define GET_BUILTIN_STR_TABLE
25#include "clang/Basic/BuiltinsBPF.inc"
26#undef GET_BUILTIN_STR_TABLE
29#define GET_BUILTIN_INFOS
30#include "clang/Basic/BuiltinsBPF.inc"
31#undef GET_BUILTIN_INFOS
37 Builder.defineMacro(
"__bpf__");
38 Builder.defineMacro(
"__BPF__");
42 Builder.defineMacro(
"__BPF_CPU_VERSION__",
"0");
46 Builder.defineMacro(
"__BPF_FEATURE_ADDR_SPACE_CAST");
47 Builder.defineMacro(
"__BPF_FEATURE_MAY_GOTO");
48 Builder.defineMacro(
"__BPF_FEATURE_ATOMIC_MEM_ORDERING");
53 if (CPU ==
"generic" || CPU ==
"v1") {
54 Builder.defineMacro(
"__BPF_CPU_VERSION__",
"1");
58 std::string CpuVerNumStr = CPU.substr(1);
59 Builder.defineMacro(
"__BPF_CPU_VERSION__", CpuVerNumStr);
61 int CpuVerNum = std::stoi(CpuVerNumStr);
63 Builder.defineMacro(
"__BPF_FEATURE_JMP_EXT");
66 Builder.defineMacro(
"__BPF_FEATURE_JMP32");
67 Builder.defineMacro(
"__BPF_FEATURE_ALU32");
71 Builder.defineMacro(
"__BPF_FEATURE_LDSX");
72 Builder.defineMacro(
"__BPF_FEATURE_MOVSX");
73 Builder.defineMacro(
"__BPF_FEATURE_BSWAP");
74 Builder.defineMacro(
"__BPF_FEATURE_SDIV_SMOD");
75 Builder.defineMacro(
"__BPF_FEATURE_GOTOL");
76 Builder.defineMacro(
"__BPF_FEATURE_ST");
77 Builder.defineMacro(
"__BPF_FEATURE_LOAD_ACQ_STORE_REL");
81static constexpr llvm::StringLiteral
ValidCPUNames[] = {
"generic",
"v1",
"v2",
99 for (
const auto &
Feature : Features) {
static constexpr llvm::StringTable BuiltinStrings
static constexpr llvm::StringLiteral ValidCPUNames[]
static constexpr Builtin::Info BuiltinInfos[]
static constexpr unsigned NumBuiltins
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).
llvm::SmallVector< Builtin::InfosShard > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
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.
The info used to represent each builtin.