@@ -30,6 +30,8 @@ benefit of all Swift developers.
30
30
- [ Debugging the Compiler using advanced LLDB Breakpoints] ( #debugging-the-compiler-using-advanced-lldb-breakpoints )
31
31
- [ Debugging the Compiler using LLDB Scripts] ( #debugging-the-compiler-using-lldb-scripts )
32
32
- [ Custom LLDB Commands] ( #custom-lldb-commands )
33
+ - [ Debugging at LLVM Level] ( #debugging-at-llvm-level )
34
+ - [ Options for Dumping LLVM IR] ( #options-for-dumping-llvm-ir )
33
35
- [ Bisecting Compiler Errors] ( #bisecting-compiler-errors )
34
36
- [ Bisecting on SIL optimizer pass counts to identify optimizer bugs] ( #bisecting-on-sil-optimizer-pass-counts-to-identify-optimizer-bugs )
35
37
- [ Using git-bisect in the presence of branch forwarding/feature branches] ( #using-git-bisect-in-the-presence-of-branch-forwardingfeature-branches )
@@ -537,6 +539,20 @@ to define custom commands using just other lldb commands. For example,
537
539
538
540
(lldb) command alias cs sequence p/x $rax; stepi
539
541
542
+ ## Debugging at LLVM Level
543
+
544
+ ### Options for Dumping LLVM IR
545
+
546
+ Similar to SIL, one can configure LLVM to dump the llvm-ir at various points in
547
+ the pipeline. Here is a quick summary of the various options:
548
+
549
+ * `` -Xllvm -print-before=$PASS_ID `` : Print the LLVM IR before a specified LLVM pass runs.
550
+ * `` -Xllvm -print-before-all `` : Print the LLVM IR before each pass runs.
551
+ * `` -Xllvm -print-after-all `` : Print the LLVM IR after each pass runs.
552
+ * `` -Xllvm -filter-print-funcs=$FUNC_NAME_1,$FUNC_NAME_2,...,$FUNC_NAME_N `` :
553
+ When printing IR for functions for print-[ before|after] -all options, Only
554
+ print the IR for functions whose name is in this comma separated list.
555
+
540
556
## Bisecting Compiler Errors
541
557
542
558
### Bisecting on SIL optimizer pass counts to identify optimizer bugs
0 commit comments