Matthias Braun via llvm-dev
2017-Feb-16 22:32 UTC
[llvm-dev] Print Register Liveness Information
Note that this only works for targets that say TargetRegisterInfo::trackLivenessAfterRegAlloc()== true.> On Feb 16, 2017, at 1:21 PM, Quentin Colombet via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi Anitha, > > The liveness information is usually dropped after regalloc. > Therefore the short answer is no, this information is not available before producing assembly. > > However, we have the live-ins and you can request the kill flag to be set. From both this information, you can recompute the liveness. > I’d suggest you use the LivePhysReg helper class and use its result to annotate your assembly (emitComment or something along those lines). > > Cheers, > -Quentin >> On Feb 16, 2017, at 12:46 PM, Anitha B Gollamudi via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hi, >> >> Is there a way to print the register liveness information into the assembly file or as some intermediate listing? >> To be more precise, I am looking at figuring out the following information in an assembly file/listing. >> >> Say, for simplicity, our register set is only { rsp, rbp, eax } >> >> >> subq $16, %rsp // rsp is killed here, eax and rbp are live >> movl $0, -4(%rbp) // rbp is killed here, rsp and eax are live >> xorl %eax, %eax // eax is killed here, rsp and rbp are live >> movl $1, %eax // eax is killed here, rsp and rbp are live >> >> Is there a way LLVM stores this information somewhere before producing assembly? >> I haven't dug into the source code yet, but intuitively the information must be there and hence maybe some pass dumps that info? >> >> Thanks! >> >> Anitha >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20170216/954076ce/attachment.html>
Quentin Colombet via llvm-dev
2017-Feb-16 22:48 UTC
[llvm-dev] Print Register Liveness Information
Good point! Additionally this might gets invalidated by some passes (look for MachineRegisterInfo::invalidateLiveness)> On Feb 16, 2017, at 2:32 PM, Matthias Braun <mbraun at apple.com> wrote: > > Note that this only works for targets that say TargetRegisterInfo::trackLivenessAfterRegAlloc()== true. > >> On Feb 16, 2017, at 1:21 PM, Quentin Colombet via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hi Anitha, >> >> The liveness information is usually dropped after regalloc. >> Therefore the short answer is no, this information is not available before producing assembly. >> >> However, we have the live-ins and you can request the kill flag to be set. From both this information, you can recompute the liveness. >> I’d suggest you use the LivePhysReg helper class and use its result to annotate your assembly (emitComment or something along those lines). >> >> Cheers, >> -Quentin >>> On Feb 16, 2017, at 12:46 PM, Anitha B Gollamudi via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >>> >>> Hi, >>> >>> Is there a way to print the register liveness information into the assembly file or as some intermediate listing? >>> To be more precise, I am looking at figuring out the following information in an assembly file/listing. >>> >>> Say, for simplicity, our register set is only { rsp, rbp, eax } >>> >>> >>> subq $16, %rsp // rsp is killed here, eax and rbp are live >>> movl $0, -4(%rbp) // rbp is killed here, rsp and eax are live >>> xorl %eax, %eax // eax is killed here, rsp and rbp are live >>> movl $1, %eax // eax is killed here, rsp and rbp are live >>> >>> Is there a way LLVM stores this information somewhere before producing assembly? >>> I haven't dug into the source code yet, but intuitively the information must be there and hence maybe some pass dumps that info? >>> >>> Thanks! >>> >>> Anitha >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://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/20170216/4924649d/attachment.html>
Anitha B Gollamudi via llvm-dev
2017-Feb-17 14:30 UTC
[llvm-dev] Print Register Liveness Information
On 16 February 2017 at 17:48, Quentin Colombet <qcolombet at apple.com> wrote:> > Good point! > Additionally this might gets invalidated by some passes (look for MachineRegisterInfo::invalidateLiveness)Thanks for the pointers! What is the rational behind invalidating register liveness info? Does it consume lot of memory during compilation? -Anitha> > On Feb 16, 2017, at 2:32 PM, Matthias Braun <mbraun at apple.com> wrote: > > Note that this only works for targets that say TargetRegisterInfo::trackLivenessAfterRegAlloc()== true. > > On Feb 16, 2017, at 1:21 PM, Quentin Colombet via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi Anitha, > > The liveness information is usually dropped after regalloc. > Therefore the short answer is no, this information is not available before producing assembly. > > However, we have the live-ins and you can request the kill flag to be set. From both this information, you can recompute the liveness. > I’d suggest you use the LivePhysReg helper class and use its result to annotate your assembly (emitComment or something along those lines). > > Cheers, > -Quentin > > On Feb 16, 2017, at 12:46 PM, Anitha B Gollamudi via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > Is there a way to print the register liveness information into the assembly file or as some intermediate listing? > To be more precise, I am looking at figuring out the following information in an assembly file/listing. > > Say, for simplicity, our register set is only { rsp, rbp, eax } > > > subq $16, %rsp // rsp is killed here, eax and rbp are live > movl $0, -4(%rbp) // rbp is killed here, rsp and eax are live > xorl %eax, %eax // eax is killed here, rsp and rbp are live > movl $1, %eax // eax is killed here, rsp and rbp are live > > Is there a way LLVM stores this information somewhere before producing assembly? > I haven't dug into the source code yet, but intuitively the information must be there and hence maybe some pass dumps that info? > > Thanks! > > Anitha > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-- Anitha