Skip to content

Commit

Permalink
Rename lookup_variant to lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 30, 2021
1 parent 4b6d20d commit 463a88e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions cranelift/codegen/src/isa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ macro_rules! isa_builder {
}};
}

/// Look for an ISA for the given `triple`, selecting the backend variant given
/// by `variant` if available.
pub fn lookup_variant(triple: Triple) -> Result<Builder, LookupError> {
/// Look for an ISA for the given `triple`.
/// Return a builder that can create a corresponding `TargetIsa`.
pub fn lookup(triple: Triple) -> Result<Builder, LookupError> {
match triple.architecture {
Architecture::X86_64 => {
isa_builder!(x64, (feature = "x86"), triple)
Expand All @@ -125,12 +125,6 @@ pub fn lookup_variant(triple: Triple) -> Result<Builder, LookupError> {
}
}

/// Look for an ISA for the given `triple`.
/// Return a builder that can create a corresponding `TargetIsa`.
pub fn lookup(triple: Triple) -> Result<Builder, LookupError> {
lookup_variant(triple)
}

/// Look for a supported ISA with the given `name`.
/// Return a builder that can create a corresponding `TargetIsa`.
pub fn lookup_by_name(name: &str) -> Result<Builder, LookupError> {
Expand Down
2 changes: 1 addition & 1 deletion cranelift/native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn builder() -> Result<isa::Builder, &'static str> {
/// useful when more than oen backend exists for a given target
/// (e.g., on x86-64).
pub fn builder_with_options(infer_native_flags: bool) -> Result<isa::Builder, &'static str> {
let mut isa_builder = isa::lookup_variant(Triple::host()).map_err(|err| match err {
let mut isa_builder = isa::lookup(Triple::host()).map_err(|err| match err {
isa::LookupError::SupportDisabled => "support for architecture disabled at compile time",
isa::LookupError::Unsupported => "unsupported architecture",
})?;
Expand Down
2 changes: 1 addition & 1 deletion cranelift/reader/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl<'a> Parser<'a> {
Ok(triple) => triple,
Err(err) => return err!(loc, err),
};
let mut isa_builder = match isa::lookup_variant(triple) {
let mut isa_builder = match isa::lookup(triple) {
Err(isa::LookupError::SupportDisabled) => {
continue;
}
Expand Down

0 comments on commit 463a88e

Please sign in to comment.