Quentin Colombet
2014-Feb-19 17:35 UTC
[LLVMdev] How to implement register allocation constraints to guide allocator dispatching different registers for certain instruction?
Hi Kevin, I concur Tim’s advice, you should use the @earlyclobber. Cheers, -Quentin On Feb 19, 2014, at 3:27 AM, Tim Northover <t.p.northover at gmail.com> wrote:> Hi Kevin, > >> I suppose to add some extra rules on register allocator to avoid it >> allocating register causing any unpredictable behavior, but I don't have >> experience to this part. Can anybody tell me how to implement this or have >> better ideas to solve this problem? Thanks in advance. > > I think this is what the "@earlyclobber" constraint is for: if you > mark the status output register as @earlyclobber then LLVM will think > it gets written early on during the instruction (i.e. before the CPU > would get a chance to read the other two) and make sure it gets > allocated to a different register. > > Cheers. > > Tim. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Kevin Qin
2014-Feb-20 11:24 UTC
[LLVMdev] How to implement register allocation constraints to guide allocator dispatching different registers for certain instruction?
Hi Tim and Quentin, Thanks a lot for your help. This solution is quite simple and works well! Patch is in http://llvm-reviews.chandlerc.com/D2844, please review:) 2014-02-20 1:35 GMT+08:00 Quentin Colombet <qcolombet at apple.com>:> Hi Kevin, > > I concur Tim's advice, you should use the @earlyclobber. > > Cheers, > -Quentin > > On Feb 19, 2014, at 3:27 AM, Tim Northover <t.p.northover at gmail.com> > wrote: > > > Hi Kevin, > > > >> I suppose to add some extra rules on register allocator to avoid it > >> allocating register causing any unpredictable behavior, but I don't have > >> experience to this part. Can anybody tell me how to implement this or > have > >> better ideas to solve this problem? Thanks in advance. > > > > I think this is what the "@earlyclobber" constraint is for: if you > > mark the status output register as @earlyclobber then LLVM will think > > it gets written early on during the instruction (i.e. before the CPU > > would get a chance to read the other two) and make sure it gets > > allocated to a different register. > > > > Cheers. > > > > Tim. > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- Best Regards, Kevin Qin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140220/1db63825/attachment.html>
hdwivedi at codeaurora.org
2014-Feb-20 14:25 UTC
[LLVMdev] Running opt pass at compile time
Hi, To generate a call graph for a file(say foo.c), I can do: clang -S -emit-llvm foo.c -o - | opt -analyze -dot-callgraph However with this approach I have to run this command and pipe to opt every single time I need to generate a callgraph. For a project with many files and a complex build system, it would be preferable for me to be able to invoke this transform as part of normal build process by the use of some clang flag. Can I do something like: clang -run-dot-callgraph-transform-flag foo.c ? This would allow me to just modify the CFLAGS in Makefile and get results as part of normal build process? If this can't be done with stock clang, what can I modify in llvm source to get something like this? Thanks, Harsh