Rustup to rustc 1.37.0-nightly (2887008e0
2019-06-12)
This commit is contained in:
parent
5e2ea4f194
commit
6d1bc088a7
14
src/abi.rs
14
src/abi.rs
@ -39,8 +39,8 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_pass_mode<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn get_pass_mode<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> PassMode {
|
||||
let layout = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap();
|
||||
@ -76,7 +76,7 @@ fn adjust_arg_for_abi<'a, 'tcx: 'a>(
|
||||
}
|
||||
}
|
||||
|
||||
fn clif_sig_from_fn_sig<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sig: FnSig<'tcx>) -> Signature {
|
||||
fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sig: FnSig<'tcx>) -> Signature {
|
||||
let (call_conv, inputs, output): (CallConv, Vec<Ty>, Ty) = match sig.abi {
|
||||
Abi::Rust => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
@ -128,8 +128,8 @@ fn clif_sig_from_fn_sig<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sig: FnSig<'t
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_function_name_and_sig<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub fn get_function_name_and_sig<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
inst: Instance<'tcx>,
|
||||
support_vararg: bool,
|
||||
) -> (String, Signature) {
|
||||
@ -143,8 +143,8 @@ pub fn get_function_name_and_sig<'a, 'tcx>(
|
||||
}
|
||||
|
||||
/// Instance must be monomorphized
|
||||
pub fn import_function<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub fn import_function<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<impl Backend>,
|
||||
inst: Instance<'tcx>,
|
||||
) -> FuncId {
|
||||
|
@ -3,7 +3,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>(
|
||||
cx: &mut crate::CodegenCx<'a, 'clif, 'tcx, B>,
|
||||
cx: &mut crate::CodegenCx<'clif, 'tcx, B>,
|
||||
instance: Instance<'tcx>,
|
||||
linkage: Linkage,
|
||||
) {
|
||||
@ -18,9 +18,9 @@ pub fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>(
|
||||
// Check sig for u128 and i128
|
||||
let fn_sig = tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &instance.fn_sig(tcx));
|
||||
|
||||
struct UI128Visitor<'a, 'tcx: 'a>(TyCtxt<'a, 'tcx, 'tcx>, bool);
|
||||
struct UI128Visitor<'tcx>(TyCtxt<'tcx, 'tcx>, bool);
|
||||
|
||||
impl<'a, 'tcx: 'a> rustc::ty::fold::TypeVisitor<'tcx> for UI128Visitor<'a, 'tcx> {
|
||||
impl<'tcx> rustc::ty::fold::TypeVisitor<'tcx> for UI128Visitor<'tcx> {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||
if t.sty == self.0.types.u128.sty || t.sty == self.0.types.i128.sty {
|
||||
self.1 = true;
|
||||
|
@ -18,7 +18,7 @@ pub fn pointer_ty(tcx: TyCtxt) -> types::Type {
|
||||
}
|
||||
|
||||
pub fn clif_type_from_ty<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Option<types::Type> {
|
||||
Some(match ty.sty {
|
||||
@ -95,7 +95,7 @@ pub fn clif_intcast<'a, 'tcx: 'a>(
|
||||
|
||||
pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> {
|
||||
// FIXME use a reference to `CodegenCx` instead of `tcx`, `module` and `constants` and `caches`
|
||||
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'tcx, 'tcx>,
|
||||
pub module: &'a mut Module<B>,
|
||||
pub pointer_type: Type, // Cached from module
|
||||
|
||||
@ -123,7 +123,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> TyLayout<'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, B: Backend + 'a> layout::HasTyCtxt<'tcx> for FunctionCx<'a, 'tcx, B> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ enum TodoItem {
|
||||
impl ConstantCx {
|
||||
pub fn finalize<'a, 'tcx: 'a, B: Backend>(
|
||||
mut self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<B>,
|
||||
) {
|
||||
//println!("todo {:?}", self.todo);
|
||||
@ -184,7 +184,7 @@ fn data_id_for_alloc_id<B: Backend>(module: &mut Module<B>, alloc_id: AllocId) -
|
||||
}
|
||||
|
||||
fn data_id_for_static<'a, 'tcx: 'a, B: Backend>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<B>,
|
||||
def_id: DefId,
|
||||
linkage: Linkage,
|
||||
@ -238,7 +238,7 @@ fn cplace_for_dataid<'a, 'tcx: 'a>(
|
||||
}
|
||||
|
||||
fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<B>,
|
||||
cx: &mut ConstantCx,
|
||||
) {
|
||||
@ -336,7 +336,7 @@ fn pop_set<T: Copy + Eq + ::std::hash::Hash>(set: &mut HashSet<T>) -> Option<T>
|
||||
|
||||
struct TransPlaceInterpreter;
|
||||
|
||||
impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter {
|
||||
impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter {
|
||||
type MemoryKinds = !;
|
||||
type PointerTag = ();
|
||||
type AllocExtra = ();
|
||||
@ -345,16 +345,16 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter {
|
||||
type MemoryMap = FxHashMap<AllocId, (MemoryKind<!>, Allocation<()>)>;
|
||||
const STATIC_KIND: Option<!> = None;
|
||||
|
||||
fn enforce_validity(_: &InterpretCx<'a, 'mir, 'tcx, Self>) -> bool {
|
||||
fn enforce_validity(_: &InterpretCx<'mir, 'tcx, Self>) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn before_terminator(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
fn before_terminator(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn find_fn(
|
||||
_: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
|
||||
_: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
_: Instance<'tcx>,
|
||||
_: &[OpTy<'tcx>],
|
||||
_: Option<PlaceTy<'tcx>>,
|
||||
@ -364,7 +364,7 @@ fn find_fn(
|
||||
}
|
||||
|
||||
fn call_intrinsic(
|
||||
_: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
|
||||
_: &mut InterpretCx<'mir, 'tcx, Self>,
|
||||
_: Instance<'tcx>,
|
||||
_: &[OpTy<'tcx>],
|
||||
_: PlaceTy<'tcx>,
|
||||
@ -374,13 +374,13 @@ fn call_intrinsic(
|
||||
|
||||
fn find_foreign_static(
|
||||
_: DefId,
|
||||
_: ::rustc::ty::query::TyCtxtAt<'a, 'tcx, 'tcx>,
|
||||
_: ::rustc::ty::query::TyCtxtAt<'tcx, 'tcx>,
|
||||
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn ptr_op(
|
||||
_: &InterpretCx<'a, 'mir, 'tcx, Self>,
|
||||
_: &InterpretCx<'mir, 'tcx, Self>,
|
||||
_: mir::BinOp,
|
||||
_: ImmTy<'tcx>,
|
||||
_: ImmTy<'tcx>,
|
||||
@ -388,7 +388,7 @@ fn ptr_op(
|
||||
panic!();
|
||||
}
|
||||
|
||||
fn box_alloc(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
|
||||
fn box_alloc(_: &mut InterpretCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> {
|
||||
panic!();
|
||||
}
|
||||
|
||||
@ -405,11 +405,11 @@ fn tag_static_base_pointer(_: AllocId, _: &()) -> Self::PointerTag {
|
||||
()
|
||||
}
|
||||
|
||||
fn stack_push(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
fn stack_push(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stack_pop(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
|
||||
fn stack_pop(_: &mut InterpretCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_location(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>, entry_id: UnitEntryId, span: Span) {
|
||||
fn emit_location(&mut self, tcx: TyCtxt<'tcx, 'tcx>, entry_id: UnitEntryId, span: Span) {
|
||||
let loc = tcx.sess.source_map().lookup_char_pos(span.lo());
|
||||
|
||||
let file_id = line_program_add_file(
|
||||
@ -232,7 +232,7 @@ pub struct FunctionDebugContext<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> {
|
||||
pub fn new(
|
||||
tcx: TyCtxt<'b, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
debug_context: &'a mut DebugContext<'tcx>,
|
||||
mir: &Body,
|
||||
name: &str,
|
||||
|
@ -14,7 +14,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn codegen_crate<'a, 'tcx>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
need_metadata_module: bool,
|
||||
) -> Box<dyn Any> {
|
||||
@ -45,7 +45,7 @@ pub fn codegen_crate<'a, 'tcx>(
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option<File>) -> ! {
|
||||
fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, log: &mut Option<File>) -> ! {
|
||||
use cranelift_simplejit::{SimpleJITBackend, SimpleJITBuilder};
|
||||
|
||||
let mut jit_module: Module<SimpleJITBackend> = Module::new(SimpleJITBuilder::new(
|
||||
@ -96,7 +96,7 @@ fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option<File>) ->
|
||||
}
|
||||
|
||||
fn run_aot<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
need_metadata_module: bool,
|
||||
log: &mut Option<File>,
|
||||
@ -225,7 +225,7 @@ fn run_aot<'a, 'tcx: 'a>(
|
||||
}
|
||||
|
||||
fn codegen_cgus<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<impl Backend + 'static>,
|
||||
debug: &mut Option<DebugContext<'tcx>>,
|
||||
log: &mut Option<File>,
|
||||
@ -243,7 +243,7 @@ fn codegen_cgus<'a, 'tcx: 'a>(
|
||||
}
|
||||
|
||||
fn codegen_mono_items<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<impl Backend + 'static>,
|
||||
debug_context: Option<&mut DebugContext<'tcx>>,
|
||||
log: &mut Option<File>,
|
||||
@ -263,7 +263,7 @@ fn codegen_mono_items<'a, 'tcx: 'a>(
|
||||
}
|
||||
|
||||
fn trans_mono_item<'a, 'clif, 'tcx: 'a, B: Backend + 'static>(
|
||||
cx: &mut crate::CodegenCx<'a, 'clif, 'tcx, B>,
|
||||
cx: &mut crate::CodegenCx<'clif, 'tcx, B>,
|
||||
mono_item: MonoItem<'tcx>,
|
||||
linkage: Linkage,
|
||||
) {
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -122,17 +122,17 @@ fn default() -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CodegenCx<'a, 'clif, 'tcx, B: Backend + 'static> {
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub struct CodegenCx<'clif, 'tcx, B: Backend + 'static> {
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &'clif mut Module<B>,
|
||||
ccx: ConstantCx,
|
||||
caches: Caches<'tcx>,
|
||||
debug_context: Option<&'clif mut DebugContext<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'a, 'clif, 'tcx, B: Backend + 'static> CodegenCx<'a, 'clif, 'tcx, B> {
|
||||
impl<'clif, 'tcx, B: Backend + 'static> CodegenCx<'clif, 'tcx, B> {
|
||||
fn new(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &'clif mut Module<B>,
|
||||
debug_context: Option<&'clif mut DebugContext<'tcx>>,
|
||||
) -> Self {
|
||||
@ -195,7 +195,7 @@ fn provide_extern(&self, providers: &mut Providers) {
|
||||
|
||||
fn codegen_crate<'a, 'tcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
need_metadata_module: bool,
|
||||
_rx: mpsc::Receiver<Box<dyn Any + Send>>,
|
||||
|
@ -3,7 +3,7 @@
|
||||
/// Create the `main` function which will initialize the rust runtime and call
|
||||
/// users main function.
|
||||
pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
module: &mut Module<impl Backend + 'static>,
|
||||
) {
|
||||
use rustc::middle::lang_items::StartFnLangItem;
|
||||
@ -23,7 +23,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>(
|
||||
create_entry_fn(tcx, module, main_def_id, use_start_lang_item);;
|
||||
|
||||
fn create_entry_fn<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
m: &mut Module<impl Backend + 'static>,
|
||||
rust_main_def_id: DefId,
|
||||
use_start_lang_item: bool,
|
||||
|
@ -49,7 +49,7 @@ fn get_dylib_metadata(
|
||||
|
||||
// Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112
|
||||
pub fn write_metadata<'a, 'gcx>(
|
||||
tcx: TyCtxt<'a, 'gcx, 'gcx>,
|
||||
tcx: TyCtxt<'gcx, 'gcx>,
|
||||
artifact: &mut faerie::Artifact
|
||||
) -> EncodedMetadata {
|
||||
use std::io::Write;
|
||||
|
@ -77,7 +77,7 @@ pub struct CommentWriter {
|
||||
}
|
||||
|
||||
impl CommentWriter {
|
||||
pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance<'tcx>) -> Self {
|
||||
pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> Self {
|
||||
CommentWriter {
|
||||
global_comments: vec![
|
||||
format!("symbol {}", tcx.symbol_name(instance).as_str()),
|
||||
@ -194,7 +194,7 @@ pub fn add_comment<'s, S: Into<Cow<'s, str>>>(&mut self, inst: Inst, comment: S)
|
||||
}
|
||||
|
||||
pub fn write_clif_file<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
postfix: &str,
|
||||
instance: Instance<'tcx>,
|
||||
func: &ir::Function,
|
||||
|
Loading…
Reference in New Issue
Block a user