Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/tools/tidy/src/target_specific_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ use crate::walk::filter_not_rust;
const LLVM_COMPONENTS_HEADER: &str = "needs-llvm-components:";
const COMPILE_FLAGS_HEADER: &str = "compile-flags:";

const KNOWN_LLVM_COMPONENTS: &[&str] = &[
"aarch64",
"arm",
"avr",
"bpf",
"hexagon",
"loongarch",
"m68k",
"mips",
"msp430",
"nvptx",
"powerpc",
"riscv",
"sparc",
"systemz",
"webassembly",
"x86",
];
Comment on lines +13 to +30
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered invoking llvm-config --components to get this list, but I think that would be a bit awkward to do within tidy.

I think hardcoding it is fine. It should be very rare that this needs to be changed--only when adding support for a brand new architecture.

Copy link
Member

Choose a reason for hiding this comment

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

It would mean tidy fails if it can't run llvm-config, and I'm not sure we actually haul that binary around...

Copy link
Member

Choose a reason for hiding this comment

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

Would be good to give people some guidance on how to figure out the correct current list.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW this works for me

build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-config --components

but it lists a lot more than this PR.

Copy link
Member

Choose a reason for hiding this comment

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

many of them are actually the same thing, like this:

  • hexagon
  • hexagonasmparser
  • hexagoncodegen
  • hexagondesc
  • hexagondisassembler
  • hexagoninfo

for our purposes we only really care about having "hexagon"


#[derive(Default, Debug)]
struct RevisionInfo<'a> {
target_arch: Option<&'a str>,
Expand Down Expand Up @@ -68,6 +87,17 @@ pub fn check(path: &Path, bad: &mut bool) {
// gathered.
}
}
if let Some(llvm_components) = llvm_components {
for component in llvm_components {
if !KNOWN_LLVM_COMPONENTS.contains(component) {
eprintln!(
"{}: revision {} specifies unknown LLVM component `{}`",
file, rev, component
);
*bad = true;
}
}
}
}
});
}