Introduce a TargetFrontendConfig type. (#570)
* Introduce a `TargetFrontendConfig` type. `TargetFrontendConfig` is information specific to the target which is provided to frontends to allow them to produce Cranelift IR for the target. Currently this includes the pointer size and the default calling convention. The default calling convention is now inferred from the target, rather than being a setting. cranelift-native is now just a provider of target information, rather than also being a provider of settings, which gives it a clearer role. And instead of having cranelift-frontend routines require the whole `TargetIsa`, just require the `TargetFrontendConfig`, and add a way to get the `TargetFrontendConfig` from a `Module`. Fixes #529. Fixes #555.
This commit is contained in:
@@ -26,8 +26,9 @@ pub struct SimpleJITBuilder {
|
||||
impl SimpleJITBuilder {
|
||||
/// Create a new `SimpleJITBuilder`.
|
||||
pub fn new() -> Self {
|
||||
let (flag_builder, isa_builder) = cranelift_native::builders().unwrap_or_else(|_| {
|
||||
panic!("host machine is not a supported target");
|
||||
let flag_builder = settings::builder();
|
||||
let isa_builder = cranelift_native::builder().unwrap_or_else(|msg| {
|
||||
panic!("host machine is not supported: {}", msg);
|
||||
});
|
||||
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
|
||||
Self::with_isa(isa)
|
||||
|
||||
Reference in New Issue
Block a user