Skip to content

Commit 640abbd

Browse files
yonghong-songaokblast
authored andcommitted
[Clang][BPF] Add __BPF_FEATURE_GOTOX (llvm#165456)
Add a macro __BPF_FEATURE_GOTOX for bpf target for cpu v4. So the developer can easily detect whether insn gotox is supported or not.
1 parent 7f939af commit 640abbd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/lib/Basic/Targets/BPF.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
7575
Builder.defineMacro("__BPF_FEATURE_GOTOL");
7676
Builder.defineMacro("__BPF_FEATURE_ST");
7777
Builder.defineMacro("__BPF_FEATURE_LOAD_ACQ_STORE_REL");
78+
Builder.defineMacro("__BPF_FEATURE_GOTOX");
7879
}
7980
}
8081

clang/test/Preprocessor/bpf-predefined-macros.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ int u;
7070
#ifdef __BPF_FEATURE_LOAD_ACQ_STORE_REL
7171
int v;
7272
#endif
73+
#ifdef __BPF_FEATURE_GOTOX
74+
int w;
75+
#endif
7376

7477
// CHECK: int b;
7578
// CHECK: int c;
@@ -110,6 +113,7 @@ int v;
110113
// CPU_V4: int u;
111114

112115
// CPU_V4: int v;
116+
// CPU_V4: int w;
113117

114118
// CPU_GENERIC: int g;
115119

0 commit comments

Comments
 (0)