sun-jacobi / notes

Personal Notes Collection
1 stars 0 forks source link

Useful information for developing LLVM #1

Open sun-jacobi opened 7 months ago

sun-jacobi commented 7 months ago

FYI: https://github.com/sun-jacobi/llvm-script

sun-jacobi commented 7 months ago

Clang debugging

First run the command with -### to get the verbose version of the program. Then simply lldb -- [VERBOSE COMMAND] .

Otherwise the child process created by clang would not be debugged

sun-jacobi commented 7 months ago

llc Debugging

Since llvm uses code generation, it is hard to use debugger with it. it is much more efficient to debug with the output.

Here is some useful options for output useful information.

Code Dump

--print-after-isel: show the result of Instruction Selection <- espescially useful

DAG Dump

-view-dag-combine1-dags -view-legalize-dags -view-dag-combine2-dags -view-isel-dags -view-sched-dags

dump()

Even though debuggers not work with llvm, it is also useful to use debugger to check the local logic. When using debugger, dump() method for many classes is very useful.