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

Chad Rosier mcrosier at apple.com
Tue May 29 09:32:26 PDT 2012


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.

+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).

+  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


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