This is an archive of the discontinued LLVM Phabricator instance.

BPF: change btf_type_tag BTF output format

Authored by yonghong-song on Nov 9 2021, 10:04 AM.



For the declaration like below:

int __tag1 * __tag1 __tag2 *g

Commit 41860e602aaa ("BPF: Support btf_type_tag attribute")
implemented the following encoding:

VAR(g) -> __tag1 --> __tag2 -> pointer -> __tag1 -> pointer -> int

Some further experiments with linux btf_type_tag support, esp.
with generating attributes in vmlinux.h, and also some internal
discussion showed the following format is more desirable:

VAR(g) -> pointer -> __tag2 -> __tag1 -> pointer -> __tag1 -> int

The format makes it similar to other modifier like 'const', e.g.,

const int *g

which has encoding VAR(g) -> PTR -> CONST -> int

Diff Detail

Event Timeline

yonghong-song created this revision.Nov 9 2021, 10:04 AM
yonghong-song requested review of this revision.Nov 9 2021, 10:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 10:04 AM
ast accepted this revision.Nov 9 2021, 10:23 AM
This revision is now accepted and ready to land.Nov 9 2021, 10:23 AM
This revision was landed with ongoing or failed builds.Nov 9 2021, 11:35 AM
This revision was automatically updated to reflect the committed changes.