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

how to generate LLVM IR files for a whole project? #28

Closed
meweez opened this issue Mar 15, 2021 · 4 comments
Closed

how to generate LLVM IR files for a whole project? #28

meweez opened this issue Mar 15, 2021 · 4 comments

Comments

@meweez
Copy link

meweez commented Mar 15, 2021

Hello
Thank you for your useful repository.
I have a question about generating .ll files, you used this command:

$LLVM_DIR/bin/clang -S -emit-llvm ../inputs/input_for_hello.c -o input_for_hello.ll

The question is how to generate this for all source files of a project, also each file has some included header files.
for example how to generate LLVM IR for all of the source files in Libgd?
I have tried this way but the result was almost empty:

$LLVM_DIR/clang -emit-llvm -S -O0 src/gd_tiff.c -o src/gd_tiff.ll

Thank you very much.

@banach-space
Copy link
Owner

Hello @peach-byte!

Thank you for using llvm-tutor and for submitting this issue. I think that in order to generate LLVM IR files for a larger project you'd have to tweak the corresponding CMake scripts.

Basically, various files within a project will depend on each other. These dependencies are expressed through the build scripts. So basically you'd want to tweak your scripts so that the compiler runs:

  • clang -S -emit-llvm
    instead of e.g.
  • clang

Does this help in any way?

@banach-space
Copy link
Owner

Closing for now. Please feel free to re-open if you have further questions/comments!

@meweez
Copy link
Author

meweez commented Apr 20, 2021

Thank you, I also found this useful repo in order to generate a whole project llvm IR.

@banach-space
Copy link
Owner

Looks very interesting, thank you for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants