[all-commits] [llvm/llvm-project] e52617: BPF: change BTF_KIND_TAG format

yonghong-song via All-commits all-commits at lists.llvm.org
Thu Sep 9 19:05:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e52617c31de1171c208b7ba0bb96520b78d130b3
      https://github.com/llvm/llvm-project/commit/e52617c31de1171c208b7ba0bb96520b78d130b3
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-09-09 (Thu, 09 Sep 2021)

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

  Log Message:
  -----------
  BPF: change BTF_KIND_TAG format

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.

Differential Revision: https://reviews.llvm.org/D109560




More information about the All-commits mailing list