Skip to content

Commit 3e44f8f

Browse files
committed
---
yaml --- r: 273227 b: refs/heads/beta c: 16201d4 h: refs/heads/master i: 273225: f8c5a79 273223: 59f15f7
1 parent 17d5e99 commit 3e44f8f

File tree

14 files changed

+198
-227
lines changed

14 files changed

+198
-227
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 062a05dde8c3ea5386fa358d882e1eaca99a9ff0
26+
refs/heads/beta: 16201d45f16845cb5dc2fc0b48bcf34a6715ea14
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_trans/trans/_match.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,13 @@ use middle::lang_items::StrEqFnLangItem;
200200
use middle::mem_categorization as mc;
201201
use middle::mem_categorization::Categorization;
202202
use middle::pat_util::*;
203+
use middle::subst::Substs;
203204
use trans::adt;
204205
use trans::base::*;
205206
use trans::build::{AddCase, And, Br, CondBr, GEPi, InBoundsGEP, Load, PointerCast};
206207
use trans::build::{Not, Store, Sub, add_comment};
207208
use trans::build;
208-
use trans::callee;
209+
use trans::callee::{Callee, ArgVals};
209210
use trans::cleanup::{self, CleanupMethods, DropHintMethods};
210211
use trans::common::*;
211212
use trans::consts;
@@ -881,19 +882,21 @@ fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
881882
rhs_t: Ty<'tcx>,
882883
debug_loc: DebugLoc)
883884
-> Result<'blk, 'tcx> {
884-
fn compare_str<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
885+
fn compare_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
885886
lhs_data: ValueRef,
886887
lhs_len: ValueRef,
887888
rhs_data: ValueRef,
888889
rhs_len: ValueRef,
889890
rhs_t: Ty<'tcx>,
890891
debug_loc: DebugLoc)
891892
-> Result<'blk, 'tcx> {
892-
let did = langcall(cx,
893+
let did = langcall(bcx,
893894
None,
894895
&format!("comparison of `{}`", rhs_t),
895896
StrEqFnLangItem);
896-
callee::trans_lang_call(cx, did, &[lhs_data, lhs_len, rhs_data, rhs_len], None, debug_loc)
897+
let args = [lhs_data, lhs_len, rhs_data, rhs_len];
898+
Callee::def(bcx.ccx(), did, bcx.tcx().mk_substs(Substs::empty()))
899+
.call(bcx, debug_loc, ArgVals(&args), None)
897900
}
898901

899902
let _icx = push_ctxt("compare_values");

branches/beta/src/librustc_trans/trans/base.rs

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use trans::assert_dep_graph;
5757
use trans::attributes;
5858
use trans::build::*;
5959
use trans::builder::{Builder, noname};
60-
use trans::callee;
60+
use trans::callee::{Callee, CallArgs, ArgExprs, ArgVals};
6161
use trans::cleanup::{self, CleanupMethods, DropHint};
6262
use trans::closure;
6363
use trans::common::{Block, C_bool, C_bytes_in_context, C_i32, C_int, C_uint, C_integral};
@@ -280,11 +280,9 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
280280
let _icx = push_ctxt("malloc_raw_exchange");
281281

282282
// Allocate space:
283-
let r = callee::trans_lang_call(bcx,
284-
require_alloc_fn(bcx, info_ty, ExchangeMallocFnLangItem),
285-
&[size, align],
286-
None,
287-
debug_loc);
283+
let def_id = require_alloc_fn(bcx, info_ty, ExchangeMallocFnLangItem);
284+
let r = Callee::def(bcx.ccx(), def_id, bcx.tcx().mk_substs(Substs::empty()))
285+
.call(bcx, debug_loc, ArgVals(&[size, align]), None);
288286

289287
Result::new(r.bcx, PointerCast(r.bcx, r.val, llty_ptr))
290288
}
@@ -1219,9 +1217,8 @@ pub fn trans_unwind_resume(bcx: Block, lpval: ValueRef) {
12191217
Resume(bcx, lpval);
12201218
} else {
12211219
let exc_ptr = ExtractValue(bcx, lpval, 0);
1222-
let llunwresume = bcx.fcx.eh_unwind_resume();
1223-
Call(bcx, llunwresume, &[exc_ptr], None, DebugLoc::None);
1224-
Unreachable(bcx);
1220+
bcx.fcx.eh_unwind_resume()
1221+
.call(bcx, DebugLoc::None, ArgVals(&[exc_ptr]), None);
12251222
}
12261223
}
12271224

