https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107844

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-18

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to David Faust from comment #3)
> Thanks for the info Andrew. I'll look at __builtin_offsetof.
> 
> As for the implementation in clang, I can point to some bits relevant to
> the builtin itself:
> llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
>   CodeGenFunction::EmitBPFBuiltinExpr ()
> 
> llvm-project/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
>   BPFAbstractMemberAccess::GetFieldInfo ()
> 
> But I am less familiar with the surrounding machinery such as their
> parsing and type systems..

So I looked (First off I am shocked they don't have target functions to handle
the builtins and every target builtin is handled in that file seems wrong), and
you are handed the AST before folding. This is different from GCC where it is
you are handed it after folding.

So I think we need some special handling in the c (and C++) parser to handle
this. I suspect we want to do the full handling of the builtin
(bpf_core_field_exists) in the parser rather than the macro expanded view of it
too. Similar to how offsetof is handled ...
Of course this will need some modifications to the bpf headers too. And that
solves some other issues too.

Reply via email to