Garnet Liu via llvm-dev
2017-Sep-23 19:16 UTC
[llvm-dev] Adding a function type qualifier with particular keyword
Dear llvm developers, For the purpose of a research project, I want to add a function type modifier as an extension to LLVM that looks like keyword void function(params1, 2, 3) {…} to serve the purpose of tracking all registers that the function has touched. Is there any documentation or previous examples relate to this feature? Thank you very much Garnet -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170923/ee77ced7/attachment.html>
Tim Northover via llvm-dev
2017-Sep-23 19:30 UTC
[llvm-dev] Adding a function type qualifier with particular keyword
> For the purpose of a research project, I want to add a function type > modifier as an extension to LLVM that looks likeDo 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.
Garnet Liu via llvm-dev
2017-Sep-24 04:36 UTC
[llvm-dev] Adding a function type qualifier with particular keyword
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.
Reasonably Related Threads
- Adding a function type qualifier with particular keyword
- [LLVMdev] Wrong type qualifier for this pointer in case of ARM compiled binary
- [LLVMdev] Wrong type qualifier for this pointer in case of ARM compiled binary
- Splitting up Type.h: Good idea, bad idea?
- Slow Access