2020-08-28 05:10:48 -05:00
|
|
|
#![feature(
|
|
|
|
rustc_private,
|
|
|
|
decl_macro,
|
|
|
|
type_alias_impl_trait,
|
|
|
|
associated_type_bounds,
|
|
|
|
never_type,
|
2020-09-15 14:00:04 -05:00
|
|
|
try_blocks,
|
2020-09-16 09:58:58 -05:00
|
|
|
hash_drain_filter
|
2020-08-28 05:10:48 -05:00
|
|
|
)]
|
2020-04-05 06:48:26 -05:00
|
|
|
#![warn(rust_2018_idioms)]
|
|
|
|
#![warn(unused_lifetimes)]
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2020-07-09 07:23:00 -05:00
|
|
|
#[cfg(feature = "jit")]
|
2020-01-18 05:43:31 -06:00
|
|
|
extern crate libc;
|
2020-09-05 04:00:34 -05:00
|
|
|
extern crate snap;
|
2020-08-20 09:51:01 -05:00
|
|
|
#[macro_use]
|
2020-03-31 06:20:19 -05:00
|
|
|
extern crate rustc_middle;
|
2020-08-28 05:10:48 -05:00
|
|
|
extern crate rustc_ast;
|
2018-11-24 04:23:49 -06:00
|
|
|
extern crate rustc_codegen_ssa;
|
2018-11-24 05:47:53 -06:00
|
|
|
extern crate rustc_data_structures;
|
2020-04-03 04:54:18 -05:00
|
|
|
extern crate rustc_errors;
|
2018-11-24 05:47:53 -06:00
|
|
|
extern crate rustc_fs_util;
|
2020-01-09 10:43:10 -06:00
|
|
|
extern crate rustc_hir;
|
2018-06-17 11:05:11 -05:00
|
|
|
extern crate rustc_incremental;
|
2019-10-03 10:22:01 -05:00
|
|
|
extern crate rustc_index;
|
2019-12-31 09:43:24 -06:00
|
|
|
extern crate rustc_session;
|
2020-01-06 13:11:03 -06:00
|
|
|
extern crate rustc_span;
|
2020-03-24 07:09:44 -05:00
|
|
|
extern crate rustc_symbol_mangling;
|
2018-07-31 05:25:16 -05:00
|
|
|
extern crate rustc_target;
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2020-04-05 06:48:26 -05:00
|
|
|
// This prevents duplicating functions and statics that are already part of the host rustc process.
|
|
|
|
#[allow(unused_extern_crates)]
|
|
|
|
extern crate rustc_driver;
|
|
|
|
|
2018-07-23 04:17:39 -05:00
|
|
|
use std::any::Any;
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2020-08-28 05:10:48 -05:00
|
|
|
use rustc_codegen_ssa::traits::CodegenBackend;
|
|
|
|
use rustc_codegen_ssa::CodegenResults;
|
2020-04-03 04:54:18 -05:00
|
|
|
use rustc_errors::ErrorReported;
|
2020-03-31 06:20:19 -05:00
|
|
|
use rustc_middle::dep_graph::{DepGraph, WorkProduct, WorkProductId};
|
|
|
|
use rustc_middle::middle::cstore::{EncodedMetadata, MetadataLoader};
|
|
|
|
use rustc_middle::ty::query::Providers;
|
2020-08-28 05:10:48 -05:00
|
|
|
use rustc_session::config::OutputFilenames;
|
|
|
|
use rustc_session::Session;
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2020-06-20 11:44:49 -05:00
|
|
|
use cranelift_codegen::settings::{self, Configurable};
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2018-11-10 08:12:00 -06:00
|
|
|
use crate::constant::ConstantCx;
|
|
|
|
use crate::prelude::*;
|
|
|
|
|
2018-07-19 12:33:42 -05:00
|
|
|
mod abi;
|
2018-11-05 11:29:15 -06:00
|
|
|
mod allocator;
|
2018-08-09 03:46:56 -05:00
|
|
|
mod analyze;
|
2018-11-09 11:38:30 -06:00
|
|
|
mod archive;
|
2020-01-18 05:43:31 -06:00
|
|
|
mod atomic_shim;
|
2019-10-16 13:48:09 -05:00
|
|
|
mod backend;
|
2020-08-28 05:10:48 -05:00
|
|
|
mod base;
|
2019-07-31 02:45:11 -05:00
|
|
|
mod cast;
|
2019-07-07 11:08:38 -05:00
|
|
|
mod codegen_i128;
|
2018-06-22 12:18:53 -05:00
|
|
|
mod common;
|
2018-07-31 05:25:16 -05:00
|
|
|
mod constant;
|
2019-01-17 11:07:27 -06:00
|
|
|
mod debuginfo;
|
2019-08-14 05:01:41 -05:00
|
|
|
mod discriminant;
|
2019-05-04 09:54:25 -05:00
|
|
|
mod driver;
|
2020-07-10 07:45:45 -05:00
|
|
|
mod inline_asm;
|
2018-10-03 11:21:52 -05:00
|
|
|
mod intrinsics;
|
2019-03-11 14:36:29 -05:00
|
|
|
mod linkage;
|
2018-10-20 11:41:26 -05:00
|
|
|
mod main_shim;
|
2018-08-15 05:07:08 -05:00
|
|
|
mod metadata;
|
2019-08-14 04:52:39 -05:00
|
|
|
mod num;
|
2019-12-26 06:37:10 -06:00
|
|
|
mod optimize;
|
2019-12-20 09:02:47 -06:00
|
|
|
mod pointer;
|
2018-08-15 07:45:32 -05:00
|
|
|
mod pretty_clif;
|
2020-07-09 11:55:46 -05:00
|
|
|
mod toolchain;
|
2018-11-16 10:35:47 -06:00
|
|
|
mod trap;
|
2018-12-29 08:33:34 -06:00
|
|
|
mod unsize;
|
2019-06-11 08:43:22 -05:00
|
|
|
mod value_and_place;
|
2018-09-08 11:00:06 -05:00
|
|
|
mod vtable;
|
2018-06-17 11:05:11 -05:00
|
|
|
|
|
|
|
mod prelude {
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use std::convert::{TryFrom, TryInto};
|
|
|
|
|
|
|
|
pub(crate) use rustc_ast::ast::{FloatTy, IntTy, UintTy};
|
|
|
|
pub(crate) use rustc_span::Span;
|
|
|
|
|
|
|
|
pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
2020-08-28 05:10:48 -05:00
|
|
|
pub(crate) use rustc_middle::bug;
|
2020-03-31 06:20:19 -05:00
|
|
|
pub(crate) use rustc_middle::mir::{self, *};
|
2020-04-03 04:54:18 -05:00
|
|
|
pub(crate) use rustc_middle::ty::layout::{self, TyAndLayout};
|
2020-03-31 06:20:19 -05:00
|
|
|
pub(crate) use rustc_middle::ty::{
|
2020-03-27 06:14:45 -05:00
|
|
|
self, FnSig, Instance, InstanceDef, ParamEnv, Ty, TyCtxt, TypeAndMut, TypeFoldable,
|
2018-06-17 11:05:11 -05:00
|
|
|
};
|
2020-08-28 05:10:48 -05:00
|
|
|
pub(crate) use rustc_target::abi::{Abi, LayoutOf, Scalar, Size, VariantIdx};
|
2019-10-03 10:22:01 -05:00
|
|
|
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use rustc_data_structures::fx::FxHashMap;
|
|
|
|
|
|
|
|
pub(crate) use rustc_index::vec::Idx;
|
|
|
|
|
|
|
|
pub(crate) use cranelift_codegen::entity::EntitySet;
|
|
|
|
pub(crate) use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
|
|
|
|
pub(crate) use cranelift_codegen::ir::function::Function;
|
|
|
|
pub(crate) use cranelift_codegen::ir::types;
|
2020-08-28 05:10:48 -05:00
|
|
|
pub(crate) use cranelift_codegen::ir::{
|
|
|
|
AbiParam, Block, ExternalName, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc,
|
|
|
|
StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value,
|
|
|
|
};
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use cranelift_codegen::isa::{self, CallConv};
|
2020-08-28 05:10:48 -05:00
|
|
|
pub(crate) use cranelift_codegen::Context;
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
|
2020-10-01 03:38:23 -05:00
|
|
|
pub(crate) use cranelift_module::{self, DataContext, DataId, FuncId, Linkage, Module};
|
2018-06-22 12:18:53 -05:00
|
|
|
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use crate::abi::*;
|
|
|
|
pub(crate) use crate::base::{trans_operand, trans_place};
|
|
|
|
pub(crate) use crate::cast::*;
|
|
|
|
pub(crate) use crate::common::*;
|
2020-06-13 10:03:34 -05:00
|
|
|
pub(crate) use crate::debuginfo::{DebugContext, UnwindContext};
|
2020-03-27 06:14:45 -05:00
|
|
|
pub(crate) use crate::pointer::Pointer;
|
|
|
|
pub(crate) use crate::trap::*;
|
|
|
|
pub(crate) use crate::value_and_place::{CPlace, CPlaceInner, CValue};
|
2020-06-20 11:44:49 -05:00
|
|
|
}
|
2020-03-17 10:26:56 -05:00
|
|
|
|
2020-06-20 11:44:49 -05:00
|
|
|
struct PrintOnPanic<F: Fn() -> String>(F);
|
|
|
|
impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
if ::std::thread::panicking() {
|
|
|
|
println!("{}", (self.0)());
|
|
|
|
}
|
2020-03-17 10:26:56 -05:00
|
|
|
}
|
2018-06-17 11:05:11 -05:00
|
|
|
}
|
|
|
|
|
2020-10-01 03:38:23 -05:00
|
|
|
struct CodegenCx<'tcx, M: Module> {
|
2019-06-16 04:13:49 -05:00
|
|
|
tcx: TyCtxt<'tcx>,
|
2020-10-01 03:38:23 -05:00
|
|
|
module: M,
|
2020-07-09 12:24:53 -05:00
|
|
|
global_asm: String,
|
2019-08-18 09:52:07 -05:00
|
|
|
constants_cx: ConstantCx,
|
2020-01-04 10:58:38 -06:00
|
|
|
cached_context: Context,
|
2020-04-05 07:01:02 -05:00
|
|
|
vtables: FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), DataId>,
|
2020-06-12 14:15:13 -05:00
|
|
|
debug_context: Option<DebugContext<'tcx>>,
|
|
|
|
unwind_context: UnwindContext<'tcx>,
|
2018-12-18 11:28:02 -06:00
|
|
|
}
|
|
|
|
|
2020-10-01 03:38:23 -05:00
|
|
|
impl<'tcx, M: Module> CodegenCx<'tcx, M> {
|
|
|
|
fn new(tcx: TyCtxt<'tcx>, module: M, debug_info: bool) -> Self {
|
2020-06-12 14:15:13 -05:00
|
|
|
let unwind_context = UnwindContext::new(tcx, module.isa());
|
|
|
|
let debug_context = if debug_info {
|
2020-08-28 05:10:48 -05:00
|
|
|
Some(DebugContext::new(tcx, module.isa()))
|
2020-06-12 14:15:13 -05:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
};
|
2018-12-18 11:28:02 -06:00
|
|
|
CodegenCx {
|
|
|
|
tcx,
|
|
|
|
module,
|
2020-07-09 12:24:53 -05:00
|
|
|
global_asm: String::new(),
|
2019-08-18 09:52:07 -05:00
|
|
|
constants_cx: ConstantCx::default(),
|
2020-01-04 10:58:38 -06:00
|
|
|
cached_context: Context::new(),
|
2020-04-05 07:01:02 -05:00
|
|
|
vtables: FxHashMap::default(),
|
2019-01-17 11:07:27 -06:00
|
|
|
debug_context,
|
2020-05-01 12:21:29 -05:00
|
|
|
unwind_context,
|
2018-12-18 11:28:02 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 03:38:23 -05:00
|
|
|
fn finalize(mut self) -> (M, String, Option<DebugContext<'tcx>>, UnwindContext<'tcx>) {
|
2020-06-12 14:15:13 -05:00
|
|
|
self.constants_cx.finalize(self.tcx, &mut self.module);
|
2020-08-28 05:10:48 -05:00
|
|
|
(
|
|
|
|
self.module,
|
|
|
|
self.global_asm,
|
|
|
|
self.debug_context,
|
|
|
|
self.unwind_context,
|
|
|
|
)
|
2018-12-18 11:28:02 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 11:41:59 -05:00
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
pub struct BackendConfig {
|
|
|
|
pub use_jit: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct CraneliftCodegenBackend {
|
|
|
|
pub config: BackendConfig,
|
|
|
|
}
|
2018-07-23 04:17:39 -05:00
|
|
|
|
2018-07-14 04:59:42 -05:00
|
|
|
impl CodegenBackend for CraneliftCodegenBackend {
|
2020-01-17 13:33:27 -06:00
|
|
|
fn init(&self, sess: &Session) {
|
2020-06-20 12:14:58 -05:00
|
|
|
if sess.lto() != rustc_session::config::Lto::No && sess.opts.cg.embed_bitcode {
|
2020-01-17 13:33:27 -06:00
|
|
|
sess.warn("LTO is not supported. You may get a linker error.");
|
|
|
|
}
|
|
|
|
}
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2018-11-17 11:23:52 -06:00
|
|
|
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
|
2018-08-15 05:07:08 -05:00
|
|
|
Box::new(crate::metadata::CraneliftMetadataLoader)
|
2018-06-17 11:05:11 -05:00
|
|
|
}
|
|
|
|
|
2020-07-13 12:32:31 -05:00
|
|
|
fn provide(&self, providers: &mut Providers) {
|
|
|
|
providers.supported_target_features = |tcx, cnum| {
|
2019-07-20 08:33:57 -05:00
|
|
|
assert_eq!(cnum, LOCAL_CRATE);
|
|
|
|
if tcx.sess.opts.actually_rustdoc {
|
|
|
|
// rustdoc needs to be able to document functions that use all the features, so
|
|
|
|
// whitelist them all
|
2020-10-05 04:12:41 -05:00
|
|
|
rustc_codegen_ssa::target_features::all_known_features()
|
2020-05-09 07:14:45 -05:00
|
|
|
.map(|(a, b)| (a.to_string(), b))
|
|
|
|
.collect()
|
2019-07-20 08:33:57 -05:00
|
|
|
} else {
|
2020-10-05 04:12:41 -05:00
|
|
|
rustc_codegen_ssa::target_features::supported_target_features(tcx.sess)
|
2020-05-09 07:14:45 -05:00
|
|
|
.iter()
|
|
|
|
.map(|&(a, b)| (a.to_string(), b))
|
|
|
|
.collect()
|
2019-07-20 08:33:57 -05:00
|
|
|
}
|
|
|
|
};
|
2018-06-17 11:05:11 -05:00
|
|
|
}
|
2020-07-13 12:32:31 -05:00
|
|
|
fn provide_extern(&self, _providers: &mut Providers) {}
|
2018-06-17 11:05:11 -05:00
|
|
|
|
2020-06-20 09:22:03 -05:00
|
|
|
fn target_features(&self, _sess: &Session) -> Vec<rustc_span::Symbol> {
|
2020-08-15 14:04:33 -05:00
|
|
|
vec![]
|
2020-06-20 09:22:03 -05:00
|
|
|
}
|
|
|
|
|
2019-06-16 04:13:49 -05:00
|
|
|
fn codegen_crate<'tcx>(
|
2018-06-17 11:05:11 -05:00
|
|
|
&self,
|
2019-06-16 04:13:49 -05:00
|
|
|
tcx: TyCtxt<'tcx>,
|
2019-05-04 07:57:41 -05:00
|
|
|
metadata: EncodedMetadata,
|
2019-05-04 09:54:25 -05:00
|
|
|
need_metadata_module: bool,
|
2018-11-17 11:23:52 -06:00
|
|
|
) -> Box<dyn Any> {
|
2020-09-29 11:41:59 -05:00
|
|
|
let res = driver::codegen_crate(tcx, metadata, need_metadata_module, self.config);
|
2019-08-04 06:36:43 -05:00
|
|
|
|
2020-03-24 07:09:44 -05:00
|
|
|
rustc_symbol_mangling::test::report_symbol_names(tcx);
|
2019-08-04 06:36:43 -05:00
|
|
|
|
|
|
|
res
|
2018-06-17 11:05:11 -05:00
|
|
|
}
|
|
|
|
|
2020-02-07 06:49:48 -06:00
|
|
|
fn join_codegen(
|
2018-06-17 11:05:11 -05:00
|
|
|
&self,
|
2020-02-07 06:49:48 -06:00
|
|
|
ongoing_codegen: Box<dyn Any>,
|
2020-03-11 09:18:01 -05:00
|
|
|
sess: &Session,
|
|
|
|
dep_graph: &DepGraph,
|
2020-02-07 06:49:48 -06:00
|
|
|
) -> Result<Box<dyn Any>, ErrorReported> {
|
2020-08-28 05:10:48 -05:00
|
|
|
let (codegen_results, work_products) = *ongoing_codegen
|
|
|
|
.downcast::<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>)>()
|
|
|
|
.unwrap();
|
2020-03-11 09:18:01 -05:00
|
|
|
|
|
|
|
sess.time("serialize_work_products", move || {
|
|
|
|
rustc_incremental::save_work_product_index(sess, &dep_graph, work_products)
|
|
|
|
});
|
|
|
|
|
|
|
|
Ok(Box::new(codegen_results))
|
2020-02-07 06:49:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn link(
|
|
|
|
&self,
|
|
|
|
sess: &Session,
|
|
|
|
res: Box<dyn Any>,
|
2018-06-17 11:05:11 -05:00
|
|
|
outputs: &OutputFilenames,
|
2019-03-11 14:02:47 -05:00
|
|
|
) -> Result<(), ErrorReported> {
|
2019-04-01 12:34:26 -05:00
|
|
|
use rustc_codegen_ssa::back::link::link_binary;
|
|
|
|
|
2020-07-03 09:43:59 -05:00
|
|
|
sess.abort_if_errors();
|
|
|
|
|
2019-04-01 12:34:26 -05:00
|
|
|
let codegen_results = *res
|
2018-11-10 05:49:25 -06:00
|
|
|
.downcast::<CodegenResults>()
|
2018-11-07 07:04:44 -06:00
|
|
|
.expect("Expected CraneliftCodegenBackend's CodegenResult, found Box<Any>");
|
2018-07-24 07:10:53 -05:00
|
|
|
|
2019-10-03 10:22:01 -05:00
|
|
|
let _timer = sess.prof.generic_activity("link_crate");
|
|
|
|
|
2020-01-06 13:11:03 -06:00
|
|
|
sess.time("linking", || {
|
2019-09-28 10:00:27 -05:00
|
|
|
let target_cpu = crate::target_triple(sess).to_string();
|
2019-09-22 09:21:00 -05:00
|
|
|
link_binary::<crate::archive::ArArchiveBuilder<'_>>(
|
|
|
|
sess,
|
|
|
|
&codegen_results,
|
|
|
|
outputs,
|
|
|
|
&codegen_results.crate_name.as_str(),
|
|
|
|
&target_cpu,
|
|
|
|
);
|
|
|
|
});
|
2019-04-01 12:34:26 -05:00
|
|
|
|
2020-03-11 09:18:01 -05:00
|
|
|
rustc_incremental::finalize_session_directory(sess, codegen_results.crate_hash);
|
|
|
|
|
2018-06-17 11:05:11 -05:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-25 05:30:21 -05:00
|
|
|
fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
2019-09-22 09:05:22 -05:00
|
|
|
sess.target.target.llvm_target.parse().unwrap()
|
2019-05-25 05:30:21 -05:00
|
|
|
}
|
|
|
|
|
2019-08-11 10:06:18 -05:00
|
|
|
fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'static> {
|
2019-10-27 10:55:35 -05:00
|
|
|
use target_lexicon::BinaryFormat;
|
|
|
|
|
|
|
|
let target_triple = crate::target_triple(sess);
|
|
|
|
|
2018-12-12 08:11:15 -06:00
|
|
|
let mut flags_builder = settings::builder();
|
2019-08-11 10:06:18 -05:00
|
|
|
if enable_pic {
|
|
|
|
flags_builder.enable("is_pic").unwrap();
|
|
|
|
} else {
|
|
|
|
flags_builder.set("is_pic", "false").unwrap();
|
|
|
|
}
|
2020-01-14 06:55:08 -06:00
|
|
|
flags_builder.set("enable_probestack", "false").unwrap(); // __cranelift_probestack is not provided
|
2019-08-31 12:28:09 -05:00
|
|
|
flags_builder
|
|
|
|
.set(
|
|
|
|
"enable_verifier",
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
"true"
|
|
|
|
} else {
|
|
|
|
"false"
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.unwrap();
|
2018-12-12 08:11:15 -06:00
|
|
|
|
2019-10-27 10:55:35 -05:00
|
|
|
let tls_model = match target_triple.binary_format {
|
|
|
|
BinaryFormat::Elf => "elf_gd",
|
|
|
|
BinaryFormat::Macho => "macho",
|
|
|
|
BinaryFormat::Coff => "coff",
|
|
|
|
_ => "none",
|
|
|
|
};
|
|
|
|
flags_builder.set("tls_model", tls_model).unwrap();
|
|
|
|
|
2020-03-27 14:55:54 -05:00
|
|
|
flags_builder.set("enable_simd", "true").unwrap();
|
|
|
|
|
2019-07-27 09:12:15 -05:00
|
|
|
// FIXME(CraneStation/cranelift#732) fix LICM in presence of jump tables
|
2019-05-04 09:54:25 -05:00
|
|
|
/*
|
2020-03-24 07:09:44 -05:00
|
|
|
use rustc_session::config::OptLevel;
|
2019-05-04 09:54:25 -05:00
|
|
|
match sess.opts.optimize {
|
2018-12-12 08:11:15 -06:00
|
|
|
OptLevel::No => {
|
2020-03-31 07:13:03 -05:00
|
|
|
flags_builder.set("opt_level", "none").unwrap();
|
2018-12-12 08:11:15 -06:00
|
|
|
}
|
|
|
|
OptLevel::Less | OptLevel::Default => {}
|
|
|
|
OptLevel::Aggressive => {
|
2020-03-31 07:13:03 -05:00
|
|
|
flags_builder.set("opt_level", "speed_and_size").unwrap();
|
2018-12-12 08:11:15 -06:00
|
|
|
}
|
|
|
|
OptLevel::Size | OptLevel::SizeMin => {
|
|
|
|
sess.warn("Optimizing for size is not supported. Just ignoring the request");
|
|
|
|
}
|
2019-02-11 12:11:55 -06:00
|
|
|
}*/
|
2018-12-12 08:11:15 -06:00
|
|
|
|
|
|
|
let flags = settings::Flags::new(flags_builder);
|
2020-03-27 14:55:54 -05:00
|
|
|
|
|
|
|
let mut isa_builder = cranelift_codegen::isa::lookup(target_triple).unwrap();
|
2020-07-25 09:15:42 -05:00
|
|
|
// Don't use "haswell", as it implies `has_lzcnt`.macOS CI is still at Ivy Bridge EP, so `lzcnt`
|
|
|
|
// is interpreted as `bsr`.
|
|
|
|
isa_builder.enable("nehalem").unwrap();
|
2020-03-27 14:55:54 -05:00
|
|
|
isa_builder.finish(flags)
|
2018-12-12 08:11:15 -06:00
|
|
|
}
|
|
|
|
|
2018-07-14 04:59:42 -05:00
|
|
|
/// This is the entrypoint for a hot plugged rustc_codegen_cranelift
|
2018-06-17 11:05:11 -05:00
|
|
|
#[no_mangle]
|
2018-11-17 11:23:52 -06:00
|
|
|
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
|
2020-09-29 11:41:59 -05:00
|
|
|
Box::new(CraneliftCodegenBackend {
|
2020-10-01 03:38:23 -05:00
|
|
|
config: BackendConfig { use_jit: false },
|
2020-09-29 11:41:59 -05:00
|
|
|
})
|
2018-06-18 11:39:07 -05:00
|
|
|
}
|