Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useful information for developing LLVM #1

Open
sun-jacobi opened this issue Nov 6, 2023 · 2 comments
Open

Useful information for developing LLVM #1

sun-jacobi opened this issue Nov 6, 2023 · 2 comments

Comments

@sun-jacobi
Copy link
Owner

sun-jacobi commented Nov 6, 2023

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

@sun-jacobi
Copy link
Owner Author

sun-jacobi commented Nov 6, 2023

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
Copy link
Owner Author

sun-jacobi commented Nov 9, 2023

llc Debugging

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

Here are some useful options for dumping useful information.

Code Dump

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

DAG Dump

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

dump()

You still can use a debugger to check the local logic.
When using a debugger, dump() method for many classes is very useful.

@sun-jacobi sun-jacobi self-assigned this Apr 14, 2024
@sun-jacobi sun-jacobi changed the title Small tips on LLVM development Useful information for developing LLVM Apr 17, 2024
@sun-jacobi sun-jacobi removed their assignment Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant