Hello all, In my project, I need to allocate an extra 4 Bytes in every Alloca instruction. These additional bytes will be used to store the 'allocation info'(like size and structure of the allocated object etc). Instead of adding 4 bytes to the Alloca 'size' operand at every Alloca Instruction, I was thinking to make this change at the level where Alloca gets converted to machine IR. Can anyone please point me towards the code which actually handles this conversion(lowering of Alloca Inst)? -- Regards, Udit kumar agarwal -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200127/b8b8fd55/attachment.html>
Alberto Barbaro via llvm-dev
2020-Jan-27 13:35 UTC
[llvm-dev] Custom Alloca implementation
Hello Udit, I'm not sure but can't you achieve the same just using metadata avoiding to change the alloca instruction? Thanks Alberto On Mon, Jan 27, 2020, 12:09 Udit agarwal via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello all, > > In my project, I need to allocate an extra 4 Bytes in every Alloca > instruction. These additional bytes will be used to store the 'allocation > info'(like size and structure of the allocated object etc). Instead of > adding 4 bytes to the Alloca 'size' operand at every Alloca Instruction, I > was thinking to make this change at the level where Alloca gets converted > to machine IR. > Can anyone please point me towards the code which actually handles this > conversion(lowering of Alloca Inst)? > -- > Regards, > Udit kumar agarwal > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200127/fe83ef97/attachment.html>
---Adding llvm-dev list to CC--- Hi Alberto, Thanks for your prompt reply. Actually, I need this information(about total allocation size and object structure) on runtime, so that is why I was planning to encode this info and store it in the memory itself. Regards, Udit On Mon, Jan 27, 2020 at 7:05 PM Alberto Barbaro <barbaro.alberto at gmail.com> wrote:> Hello Udit, > I'm not sure but can't you achieve the same just using metadata avoiding > to change the alloca instruction? > > Thanks > Alberto > > On Mon, Jan 27, 2020, 12:09 Udit agarwal via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello all, >> >> In my project, I need to allocate an extra 4 Bytes in every Alloca >> instruction. These additional bytes will be used to store the 'allocation >> info'(like size and structure of the allocated object etc). Instead of >> adding 4 bytes to the Alloca 'size' operand at every Alloca Instruction, I >> was thinking to make this change at the level where Alloca gets converted >> to machine IR. >> Can anyone please point me towards the code which actually handles this >> conversion(lowering of Alloca Inst)? >> -- >> Regards, >> Udit kumar agarwal >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-- Regards, Udit kumar agarwal http://uditagarwal.in/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200127/43717fde/attachment.html>