[llvm-dev] Adding a function type qualifier with particular keyword

Garnet Liu via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 23 21:36:17 PDT 2017


Thanks a lot for the reply! I looked into the function attributes description in the references and I believe it’s a great approach, which hits the point directly, but so far my mentor asks me to make it as a function type and it’s for C. So I’m looking into both ways.
If I need add the function type modifier keyword, should it be in the Qualtype class? 

Thanks,
Garnet

> On Sep 23, 2017, at 3:30 PM, Tim Northover <t.p.northover at gmail.com> wrote:
> 
>> For the purpose of a research project, I want to add a function type
>> modifier as an extension to LLVM that looks like
> 
> Do you really need it to be part of the function's type? That brings
> massive extra complexity, especially when C++ and its overloading
> rules are involved.
> 
> Modifying a function's definition is a lot simpler. At the C/C++ level
> you'd add a custom "__attribute__((whatever))", of which plenty
> already exist. Since this records register usage Clang should probably
> just add an LLVM function attribute saying the same thing. Then each
> backend you want to support should look for that LLVM attribute, tot
> up the registers just before emission and save them somewhere (a
> separate section of the .o file?).
> 
> Basically you'd want some limited Clang support for forwarding a new
> attribute, and a new LLVM backend pass in each target you supported to
> save the correct info if needed.
> 
> Cheers.
> 
> Tim.




More information about the llvm-dev mailing list