@@ -94,6 +94,36 @@ $ ./build/$TRIPLE/llvm/bin/llvm-extract \
9494 > extracted.ll
9595```
9696
97+ ### Getting help and asking questions
98+
99+ If you have some questions, head over to the [ rust-lang Zulip] and
100+ specifically the ` #t-compiler/wg-llvm ` stream.
101+
102+ [ rust-lang Zulip ] : https://rust-lang.zulipchat.com/
103+
104+ ### Compiler options to know and love
105+
106+ The ` -Chelp ` and ` -Zhelp ` compiler switches will list out a variety
107+ of interesting options you may find useful. Here are a few of the most
108+ common that pertain to LLVM development (some of them are employed in the
109+ tutorial above):
110+
111+ - The ` --emit llvm-ir ` option emits a ` <filename>.ll ` file with LLVM IR in textual format
112+ - The ` --emit llvm-bc ` option emits in bytecode format (` <filename>.bc ` )
113+ - Passing ` -Cllvm-arg=<foo> ` allows passing pretty much all the
114+ options that tools like llc and opt would accept;
115+ e.g. ` -Cllvm-arg=-print-before-all ` to print IR before every LLVM
116+ pass.
117+ - The ` -Cno-prepopulate-passes ` will avoid pre-populate the LLVM pass
118+ manager with a list of passes. This will allow you to view the LLVM
119+ IR that rustc generates, not the LLVM IR after optimizations.
120+ - The ` -Cpasses=val ` option allows you to supply a (space seprated) list of extra LLVM passes to run
121+ - The ` -Csave-temps ` option saves all temporary output files during compilation
122+ - The ` -Zprint-llvm-passes ` option will print out LLVM optimization passes being run
123+ - The ` -Ztime-llvm-passes ` option measures the time of each LLVM pass
124+ - The ` -Zverify-llvm-ir ` option will verify the LLVM IR for correctness
125+ - The ` -Zno-parallel-llvm ` will disable parallel compilation of distinct compilation units
126+
97127### Filing LLVM bug reports
98128
99129When filing an LLVM bug report, you will probably want some sort of minimal
@@ -119,4 +149,18 @@ create a minimal working example with Godbolt. Go to
119149 optimizations transform it.
120150
1211515 . Once you have a godbolt link demonstrating the issue, it is pretty easy to
122- fill in an LLVM bug.
152+ fill in an LLVM bug. Just visit [ bugs.llvm.org] ( https://bugs.llvm.org/ ) .
153+
154+ ### Porting bug fixes from LLVM
155+
156+ Once you've identified the bug as an LLVM bug, you will sometimes
157+ find that it has already been reported and fixed in LLVM, but we haven't
158+ gotten the fix yet (or perhaps you are familiar enough with LLVM to fix it yourself).
159+
160+ In that case, we can sometimes opt to port the fix for the bug
161+ directly to our own LLVM fork, so that rustc can use it more easily.
162+ Our fork of LLVM is maintained in [ rust-lang/llvm-project] . Once
163+ you've landed the fix there, you'll also need to land a PR modifying
164+ our submodule commits -- ask around on Zulip for help.
165+
166+ [ rust-lang/llvm-project ] : https://github.com/rust-lang/llvm-project/
0 commit comments