[llvm-commits] patch for printing machine instrs after a specified pass

Bin Zeng bzeng at apple.com
Tue May 29 10:46:16 PDT 2012


On May 29, 2012, at 9:32 AM, Chad Rosier wrote:

> Bin,
> For this test case:
> +; RUN: llc < %s -O3 -print-machineinstrs=branch-folder -o /dev/null |& FileCheck %s
> 
> What is the associated CHECK for this test?  I think you could add a more complex check to ensure the machine instrs is being printed directly after the branch folder pass.  It probably involves using the -debug-pass=Structure option.
> 

That is much better. I added a couple more checks to make sure that machine instrs are printed after the specified pass such as branch-folder. For the case when machine instrs are printed after all the passes, it seems not easy to check that. 

> +static cl::opt<std::string>
> +PrintMachineInstrs("print-machineinstrs",
> +                   cl::ValueOptional,
> +                   cl::desc("Print machine instrs"),
> +                   cl::value_desc("pass-name"),
> +                   cl::init("option-unspecified"));
> 
> Please maximize the horizontal space by only starting a new line when necessary (i.e., to prevent an 80-column violation).
> 

Thanks. The indentation has been changed. 

> +  else if (!StringRef(PrintMachineInstrs.getValue()).equals("option-unspecified")){
> 
> 80-column violation.  There should also be a space between the right most parentheses and the left brace.
> 
> Chad
> 

Thanks! Good eyes! A space has been added between ) and { and added a line to the .emacs file so that it highlights the lines with 
80-column violation in case I missed them.

> 
> On May 25, 2012, at 5:51 PM, Bin Zeng wrote:
> 
>> Hi all,
>> 
>> My name is Bin Zeng and an intern working on a project to serialize MachineInstrs 
>> in the backend. This patch adds a insertPass API to insert a pass before each instance
>> of another pass and enhances the existing -print-machineinstrs so that the MachineInstrs
>> after a specific pass can be printed. For instance, to print the MachineInstrs after branch-folder
>> pass, you can do: $llc -O3 -print-machineinstrs=branch-folder filename.bc -o filename.s 
>> Also, the command line option is back compatible. You can dump MachineInstrs after all
>> the passes. 
>> 
>> <patch-0.8>
>> 
>> Thanks for reading. 
>> -Bin
> 




More information about the llvm-commits mailing list