[PATCH] D109560: BPF: change BTF_KIND_TAG format

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 18:41:22 PDT 2021


yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added a subscriber: hiraditya.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Previously we have the following binary representation:

  struct bpf_type { name, info, type }
  struct btf_tag { __u32 component_idx; }

If the tag points to a struct/union/var/func type, we will have

  kflag = 1, component_idx = 0 

if the tag points to struct/union member or func argument, we will have

  kflag = 0, component_idx = 0, ..., vlen - 1 

The above rather makes interface complex to have both kflag and 
component needed to determine its legality and index.

This patch simplifies the interface by removing kflag involvement.

  component_idx = (u32)-1 : tag pointing to a type
  component_idx = 0 ... vlen - 1 : tag pointing to a member or argument

and kflag is always 0 and there is no need to check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109560

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/test/CodeGen/BPF/BTF/tag-1.ll
  llvm/test/CodeGen/BPF/BTF/tag-2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109560.371763.patch
Type: text/x-patch
Size: 5175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210910/3e79d596/attachment.bin>


More information about the llvm-commits mailing list