Merge commit '05677b6bd6
' into sync_cg_clif-2021-08-06
This commit is contained in:
commit
279f486960
40 changed files with 823 additions and 590 deletions
|
@ -184,6 +184,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
|||
let config = if let Some(config) = self.config.clone() {
|
||||
config
|
||||
} else {
|
||||
if !tcx.sess.unstable_options() && !tcx.sess.opts.cg.llvm_args.is_empty() {
|
||||
tcx.sess.fatal("`-Z unstable-options` must be passed to allow configuring cg_clif");
|
||||
}
|
||||
BackendConfig::from_opts(&tcx.sess.opts.cg.llvm_args)
|
||||
.unwrap_or_else(|err| tcx.sess.fatal(&err))
|
||||
};
|
||||
|
@ -217,16 +220,15 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
|||
) -> Result<(), ErrorReported> {
|
||||
use rustc_codegen_ssa::back::link::link_binary;
|
||||
|
||||
link_binary::<crate::archive::ArArchiveBuilder<'_>>(
|
||||
sess,
|
||||
&codegen_results,
|
||||
outputs,
|
||||
)
|
||||
link_binary::<crate::archive::ArArchiveBuilder<'_>>(sess, &codegen_results, outputs)
|
||||
}
|
||||
}
|
||||
|
||||
fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
||||
sess.target.llvm_target.parse().unwrap()
|
||||
match sess.target.llvm_target.parse() {
|
||||
Ok(triple) => triple,
|
||||
Err(err) => sess.fatal(&format!("target not recognized: {}", err)),
|
||||
}
|
||||
}
|
||||
|
||||
fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Box<dyn isa::TargetIsa + 'static> {
|
||||
|
@ -276,15 +278,21 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Box<dyn isa::Tar
|
|||
}
|
||||
Some(value) => {
|
||||
let mut builder =
|
||||
cranelift_codegen::isa::lookup_variant(target_triple, variant).unwrap();
|
||||
cranelift_codegen::isa::lookup_variant(target_triple.clone(), variant)
|
||||
.unwrap_or_else(|err| {
|
||||
sess.fatal(&format!("can't compile for {}: {}", target_triple, err));
|
||||
});
|
||||
if let Err(_) = builder.enable(value) {
|
||||
sess.fatal("The specified target cpu isn't currently supported by Cranelift.");
|
||||
sess.fatal("the specified target cpu isn't currently supported by Cranelift.");
|
||||
}
|
||||
builder
|
||||
}
|
||||
None => {
|
||||
let mut builder =
|
||||
cranelift_codegen::isa::lookup_variant(target_triple.clone(), variant).unwrap();
|
||||
cranelift_codegen::isa::lookup_variant(target_triple.clone(), variant)
|
||||
.unwrap_or_else(|err| {
|
||||
sess.fatal(&format!("can't compile for {}: {}", target_triple, err));
|
||||
});
|
||||
if target_triple.architecture == target_lexicon::Architecture::X86_64 {
|
||||
// Don't use "haswell" as the default, as it implies `has_lzcnt`.
|
||||
// macOS CI is still at Ivy Bridge EP, so `lzcnt` is interpreted as `bsr`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue