提交 da66431d 编写于 作者: E Eduard Burtescu

trans: Combine cabi and back::abi into abi.

上级 cdfad407
......@@ -73,7 +73,6 @@
pub mod diagnostics;
pub mod back {
pub use rustc_back::abi;
pub use rustc_back::rpath;
pub use rustc_back::svh;
}
......
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub const BOX_FIELD_DROP_GLUE: usize = 1;
pub const BOX_FIELD_BODY: usize = 4;
/// The first half of a fat pointer.
/// - For a closure, this is the code address.
/// - For an object or trait instance, this is the address of the box.
/// - For a slice, this is the base address.
pub const FAT_PTR_ADDR: usize = 0;
/// The second half of a fat pointer.
/// - For a closure, this is the address of the environment.
/// - For an object or trait instance, this is the address of the vtable.
/// - For a slice, this is the length.
pub const FAT_PTR_EXTRA: usize = 1;
......@@ -48,7 +48,6 @@
extern crate rustc_front;
#[macro_use] extern crate log;
pub mod abi;
pub mod tempdir;
pub mod rpath;
pub mod sha2;
......
......@@ -61,7 +61,6 @@
pub use rustc::util;
pub mod back {
pub use rustc_back::abi;
pub use rustc_back::rpath;
pub use rustc_back::svh;
......
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
......@@ -28,7 +28,19 @@
use middle::ty::{self, Ty};
use syntax::abi::Abi;
pub use syntax::abi::Abi;
/// The first half of a fat pointer.
/// - For a closure, this is the code address.
/// - For an object or trait instance, this is the address of the box.
/// - For a slice, this is the base address.
pub const FAT_PTR_ADDR: usize = 0;
/// The second half of a fat pointer.
/// - For a closure, this is the address of the environment.
/// - For an object or trait instance, this is the address of the vtable.
/// - For a slice, this is the length.
pub const FAT_PTR_EXTRA: usize = 1;
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum ArgKind {
......@@ -130,7 +142,7 @@ pub fn new<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
abi: Abi,
sig: &ty::FnSig<'tcx>,
extra_args: &[Ty<'tcx>]) -> FnType {
use syntax::abi::Abi::*;
use self::Abi::*;
let cconv = match ccx.sess().target.target.adjust_abi(abi) {
RustIntrinsic => {
// Intrinsics are emitted at the call site
......
......@@ -48,13 +48,13 @@
use std::rc::Rc;
use llvm::{ValueRef, True, IntEQ, IntNE};
use back::abi::FAT_PTR_ADDR;
use middle::subst;
use middle::ty::{self, Ty, TyCtxt};
use syntax::ast;
use syntax::attr;
use syntax::attr::IntType;
use trans::_match;
use trans::abi::FAT_PTR_ADDR;
use trans::base::InitAlloca;
use trans::build::*;
use trans::cleanup;
......
......@@ -15,10 +15,10 @@
use middle::infer;
use middle::traits::ProjectionMode;
use session::config::NoDebugInfo;
use syntax::abi::Abi;
pub use syntax::attr::InlineAttr;
use syntax::ast;
use rustc_front::hir;
use trans::abi::Abi;
use trans::base;
use trans::common;
use trans::context::CrateContext;
......
......@@ -30,7 +30,7 @@
use super::ModuleTranslation;
use back::link::mangle_exported_name;
use back::{link, abi};
use back::link;
use lint;
use llvm::{BasicBlockRef, Linkage, ValueRef, Vector, get_param};
use llvm;
......@@ -52,6 +52,7 @@
use session::config::{self, NoDebugInfo, FullDebugInfo};
use session::Session;
use trans::_match;
use trans::abi::{self, Abi};
use trans::adt;
use trans::assert_dep_graph;
use trans::attributes;
......@@ -100,7 +101,6 @@
use std::collections::{HashMap, HashSet};
use std::str;
use std::{i8, i16, i32, i64};
use syntax::abi::Abi;
use syntax::codemap::{Span, DUMMY_SP};
use syntax::parse::token::InternedString;
use syntax::attr::AttrMetaMethods;
......
......@@ -11,7 +11,7 @@
#![allow(non_upper_case_globals)]
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
use trans::cabi::{FnType, ArgType};
use trans::abi::{FnType, ArgType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -11,7 +11,7 @@
#![allow(non_upper_case_globals)]
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
use trans::cabi::{FnType, ArgType};
use trans::abi::{FnType, ArgType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -11,7 +11,7 @@
#![allow(non_upper_case_globals)]
use llvm::{Struct, Array, Attribute};
use trans::cabi::{FnType, ArgType};
use trans::abi::{FnType, ArgType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -14,7 +14,7 @@
use std::cmp;
use llvm;
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
use trans::cabi::{ArgType, FnType};
use trans::abi::{ArgType, FnType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -11,7 +11,7 @@
use libc::c_uint;
use llvm;
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Attribute};
use trans::cabi::{FnType, ArgType};
use trans::abi::{FnType, ArgType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -16,7 +16,7 @@
// need to be fixed when PowerPC vector support is added.
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Attribute};
use trans::cabi::{FnType, ArgType};
use trans::abi::{FnType, ArgType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -9,7 +9,7 @@
// except according to those terms.
use llvm::*;
use trans::cabi::{ArgType, FnType};
use trans::abi::{ArgType, FnType};
use trans::type_::Type;
use super::common::*;
use super::machine::*;
......
......@@ -16,7 +16,7 @@
use llvm::{Integer, Pointer, Float, Double};
use llvm::{Struct, Array, Attribute, Vector};
use trans::cabi::{ArgType, FnType};
use trans::abi::{ArgType, FnType};
use trans::context::CrateContext;
use trans::type_::Type;
......
......@@ -11,7 +11,7 @@
use llvm::*;
use super::common::*;
use super::machine::*;
use trans::cabi::{ArgType, FnType};
use trans::abi::{ArgType, FnType};
use trans::type_::Type;
// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
......
......@@ -27,6 +27,7 @@
use middle::subst::{Substs};
use middle::traits;
use rustc::front::map as hir_map;
use trans::abi::Abi;
use trans::adt;
use trans::attributes;
use trans::base;
......@@ -54,7 +55,6 @@
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc_front::hir;
use syntax::abi::Abi;
use syntax::ast;
use syntax::codemap::DUMMY_SP;
use syntax::errors;
......
......@@ -14,6 +14,7 @@
use middle::def_id::DefId;
use middle::infer;
use middle::traits::ProjectionMode;
use trans::abi::Abi::RustCall;
use trans::adt;
use trans::attributes;
use trans::base::*;
......@@ -32,7 +33,6 @@
use middle::ty;
use session::config::FullDebugInfo;
use syntax::abi::Abi::RustCall;
use syntax::ast;
use syntax::attr::{ThinAttributes, ThinAttributesExt};
......
......@@ -1261,7 +1261,7 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
output.push_str("unsafe ");
}
if abi != ::syntax::abi::Abi::Rust {
if abi != ::trans::abi::Abi::Rust {
output.push_str("extern \"");
output.push_str(abi.name());
output.push_str("\" ");
......
......@@ -22,6 +22,7 @@
use middle::infer;
use middle::lang_items::LangItem;
use middle::subst::Substs;
use trans::abi::Abi;
use trans::base;
use trans::build;
use trans::builder::Builder;
......@@ -49,7 +50,6 @@
use std::ffi::CString;
use std::cell::{Cell, RefCell};
use syntax::abi::Abi;
use syntax::ast;
use syntax::codemap::{DUMMY_SP, Span};
use syntax::parse::token::InternedString;
......
......@@ -9,7 +9,6 @@
// except according to those terms.
use back::abi;
use llvm;
use llvm::{ConstFCmp, ConstICmp, SetLinkage, SetUnnamedAddr};
use llvm::{InternalLinkage, ValueRef, Bool, True};
......@@ -19,7 +18,7 @@
use middle::def::Def;
use middle::def_id::DefId;
use rustc::front::map as hir_map;
use trans::{adt, closure, debuginfo, expr, inline, machine};
use trans::{abi, adt, closure, debuginfo, expr, inline, machine};
use trans::base::{self, exported_name, push_ctxt};
use trans::callee::Callee;
use trans::collector::{self, TransItem};
......
......@@ -32,6 +32,7 @@
use rustc_front;
use rustc_front::hir;
use trans::abi::Abi;
use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
use trans;
use trans::{monomorphize, type_of};
......@@ -49,7 +50,6 @@
use syntax::codemap::{Span, Pos};
use syntax::{ast, codemap};
use syntax::abi::Abi;
use syntax::attr::IntType;
use syntax::parse::token::{self, special_idents};
......
......@@ -107,7 +107,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
output.push_str("unsafe ");
}
if abi != ::syntax::abi::Abi::Rust {
if abi != ::trans::abi::Abi::Rust {
output.push_str("extern \"");
output.push_str(abi.name());
output.push_str("\" ");
......
......@@ -23,10 +23,9 @@
use middle::ty;
use middle::infer;
use middle::traits::ProjectionMode;
use syntax::abi::Abi;
use trans::abi::{Abi, FnType};
use trans::attributes;
use trans::base;
use trans::cabi::FnType;
use trans::context::CrateContext;
use trans::type_::Type;
use trans::type_of;
......
......@@ -51,12 +51,11 @@
pub use self::Dest::*;
use self::lazy_binop_ty::*;
use back::abi;
use llvm::{self, ValueRef, TypeKind};
use middle::const_qualif::ConstQualif;
use middle::def::Def;
use middle::subst::Substs;
use trans::{_match, adt, asm, base, closure, consts, controlflow};
use trans::{_match, abi, adt, asm, base, closure, consts, controlflow};
use trans::base::*;
use trans::build::*;
use trans::callee::{Callee, ArgExprs, ArgOverloadedCall, ArgOverloadedOp};
......
......@@ -9,15 +9,15 @@
// except according to those terms.
use back::{abi, link};
use back::link;
use llvm::{ValueRef, get_param};
use llvm;
use middle::weak_lang_items;
use trans::abi::{self, Abi, FnType};
use trans::attributes;
use trans::base::{llvm_linkage_by_name, push_ctxt};
use trans::base;
use trans::build::*;
use trans::cabi::FnType;
use trans::common::*;
use trans::debuginfo::DebugLoc;
use trans::declare;
......@@ -35,7 +35,6 @@
use std::cmp;
use std::iter::once;
use libc::c_uint;
use syntax::abi::Abi;
use syntax::attr;
use syntax::parse::token::{InternedString, special_idents};
use syntax::ast;
......@@ -715,7 +714,4 @@ pub fn link_name(name: ast::Name, attrs: &[ast::Attribute]) -> InternedString {
None => name.as_str(),
}
}
}
}
}
}
......@@ -18,6 +18,7 @@
use middle::infer;
use middle::subst;
use middle::subst::FnSpace;
use trans::abi::Abi;
use trans::adt;
use trans::attributes;
use trans::base::*;
......@@ -40,7 +41,6 @@
use middle::subst::Substs;
use rustc::dep_graph::DepNode;
use rustc_front::hir;
use syntax::abi::Abi;
use syntax::ast;
use syntax::ptr::P;
use syntax::parse::token;
......
......@@ -11,7 +11,7 @@
use llvm::{BasicBlockRef, ValueRef, OperandBundleDef};
use rustc::middle::ty;
use rustc::mir::repr as mir;
use syntax::abi::Abi;
use trans::abi::Abi;
use trans::adt;
use trans::attributes;
use trans::base;
......
......@@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use back::abi;
use llvm::ValueRef;
use middle::ty::{Ty, TypeFoldable};
use rustc::middle::const_eval::{self, ConstVal};
use rustc_const_eval::ConstInt::*;
use rustc::mir::repr as mir;
use trans::abi;
use trans::common::{self, BlockAndBuilder, C_bool, C_bytes, C_floating_f64, C_integral,
C_str_slice, C_nil, C_undef};
use trans::consts;
......
......@@ -19,6 +19,7 @@
#[macro_use]
mod macros;
mod abi;
mod adt;
mod asm;
mod assert_dep_graph;
......@@ -27,7 +28,6 @@
mod basic_block;
mod build;
mod builder;
mod cabi;
mod cabi_aarch64;
mod cabi_arm;
mod cabi_asmjs;
......
......@@ -16,6 +16,7 @@
use middle::subst;
use middle::subst::{Subst, Substs};
use middle::ty::fold::{TypeFolder, TypeFoldable};
use trans::abi::Abi;
use trans::attributes;
use trans::base::{push_ctxt};
use trans::base::trans_fn;
......@@ -30,7 +31,6 @@
use rustc_front::hir;
use syntax::abi::Abi;
use syntax::attr;
use syntax::errors;
......
......@@ -13,15 +13,14 @@
use middle::def_id::DefId;
use middle::infer;
use middle::subst;
use trans::abi::{Abi, FnType};
use trans::adt;
use trans::cabi::FnType;
use trans::common::*;
use trans::machine;
use middle::ty::{self, Ty, TypeFoldable};
use trans::type_::Type;
use syntax::abi::Abi;
use syntax::ast;
// LLVM doesn't like objects that are too big. Issue #17913
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册