Skip to content

Commit 65b123e

Browse files
authored
[BPF] rename 'arena' to 'address_space' (#85161)
There are a few places where `arena` name is used for pointers in non-zero address space in BPF backend, rename these to use a more generic `address_space`: - macro `__BPF_FEATURE_ARENA_CAST` -> `__BPF_FEATURE_ADDR_SPACE_CAST - name for arena global variables section `.arena.N` -> `.addr_space.N`
1 parent 0c07102 commit 65b123e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

clang/lib/Basic/Targets/BPF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
3636
return;
3737
}
3838

39-
Builder.defineMacro("__BPF_FEATURE_ARENA_CAST");
39+
Builder.defineMacro("__BPF_FEATURE_ADDR_SPACE_CAST");
4040

4141
if (CPU.empty() || CPU == "generic" || CPU == "v1") {
4242
Builder.defineMacro("__BPF_CPU_VERSION__", "1");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int r;
6161
#ifdef __BPF_FEATURE_ST
6262
int s;
6363
#endif
64-
#ifdef __BPF_FEATURE_ARENA_CAST
64+
#ifdef __BPF_FEATURE_ADDR_SPACE_CAST
6565
int t;
6666
#endif
6767

llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// - remove llvm.bpf.getelementptr.and.load builtins.
1616
// - remove llvm.bpf.getelementptr.and.store builtins.
1717
// - for loads and stores with base addresses from non-zero address space
18-
// cast base address to zero address space (support for BPF arenas).
18+
// cast base address to zero address space (support for BPF address spaces).
1919
//
2020
//===----------------------------------------------------------------------===//
2121

@@ -482,15 +482,15 @@ static void aspaceWrapOperand(DenseMap<Value *, Value *> &Cache, Instruction *I,
482482
}
483483
}
484484

485-
// Support for BPF arenas:
485+
// Support for BPF address spaces:
486486
// - for each function in the module M, update pointer operand of
487487
// each memory access instruction (load/store/cmpxchg/atomicrmw)
488488
// by casting it from non-zero address space to zero address space, e.g:
489489
//
490490
// (load (ptr addrspace (N) %p) ...)
491491
// -> (load (addrspacecast ptr addrspace (N) %p to ptr))
492492
//
493-
// - assign section with name .arena.N for globals defined in
493+
// - assign section with name .addr_space.N for globals defined in
494494
// non-zero address space N
495495
bool BPFCheckAndAdjustIR::insertASpaceCasts(Module &M) {
496496
bool Changed = false;
@@ -517,13 +517,13 @@ bool BPFCheckAndAdjustIR::insertASpaceCasts(Module &M) {
517517
Changed |= !CastsCache.empty();
518518
}
519519
// Merge all globals within same address space into single
520-
// .arena.<addr space no> section
520+
// .addr_space.<addr space no> section
521521
for (GlobalVariable &G : M.globals()) {
522522
if (G.getAddressSpace() == 0 || G.hasSection())
523523
continue;
524524
SmallString<16> SecName;
525525
raw_svector_ostream OS(SecName);
526-
OS << ".arena." << G.getAddressSpace();
526+
OS << ".addr_space." << G.getAddressSpace();
527527
G.setSection(SecName);
528528
// Prevent having separate section for constants
529529
G.setConstant(false);

llvm/test/CodeGen/BPF/addr-space-globals.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
; Verify that a,b,c reside in the same section
2020

21-
; CHECK: .section .arena.272,"aw",@progbits
21+
; CHECK: .section .addr_space.272,"aw",@progbits
2222
; CHECK-NOT: .section
2323
; CHECK: .globl a
2424
; CHECK: .ascii "\001\002"

llvm/test/CodeGen/BPF/addr-space-globals2.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
; Verify that a,b reside in separate sections
1616

17-
; CHECK: .section .arena.1,"aw",@progbits
17+
; CHECK: .section .addr_space.1,"aw",@progbits
1818
; CHECK-NOT: .section
1919
; CHECK: .globl a
2020
; CHECK: .ascii "\001\002"
2121

22-
; CHECK: .section .arena.2,"aw",@progbits
22+
; CHECK: .section .addr_space.2,"aw",@progbits
2323
; CHECK-NOT: .section
2424
; CHECK: .globl b
2525
; CHECK: .ascii "\003\004"

0 commit comments

Comments
 (0)