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

Added a --files option to analyse rustc's --emit=llvm-lines output. #32

Merged
merged 1 commit into from
Oct 3, 2020

Conversation

Julian-Wollersberger
Copy link

@Julian-Wollersberger Julian-Wollersberger commented Oct 3, 2020

Since you can't use cargo-llvm-lines with x.py, I added a --files option, so that I could measure the llvm-lines of rustc itself.

I'm also writing an entry in rustc-dev-guide. Example usage:

RUSTFLAGS="--emit=llvm-ir" ./x.py build --stage 0 compiler/rustc

# Single crate, eg. rustc_middle
cargo llvm-lines --files ./build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/rustc_middle* > llvm-lines-middle.txt
# Whole compiler at once
cargo llvm-lines --files ./build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/*.ll > llvm-lines.txt

I successfully used this in rust-lang/rust#76680.

Comment on lines +54 to +55
/// Analyze .ll files that were produced by eg. `RUSTFLAGS="--emit=llvm-ir" ./x.py build --stage 0 compiler/rustc`.
/// Supports globs, eg `./build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/*.ll`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a little more complicated of an example than you need to give in public docs. It's better suited for rustc-dev-guide IMO.

Suggested change
/// Analyze .ll files that were produced by eg. `RUSTFLAGS="--emit=llvm-ir" ./x.py build --stage 0 compiler/rustc`.
/// Supports globs, eg `./build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/*.ll`
/// Analyze .ll files produced by `RUSTFLAGS="--emit=llvm-ir"`.
///
/// Supports globs, e.g. `./build/debug/deps/*.ll`

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in #33.

@@ -50,6 +51,17 @@ enum Opt {
)]
sort: SortOrder,

/// Analyze .ll files that were produced by eg. `RUSTFLAGS="--emit=llvm-ir" ./x.py build --stage 0 compiler/rustc`.
/// Supports globs, eg `./build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/debug/deps/*.ll`
// zsh substitutes the glob with a list of files, therefore this needs to be a Vec.
Copy link

@jyn514 jyn514 Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to both support globs and multiple files? It seems easier to let the shell expand the glob instead (and means less dependencies for llvm-lines).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in #33 to leave globbing to the shell.

@@ -50,6 +51,17 @@ enum Opt {
)]
sort: SortOrder,

/// Analyze .ll files that were produced by eg. `RUSTFLAGS="--emit=llvm-ir" ./x.py build --stage 0 compiler/rustc`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should mention that it ignores files that don't end in .ll, I would not expect that behavior. Maybe it shouldn't ignore them?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in #33 to not ignore any files.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Julian-Wollersberger
Copy link
Author

Thanks for addressing the review!

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

Successfully merging this pull request may close these issues.

3 participants