[llvm-dev] Printing MachineBasicBlock in an order that follows the CFG of the MachineFunction

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Wed May 17 17:11:03 PDT 2017


   Hello.
     Is there a possibility to generate the ASM program with MachineBasicBlocks in an 
order that strictly respects the predecessors of each BasicBlock (BB)?
     I ask because currently there are some cases where actually the BBs are printed in 
the .s file in a somewhat wrong order - for example, 1 BB does not follow immediately 
after its first predecessor although it should.
     I would like to mention I am using LLVM checked out from SVN in Jul 2016, but I guess 
this problem persists in the latest revision.

     I guess I can modify the current implementation to change the order of the BBs as 
they are created in the MachineFunction class, s.t. when we later iterate over the BBs to 
get the right order.
     Would this be a safe change? If not I can generate the right order when LLVM prints 
the ASM file, for example in method EmitFunctionBody().

   Thank you,
     Alex


More information about the llvm-dev mailing list