Fix warnings

This commit is contained in:
Antoni Boucher 2022-06-29 21:31:02 -04:00
parent d19a5ea868
commit fea51f391e
5 changed files with 9 additions and 35 deletions

View file

@ -1,4 +1,6 @@
use gccjit::{FnAttribute, Function};
#[cfg_attr(not(feature="master"), allow(unused_imports))]
use gccjit::FnAttribute;
use gccjit::Function;
use rustc_attr::InstructionSetAttr;
use rustc_codegen_ssa::target_features::tied_target_features;
use rustc_data_structures::fx::FxHashMap;
@ -72,6 +74,7 @@ fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> {
/// attributes.
pub fn from_fn_attrs<'gcc, 'tcx>(
cx: &CodegenCx<'gcc, 'tcx>,
#[cfg_attr(not(feature="master"), allow(unused_variables))]
func: Function<'gcc>,
instance: ty::Instance<'tcx>,
) {
@ -109,6 +112,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
function_features.extend(&mut global_features);
let target_features = function_features.join(",");
if !target_features.is_empty() {
#[cfg(feature="master")]
func.add_attribute(FnAttribute::Target, &target_features);
}
}

View file

@ -100,20 +100,6 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
context.add_command_line_option("-mvpclmulqdq");
context.add_command_line_option("-mavx");
if env::var("CG_GCCJIT_ENABLE_AVX512").as_deref() == Ok("1") {
context.add_command_line_option("-mavx512f");
context.add_command_line_option("-mavx512vpopcntdq");
context.add_command_line_option("-mavx512vl");
context.add_command_line_option("-mavx512vnni");
context.add_command_line_option("-mavx512bw");
context.add_command_line_option("-mavx512bitalg");
context.add_command_line_option("-mavx512bf16");
context.add_command_line_option("-mavx512vbmi2");
context.add_command_line_option("-mavx512vbmi");
context.add_command_line_option("-mavx512ifma");
context.add_command_line_option("-mavx512cd");
}
for arg in &tcx.sess.opts.cg.llvm_args {
context.add_command_line_option(arg);
}

View file

@ -287,9 +287,9 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc
pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc, 'tcx>, mut return_value: RValue<'gcc>, func_name: &str, args: &[RValue<'gcc>], args_adjusted: bool) -> RValue<'gcc> {
match func_name {
"__builtin_ia32_vfmaddss3_round" | "__builtin_ia32_vfmaddsd3_round" => {
let zero = builder.context.new_rvalue_zero(builder.int_type);
#[cfg(feature="master")]
{
let zero = builder.context.new_rvalue_zero(builder.int_type);
return_value = builder.context.new_vector_access(None, return_value, zero).to_rvalue();
}
},

View file

@ -1,4 +1,6 @@
use gccjit::{BinaryOp, RValue, Type, ToRValue, ComparisonOp, UnaryOp};
#[cfg_attr(not(feature="master"), allow(unused_imports))]
use gccjit::{ToRValue, ComparisonOp, UnaryOp};
use gccjit::{BinaryOp, RValue, Type};
use rustc_codegen_ssa::base::compare_simd_types;
use rustc_codegen_ssa::common::{TypeKind, span_invalid_monomorphization_error};
use rustc_codegen_ssa::mir::operand::OperandRef;

View file

@ -190,24 +190,6 @@ pub struct GccContext {
context: Context<'static>,
}
impl GccContext {
fn new<'tcx>(tcx: TyCtxt<'tcx>) -> Self {
let context = create_context(tcx);
Self {
context,
}
}
}
fn create_context<'gcc, 'tcx>(tcx: TyCtxt<'tcx>) -> Context<'gcc> {
let context = Context::default();
if tcx.sess.target.is_builtin {
//let features = global_gcc_features(sess, false);
println!("Features: {:?}", tcx.sess.opts.cg.target_feature);
}
context
}
unsafe impl Send for GccContext {}
// FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "-Zno-parallel-llvm". Try to disable it here.
unsafe impl Sync for GccContext {}