Skip to content

Commit da66431

Browse files
committed
trans: Combine cabi and back::abi into abi.
1 parent cdfad40 commit da66431

33 files changed

+45
-68
lines changed

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ mod macros;
7373
pub mod diagnostics;
7474

7575
pub mod back {
76-
pub use rustc_back::abi;
7776
pub use rustc_back::rpath;
7877
pub use rustc_back::svh;
7978
}

src/librustc_back/abi.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/librustc_back/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ extern crate rustc_llvm;
4848
extern crate rustc_front;
4949
#[macro_use] extern crate log;
5050

51-
pub mod abi;
5251
pub mod tempdir;
5352
pub mod rpath;
5453
pub mod sha2;

src/librustc_trans/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub use rustc::lint;
6161
pub use rustc::util;
6262

6363
pub mod back {
64-
pub use rustc_back::abi;
6564
pub use rustc_back::rpath;
6665
pub use rustc_back::svh;
6766

src/librustc_trans/trans/cabi.rs renamed to src/librustc_trans/trans/abi.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -28,7 +28,19 @@ use trans::type_of;
2828

2929
use middle::ty::{self, Ty};
3030

31-
use syntax::abi::Abi;
31+
pub use syntax::abi::Abi;
32+
33+
/// The first half of a fat pointer.
34+
/// - For a closure, this is the code address.
35+
/// - For an object or trait instance, this is the address of the box.
36+
/// - For a slice, this is the base address.
37+
pub const FAT_PTR_ADDR: usize = 0;
38+
39+
/// The second half of a fat pointer.
40+
/// - For a closure, this is the address of the environment.
41+
/// - For an object or trait instance, this is the address of the vtable.
42+
/// - For a slice, this is the length.
43+
pub const FAT_PTR_EXTRA: usize = 1;
3244

3345
#[derive(Clone, Copy, PartialEq, Debug)]
3446
pub enum ArgKind {
@@ -130,7 +142,7 @@ impl FnType {
130142
abi: Abi,
131143
sig: &ty::FnSig<'tcx>,
132144
extra_args: &[Ty<'tcx>]) -> FnType {
133-
use syntax::abi::Abi::*;
145+
use self::Abi::*;
134146
let cconv = match ccx.sess().target.target.adjust_abi(abi) {
135147
RustIntrinsic => {
136148
// Intrinsics are emitted at the call site

src/librustc_trans/trans/adt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ use std;
4848
use std::rc::Rc;
4949

5050
use llvm::{ValueRef, True, IntEQ, IntNE};
51-
use back::abi::FAT_PTR_ADDR;
5251
use middle::subst;
5352
use middle::ty::{self, Ty, TyCtxt};
5453
use syntax::ast;
5554
use syntax::attr;
5655
use syntax::attr::IntType;
5756
use trans::_match;
57+
use trans::abi::FAT_PTR_ADDR;
5858
use trans::base::InitAlloca;
5959
use trans::build::*;
6060
use trans::cleanup;

src/librustc_trans/trans/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use middle::ty;
1515
use middle::infer;
1616
use middle::traits::ProjectionMode;
1717
use session::config::NoDebugInfo;
18-
use syntax::abi::Abi;
1918
pub use syntax::attr::InlineAttr;
2019
use syntax::ast;
2120
use rustc_front::hir;
21+
use trans::abi::Abi;
2222
use trans::base;
2323
use trans::common;
2424
use trans::context::CrateContext;

src/librustc_trans/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use super::CrateTranslation;
3030
use super::ModuleTranslation;
3131

3232
use back::link::mangle_exported_name;
33-
use back::{link, abi};
33+
use back::link;
3434
use lint;
3535
use llvm::{BasicBlockRef, Linkage, ValueRef, Vector, get_param};
3636
use llvm;
@@ -52,6 +52,7 @@ use rustc::mir::mir_map::MirMap;
5252
use session::config::{self, NoDebugInfo, FullDebugInfo};
5353
use session::Session;
5454
use trans::_match;
55+
use trans::abi::{self, Abi};
5556
use trans::adt;
5657
use trans::assert_dep_graph;
5758
use trans::attributes;
@@ -100,7 +101,6 @@ use std::cell::{Cell, RefCell};
100101
use std::collections::{HashMap, HashSet};
101102
use std::str;
102103
use std::{i8, i16, i32, i64};
103-
use syntax::abi::Abi;
104104
use syntax::codemap::{Span, DUMMY_SP};
105105
use syntax::parse::token::InternedString;
106106
use syntax::attr::AttrMetaMethods;

src/librustc_trans/trans/cabi_aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(non_upper_case_globals)]
1212

1313
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
14-
use trans::cabi::{FnType, ArgType};
14+
use trans::abi::{FnType, ArgType};
1515
use trans::context::CrateContext;
1616
use trans::type_::Type;
1717

src/librustc_trans/trans/cabi_arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(non_upper_case_globals)]
1212

1313
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
14-
use trans::cabi::{FnType, ArgType};
14+
use trans::abi::{FnType, ArgType};
1515
use trans::context::CrateContext;
1616
use trans::type_::Type;
1717

src/librustc_trans/trans/cabi_asmjs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(non_upper_case_globals)]
1212

1313
use llvm::{Struct, Array, Attribute};
14-
use trans::cabi::{FnType, ArgType};
14+
use trans::abi::{FnType, ArgType};
1515
use trans::context::CrateContext;
1616
use trans::type_::Type;
1717

src/librustc_trans/trans/cabi_mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use libc::c_uint;
1414
use std::cmp;
1515
use llvm;
1616
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Vector, Attribute};
17-
use trans::cabi::{ArgType, FnType};
17+
use trans::abi::{ArgType, FnType};
1818
use trans::context::CrateContext;
1919
use trans::type_::Type;
2020

src/librustc_trans/trans/cabi_powerpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use libc::c_uint;
1212
use llvm;
1313
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Attribute};
14-
use trans::cabi::{FnType, ArgType};
14+
use trans::abi::{FnType, ArgType};
1515
use trans::context::CrateContext;
1616
use trans::type_::Type;
1717

src/librustc_trans/trans/cabi_powerpc64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// need to be fixed when PowerPC vector support is added.
1717

1818
use llvm::{Integer, Pointer, Float, Double, Struct, Array, Attribute};
19-
use trans::cabi::{FnType, ArgType};
19+
use trans::abi::{FnType, ArgType};
2020
use trans::context::CrateContext;
2121
use trans::type_::Type;
2222

src/librustc_trans/trans/cabi_x86.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use llvm::*;
12-
use trans::cabi::{ArgType, FnType};
12+
use trans::abi::{ArgType, FnType};
1313
use trans::type_::Type;
1414
use super::common::*;
1515
use super::machine::*;

src/librustc_trans/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use self::RegClass::*;
1616

1717
use llvm::{Integer, Pointer, Float, Double};
1818
use llvm::{Struct, Array, Attribute, Vector};
19-
use trans::cabi::{ArgType, FnType};
19+
use trans::abi::{ArgType, FnType};
2020
use trans::context::CrateContext;
2121
use trans::type_::Type;
2222

src/librustc_trans/trans/cabi_x86_win64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use llvm::*;
1212
use super::common::*;
1313
use super::machine::*;
14-
use trans::cabi::{ArgType, FnType};
14+
use trans::abi::{ArgType, FnType};
1515
use trans::type_::Type;
1616

1717
// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx

src/librustc_trans/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use middle::subst;
2727
use middle::subst::{Substs};
2828
use middle::traits;
2929
use rustc::front::map as hir_map;
30+
use trans::abi::Abi;
3031
use trans::adt;
3132
use trans::attributes;
3233
use trans::base;
@@ -54,7 +55,6 @@ use trans::Disr;
5455
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
5556
use rustc_front::hir;
5657

57-
use syntax::abi::Abi;
5858
use syntax::ast;
5959
use syntax::codemap::DUMMY_SP;
6060
use syntax::errors;

src/librustc_trans/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use llvm::{ValueRef, get_params};
1414
use middle::def_id::DefId;
1515
use middle::infer;
1616
use middle::traits::ProjectionMode;
17+
use trans::abi::Abi::RustCall;
1718
use trans::adt;
1819
use trans::attributes;
1920
use trans::base::*;
@@ -32,7 +33,6 @@ use trans::Disr;
3233
use middle::ty;
3334
use session::config::FullDebugInfo;
3435

35-
use syntax::abi::Abi::RustCall;
3636
use syntax::ast;
3737
use syntax::attr::{ThinAttributes, ThinAttributesExt};
3838

src/librustc_trans/trans/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
12611261
output.push_str("unsafe ");
12621262
}
12631263

