use crate::attributes;
use crate::llvm;
use crate::debuginfo;
-use crate::monomorphize::Instance;
use crate::value::Value;
use rustc::dep_graph::DepGraphSafe;
use rustc::hir;
-use crate::monomorphize::partitioning::CodegenUnit;
use crate::type_::Type;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::base_n;
use rustc_data_structures::small_c_str::SmallCStr;
+use rustc::mir::mono::CodegenUnit;
use rustc::session::config::{self, DebugInfo};
use rustc::session::Session;
use rustc::ty::layout::{
LayoutError, LayoutOf, PointeeInfo, Size, TyLayout, VariantIdx, HasParamEnv
};
-use rustc::ty::{self, Ty, TyCtxt};
+use rustc::ty::{self, Ty, TyCtxt, Instance};
use rustc::util::nodemap::FxHashMap;
use rustc_target::spec::{HasTargetSpec, Target};
use rustc_codegen_ssa::callee::resolve_and_get_fn;
/// `llvm::Context` so that several compilation units may be optimized in parallel.
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
pub struct CodegenCx<'ll, 'tcx: 'll> {
- pub tcx: TyCtxt<'ll, 'tcx, 'tcx>,
+ pub tcx: TyCtxt<'tcx, 'tcx>,
pub check_overflow: bool,
pub use_dll_storage_attrs: bool,
pub tls_model: llvm::ThreadLocalMode,
/// Cache instances of monomorphic and polymorphic items
pub instances: RefCell<FxHashMap<Instance<'tcx>, &'ll Value>>,
/// Cache generated vtables
- pub vtables: RefCell<FxHashMap<
- (Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), &'ll Value>>,
+ pub vtables:
+ RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), &'ll Value>>,
/// Cache of constant strings,
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, &'ll Value>>,
}
pub unsafe fn create_module(
- tcx: TyCtxt<'_, '_, '_>,
+ tcx: TyCtxt<'_, '_>,
llcx: &'ll llvm::Context,
mod_name: &str,
) -> &'ll llvm::Module {
}
impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
- crate fn new(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
- codegen_unit: Arc<CodegenUnit<'tcx>>,
- llvm_module: &'ll crate::ModuleLlvm)
- -> Self {
+ crate fn new(
+ tcx: TyCtxt<'tcx, 'tcx>,
+ codegen_unit: Arc<CodegenUnit<'tcx>>,
+ llvm_module: &'ll crate::ModuleLlvm,
+ ) -> Self {
// An interesting part of Windows which MSVC forces our hand on (and
// apparently MinGW didn't) is the usage of `dllimport` and `dllexport`
// attributes in LLVM IR as well as native dependencies (in C these
ifn!("llvm.fabs.v4f64", fn(t_v4f64) -> t_v4f64);
ifn!("llvm.fabs.v8f64", fn(t_v8f64) -> t_v8f64);
+ ifn!("llvm.minnum.f32", fn(t_f32, t_f32) -> t_f32);
+ ifn!("llvm.minnum.f64", fn(t_f64, t_f64) -> t_f64);
+ ifn!("llvm.maxnum.f32", fn(t_f32, t_f32) -> t_f32);
+ ifn!("llvm.maxnum.f64", fn(t_f64, t_f64) -> t_f64);
+
ifn!("llvm.floor.f32", fn(t_f32) -> t_f32);
ifn!("llvm.floor.v2f32", fn(t_v2f32) -> t_v2f32);
ifn!("llvm.floor.v4f32", fn(t_v4f32) -> t_v4f32);
}
impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> {
- fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> {
+ fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
self.tcx
}
}