@@ -2147,20 +2144,10 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
21472144
closure::ClosureEnv::NotClosure);
21482145
}
21492146

2150-
pub fn trans_enum_variant<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
2151-
ctor_id: ast::NodeId,
2152-
disr: Disr,
2153-
param_substs: &'tcx Substs<'tcx>,
2154-
llfndecl: ValueRef) {
2155-
let _icx = push_ctxt("trans_enum_variant");
2156-
2157-
trans_enum_variant_or_tuple_like_struct(ccx, ctor_id, disr, param_substs, llfndecl);
2158-
}
2159-
21602147
pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
21612148
ctor_ty: Ty<'tcx>,
21622149
disr: Disr,
2163-
args: callee::CallArgs,
2150+
args: CallArgs,
21642151
dest: expr::Dest,
21652152
debug_loc: DebugLoc)
21662153
-> Result<'blk, 'tcx> {
@@ -2188,7 +2175,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
21882175

21892176
if !type_is_zero_size(ccx, result_ty) {
21902177
match args {
2191-
callee::ArgExprs(exprs) => {
2178+
ArgExprs(exprs) => {
21922179
let fields = exprs.iter().map(|x| &**x).enumerate().collect::<Vec<_>>();
21932180
bcx = expr::trans_adt(bcx,
21942181
result_ty,
@@ -2204,7 +2191,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
22042191
// Just eval all the expressions (if any). Since expressions in Rust can have arbitrary
22052192
// contents, there could be side-effects we need from them.
22062193
match args {
2207-
callee::ArgExprs(exprs) => {
2194+
ArgExprs(exprs) => {
22082195
for expr in exprs {
22092196
bcx = expr::trans_into(bcx, expr, expr::Ignore);
22102197
}
@@ -2500,8 +2487,9 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
25002487
// compilation unit that references the item, so it will still get
25012488
// translated everywhere it's needed.
25022489
for (ref ccx, is_origin) in ccx.maybe_iter(!from_external && trans_everywhere) {
2503-
let llfn = get_item_val(ccx, item.id);
2504-
let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
2490+
let empty_substs = tcx.mk_substs(Substs::trans_empty());
2491+
let def_id = tcx.map.local_def_id(item.id);
2492+
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
25052493
if abi != Abi::Rust {
25062494
foreign::trans_rust_fn_with_foreign_abi(ccx,
25072495
&decl,
@@ -2536,9 +2524,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
25362524
// error in trans. This is used to write compile-fail tests
25372525
// that actually test that compilation succeeds without
25382526
// reporting an error.
2539-
let item_def_id = ccx.tcx().map.local_def_id(item.id);
2540-
if ccx.tcx().has_attr(item_def_id, "rustc_error") {
2541-
ccx.tcx().sess.span_fatal(item.span, "compilation successful");
2527+
if tcx.has_attr(def_id, "rustc_error") {
2528+
tcx.sess.span_fatal(item.span, "compilation successful");
25422529
}
25432530
}
25442531
}
@@ -2671,17 +2658,10 @@ pub fn create_entry_wrapper(ccx: &CrateContext, sp: Span, main_llfn: ValueRef) {
26712658
let (start_fn, args) = if use_start_lang_item {
26722659
let start_def_id = match ccx.tcx().lang_items.require(StartFnLangItem) {
26732660
Ok(id) => id,
2674-
Err(s) => {
2675-
ccx.sess().fatal(&s[..]);
2676-
}
2677-
};
2678-
let start_fn = if let Some(start_node_id) = ccx.tcx()
2679-
.map
2680-
.as_local_node_id(start_def_id) {
2681-
get_item_val(ccx, start_node_id)
2682-
} else {
2683-
get_extern_fn(ccx, start_def_id).val
2661+
Err(s) => ccx.sess().fatal(&s)
26842662
};
2663+
let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
2664+
let start_fn = Callee::def(ccx, start_def_id, empty_substs).reify(ccx).val;
26852665
let args = {
26862666
let opaque_rust_main =
26872667
llvm::LLVMBuildPointerCast(bld,

0 commit comments

Comments
 (0)