1264-
if abi != ::syntax::abi::Abi::Rust {
1264+
if abi != ::trans::abi::Abi::Rust {
12651265
output.push_str("extern \"");
12661266
output.push_str(abi.name());
12671267
output.push_str("\" ");

src/librustc_trans/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use middle::def_id::DefId;
2222
use middle::infer;
2323
use middle::lang_items::LangItem;
2424
use middle::subst::Substs;
25+
use trans::abi::Abi;
2526
use trans::base;
2627
use trans::build;
2728
use trans::builder::Builder;
@@ -49,7 +50,6 @@ use std::ops::Deref;
4950
use std::ffi::CString;
5051
use std::cell::{Cell, RefCell};
5152

52-
use syntax::abi::Abi;
5353
use syntax::ast;
5454
use syntax::codemap::{DUMMY_SP, Span};
5555
use syntax::parse::token::InternedString;

src/librustc_trans/trans/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111

12-
use back::abi;
1312
use llvm;
1413
use llvm::{ConstFCmp, ConstICmp, SetLinkage, SetUnnamedAddr};
1514
use llvm::{InternalLinkage, ValueRef, Bool, True};
@@ -19,7 +18,7 @@ use middle::const_eval::{self, ConstEvalErr};
1918
use middle::def::Def;
2019
use middle::def_id::DefId;
2120
use rustc::front::map as hir_map;
22-
use trans::{adt, closure, debuginfo, expr, inline, machine};
21+
use trans::{abi, adt, closure, debuginfo, expr, inline, machine};
2322
use trans::base::{self, exported_name, push_ctxt};
2423
use trans::callee::Callee;
2524
use trans::collector::{self, TransItem};

src/librustc_trans/trans/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use middle::subst::{self, Substs};
3232
use rustc_front;
3333
use rustc_front::hir;
3434

35+
use trans::abi::Abi;
3536
use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
3637
use trans;
3738
use trans::{monomorphize, type_of};
@@ -49,7 +50,6 @@ use std::rc::Rc;
4950

5051
use syntax::codemap::{Span, Pos};
5152
use syntax::{ast, codemap};
52-
use syntax::abi::Abi;
5353
use syntax::attr::IntType;
5454
use syntax::parse::token::{self, special_idents};
5555

src/librustc_trans/trans/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
107107
output.push_str("unsafe ");
108108
}
109109

110-
if abi != ::syntax::abi::Abi::Rust {
110+
if abi != ::trans::abi::Abi::Rust {
111111
output.push_str("extern \"");
112112
output.push_str(abi.name());
113113
output.push_str("\" ");

src/librustc_trans/trans/declare.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ use llvm::{self, ValueRef};
2323
use middle::ty;
2424
use middle::infer;
2525
use middle::traits::ProjectionMode;
26-
use syntax::abi::Abi;
26+
use trans::abi::{Abi, FnType};
2727
use trans::attributes;
2828
use trans::base;
29-
use trans::cabi::FnType;
3029
use trans::context::CrateContext;
3130
use trans::type_::Type;
3231
use trans::type_of;

src/librustc_trans/trans/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@
5151
pub use self::Dest::*;
5252
use self::lazy_binop_ty::*;
5353

54-
use back::abi;
5554
use llvm::{self, ValueRef, TypeKind};
5655
use middle::const_qualif::ConstQualif;
5756
use middle::def::Def;
5857
use middle::subst::Substs;
59-
use trans::{_match, adt, asm, base, closure, consts, controlflow};
58+
use trans::{_match, abi, adt, asm, base, closure, consts, controlflow};
6059
use trans::base::*;
6160
use trans::build::*;
6261
use trans::callee::{Callee, ArgExprs, ArgOverloadedCall, ArgOverloadedOp};

src/librustc_trans/trans/foreign.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
// except according to those terms.
1010

1111

12-
use back::{abi, link};
12+
use back::link;
1313
use llvm::{ValueRef, get_param};
1414
use llvm;
1515
use middle::weak_lang_items;
16+
use trans::abi::{self, Abi, FnType};
1617
use trans::attributes;
1718
use trans::base::{llvm_linkage_by_name, push_ctxt};
1819
use trans::base;
1920
use trans::build::*;
20-
use trans::cabi::FnType;
2121
use trans::common::*;
2222
use trans::debuginfo::DebugLoc;
2323
use trans::declare;
@@ -35,7 +35,6 @@ use middle::subst::Substs;
3535
use std::cmp;
3636
use std::iter::once;
3737
use libc::c_uint;
38-
use syntax::abi::Abi;
3938
use syntax::attr;
4039
use syntax::parse::token::{InternedString, special_idents};
4140
use syntax::ast;
@@ -715,7 +714,4 @@ pub fn link_name(name: ast::Name, attrs: &[ast::Attribute]) -> InternedString {
715714
None => name.as_str(),
716715
}
717716
}
718-
}
719-
}
720-
}
721717
}

src/librustc_trans/trans/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use llvm::{ValueRef, TypeKind};
1818
use middle::infer;
1919
use middle::subst;
2020
use middle::subst::FnSpace;
21+
use trans::abi::Abi;
2122
use trans::adt;
2223
use trans::attributes;
2324
use trans::base::*;
@@ -40,7 +41,6 @@ use trans::Disr;
4041
use middle::subst::Substs;
4142
use rustc::dep_graph::DepNode;
4243
use rustc_front::hir;
43-
use syntax::abi::Abi;
4444
use syntax::ast;
4545
use syntax::ptr::P;
4646
use syntax::parse::token;

0 commit comments

Comments
 (0)