Daniel M Gessel
2009-Apr-13 18:20 UTC
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
For nefarious reasons I won't go into (this is for a quick hack that will be thrown away in a week or two), I'd like my Asm printer to get MBBs in a depth first order. Is there an existing pass or function that will let me do this easily? Thanks, Dan
Villmow, Micah
2009-Apr-13 18:32 UTC
[LLVMdev] Depth First Sort of Machine Basic Blocks just beforeemitting code
Dan, I was not able to find a simple way to do this outside of writing my own DFS traversal using the succ nodes. Micah -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Daniel M Gessel Sent: Monday, April 13, 2009 11:20 AM To: LLVM Developers Mailing List Subject: [LLVMdev] Depth First Sort of Machine Basic Blocks just beforeemitting code For nefarious reasons I won't go into (this is for a quick hack that will be thrown away in a week or two), I'd like my Asm printer to get MBBs in a depth first order. Is there an existing pass or function that will let me do this easily? Thanks, Dan _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chris Lattner
2009-Apr-13 18:35 UTC
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
On Apr 13, 2009, at 11:20 AM, Daniel M Gessel wrote:> For nefarious reasons I won't go into (this is for a quick hack that > will be thrown away in a week or two), I'd like my Asm printer to get > MBBs in a depth first order. > > Is there an existing pass or function that will let me do this easily?Check out "llvm/ADT/DepthFirstIterator.h", it lets you iterate over arbitrary graphs (including CFGs) in depth first order. grep the source base for df_begin etc to see examples of use. -Chris
Daniel M Gessel
2009-Apr-13 23:40 UTC
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
That looks like it does a preorder depth first traversal (I think). I'm looking for postorder. Is there a trivial transform between the two? (I don't know one.) Am I wrong about the preorder/postorder? If not, anything lurking for postorder traversal? Thanks, Dan On Apr 13, 2009, at 2:35 PM, Chris Lattner wrote:> > On Apr 13, 2009, at 11:20 AM, Daniel M Gessel wrote: > >> For nefarious reasons I won't go into (this is for a quick hack that >> will be thrown away in a week or two), I'd like my Asm printer to get >> MBBs in a depth first order. >> >> Is there an existing pass or function that will let me do this >> easily? > > Check out "llvm/ADT/DepthFirstIterator.h", it lets you iterate over > arbitrary graphs (including CFGs) in depth first order. grep the > source base for df_begin etc to see examples of use. > > -Chris > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reasonably Related Threads
- [LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
- [LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
- [LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
- [LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
- `dendrapply` Enhancements