Skip to content

Commit 2b984f6

Browse files
committed
---
yaml --- r: 81300 b: refs/heads/snap-stage3 c: 5e4ae4f h: refs/heads/master v: v3
1 parent c8096b4 commit 2b984f6

File tree

14 files changed

+123
-90
lines changed

14 files changed

+123
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f6df7ab839fef099af163463ae99b9541d3d12c5
4+
refs/heads/snap-stage3: 5e4ae4f45fab7ce1a984d5b5281e129f76486d10
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
343343
CFG_LDPATH_mips-unknown-linux-gnu :=
344344
CFG_RUN_mips-unknown-linux-gnu=
345345
CFG_RUN_TARG_mips-unknown-linux-gnu=
346-
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32 -Z soft-float
346+
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32
347347

348348
# i686-pc-mingw32 configuration
349349
CC_i686-pc-mingw32=$(CC)

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ pub mod write {
264264
session::Default => lib::llvm::CodeGenLevelDefault,
265265
session::Aggressive => lib::llvm::CodeGenLevelAggressive,
266266
};
267-
let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;
268267

269268
let tm = do sess.targ_cfg.target_strs.target_triple.with_c_str |T| {
270269
do sess.opts.target_cpu.with_c_str |CPU| {
@@ -274,8 +273,7 @@ pub mod write {
274273
lib::llvm::CodeModelDefault,
275274
lib::llvm::RelocPIC,
276275
OptLevel,
277-
true,
278-
use_softfp
276+
true
279277
)
280278
}
281279
}

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ pub static print_llvm_passes: uint = 1 << 26;
8080
pub static no_vectorize_loops: uint = 1 << 27;
8181
pub static no_vectorize_slp: uint = 1 << 28;
8282
pub static no_prepopulate_passes: uint = 1 << 29;
83-
pub static use_softfp: uint = 1 << 30;
8483

8584
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8685
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -136,7 +135,6 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
136135
(~"no-vectorize-slp",
137136
~"Don't run LLVM's SLP vectorization passes",
138137
no_vectorize_slp),
139-
(~"soft-float", ~"Generate software floating point library calls", use_softfp),
140138
]
141139
}
142140

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,8 +2149,7 @@ pub mod llvm {
21492149
Model: CodeGenModel,
21502150
Reloc: RelocMode,
21512151
Level: CodeGenOptLevel,
2152-
EnableSegstk: bool,
2153-
UseSoftFP: bool) -> TargetMachineRef;
2152+
EnableSegstk: bool) -> TargetMachineRef;
21542153
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
21552154
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
21562155
PM: PassManagerRef,

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
236236
_ => ()
237237
}
238238

239-
let uses_outptr = type_of::return_uses_outptr(ccx.tcx, output);
239+
let uses_outptr = type_of::return_uses_outptr(ccx, output);
240240
let offset = if uses_outptr { 2 } else { 1 };
241241

242242
for (i, &arg_ty) in inputs.iter().enumerate() {
@@ -1121,13 +1121,13 @@ pub fn do_spill_noroot(cx: @mut Block, v: ValueRef) -> ValueRef {
11211121

11221122
pub fn spill_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
11231123
let _icx = push_ctxt("spill_if_immediate");
1124-
if type_is_immediate(cx.tcx(), t) { return do_spill(cx, v, t); }
1124+
if type_is_immediate(cx.ccx(), t) { return do_spill(cx, v, t); }
11251125
return v;
11261126
}
11271127

11281128
pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
11291129
let _icx = push_ctxt("load_if_immediate");
1130-
if type_is_immediate(cx.tcx(), t) { return Load(cx, v); }
1130+
if type_is_immediate(cx.ccx(), t) { return Load(cx, v); }
11311131
return v;
11321132
}
11331133

@@ -1660,7 +1660,7 @@ pub fn mk_return_basic_block(llfn: ValueRef) -> BasicBlockRef {
16601660
// slot where the return value of the function must go.
16611661
pub fn make_return_pointer(fcx: @mut FunctionContext, output_type: ty::t) -> ValueRef {
16621662
unsafe {
1663-
if type_of::return_uses_outptr(fcx.ccx.tcx, output_type) {
1663+
if type_of::return_uses_outptr(fcx.ccx, output_type) {
16641664
llvm::LLVMGetParam(fcx.llfn, 0)
16651665
} else {
16661666
let lloutputtype = type_of::type_of(fcx.ccx, output_type);
@@ -1700,7 +1700,7 @@ pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext,
17001700
ty::subst_tps(ccx.tcx, substs.tys, substs.self_ty, output_type)
17011701
}
17021702
};
1703-
let uses_outptr = type_of::return_uses_outptr(ccx.tcx, substd_output_type);
1703+
let uses_outptr = type_of::return_uses_outptr(ccx, substd_output_type);
17041704
let debug_context = debuginfo::create_function_debug_context(ccx, id, param_substs, llfndecl);
17051705

17061706
let fcx = @mut FunctionContext {
@@ -1812,7 +1812,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
18121812
match fcx.llself {
18131813
Some(slf) => {
18141814
let self_val = if slf.is_copy
1815-
&& datum::appropriate_mode(bcx.tcx(), slf.t).is_by_value() {
1815+
&& datum::appropriate_mode(bcx.ccx(), slf.t).is_by_value() {
18161816
let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t));
18171817
let alloc = alloc_ty(bcx, slf.t, "__self");
18181818
Store(bcx, tmp, alloc);
@@ -1842,7 +1842,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
18421842
// This alloca should be optimized away by LLVM's mem-to-reg pass in
18431843
// the event it's not truly needed.
18441844
// only by value if immediate:
1845-
let llarg = if datum::appropriate_mode(bcx.tcx(), arg_ty).is_by_value() {
1845+
let llarg = if datum::appropriate_mode(bcx.ccx(), arg_ty).is_by_value() {
18461846
let alloc = alloc_ty(bcx, arg_ty, "__arg");
18471847
Store(bcx, raw_llarg, alloc);
18481848
alloc

branches/snap-stage3/src/librustc/middle/trans/callee.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
655655
// not care about the result, just make a stack slot.
656656
let opt_llretslot = match dest {
657657
None => {
658-
assert!(!type_of::return_uses_outptr(in_cx.tcx(), ret_ty));
658+
assert!(!type_of::return_uses_outptr(in_cx.ccx(), ret_ty));
659659
None
660660
}
661661
Some(expr::SaveIn(dst)) => Some(dst),
@@ -685,7 +685,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
685685

686686
// Push the out-pointer if we use an out-pointer for this
687687
// return type, otherwise push "undef".
688-
if type_of::return_uses_outptr(in_cx.tcx(), ret_ty) {
688+
if type_of::return_uses_outptr(in_cx.ccx(), ret_ty) {
689689
llargs.push(opt_llretslot.unwrap());
690690
}
691691

@@ -711,7 +711,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
711711
// any attributes with ABI implications directly to the call instruction. Right now, the
712712
// only attribute we need to worry about is `sret`.
713713
let mut attrs = ~[];
714-
if type_of::return_uses_outptr(in_cx.tcx(), ret_ty) {
714+
if type_of::return_uses_outptr(in_cx.ccx(), ret_ty) {
715715
attrs.push((1, StructRetAttribute));
716716
}
717717

@@ -734,7 +734,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
734734
// the return value, copy it into llretslot.
735735
match opt_llretslot {
736736
Some(llretslot) => {
737-
if !type_of::return_uses_outptr(bcx.tcx(), ret_ty) &&
737+
if !type_of::return_uses_outptr(bcx.ccx(), ret_ty) &&
738738
!ty::type_is_voidish(ret_ty)
739739
{
740740
Store(bcx, llret, llretslot);
@@ -758,7 +758,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
758758
// drop the temporary slot we made.
759759
match dest {
760760
None => {
761-
assert!(!type_of::return_uses_outptr(bcx.tcx(), ret_ty));
761+
assert!(!type_of::return_uses_outptr(bcx.ccx(), ret_ty));
762762
}
763763
Some(expr::Ignore) => {
764764
// drop the value if it is not being saved.
@@ -871,7 +871,7 @@ pub fn trans_arg_expr(bcx: @mut Block,
871871
DontAutorefArg => {
872872
let need_scratch = ty::type_needs_drop(bcx.tcx(), arg_datum.ty) ||
873873
(bcx.expr_is_lval(arg_expr) &&
874-
arg_datum.appropriate_mode(bcx.tcx()).is_by_ref());
874+
arg_datum.appropriate_mode(bcx.ccx()).is_by_ref());
875875

876876
let arg_datum = if need_scratch {
877877
let scratch = scratch_datum(bcx, arg_datum.ty, "__self", false);

branches/snap-stage3/src/librustc/middle/trans/common.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,37 @@ use syntax::{ast, ast_map};
4646

4747
pub use middle::trans::context::CrateContext;
4848

49-
fn type_is_newtype_immediate(cx: ty::ctxt, ty: ty::t) -> bool {
49+
fn type_is_newtype_immediate(ccx: &mut CrateContext, ty: ty::t) -> bool {
5050
match ty::get(ty).sty {
5151
ty::ty_struct(def_id, ref substs) => {
52-
let fields = ty::struct_fields(cx, def_id, substs);
52+
let fields = ty::struct_fields(ccx.tcx, def_id, substs);
5353
fields.len() == 1 &&
5454
fields[0].ident.name == token::special_idents::unnamed_field.name &&
55-
type_is_immediate(cx, fields[0].mt.ty)
55+
type_is_immediate(ccx, fields[0].mt.ty)
5656
}
5757
_ => false
5858
}
5959
}
6060

61-
pub fn type_is_immediate(cx: ty::ctxt, ty: ty::t) -> bool {
62-
ty::type_is_scalar(ty) || ty::type_is_boxed(ty) ||
61+
pub fn type_is_immediate(ccx: &mut CrateContext, ty: ty::t) -> bool {
62+
use middle::trans::machine::llsize_of_alloc;
63+
use middle::trans::type_of::sizing_type_of;
64+
let tcx = ccx.tcx;
65+
let simple = ty::type_is_scalar(ty) || ty::type_is_boxed(ty) ||
6366
ty::type_is_unique(ty) || ty::type_is_region_ptr(ty) ||
64-
type_is_newtype_immediate(cx, ty) ||
65-
ty::type_is_simd(cx, ty)
67+
type_is_newtype_immediate(ccx, ty) ||
68+
ty::type_is_simd(tcx, ty);
69+
if simple {
70+
return true;
71+
}
72+
match ty::get(ty).sty {
73+
// FIXME: #9651: small `ty_struct` and `ty_enum` should also be immediate
74+
ty::ty_tup(*) => {
75+
let llty = sizing_type_of(ccx, ty);
76+
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type)
77+
}
78+
_ => false
79+
}
6680
}
6781

6882
pub fn gensym_name(name: &str) -> (Ident, path_elt) {

branches/snap-stage3/src/librustc/middle/trans/datum.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub fn scratch_datum(bcx: @mut Block, ty: ty::t, name: &str, zero: bool) -> Datu
188188
Datum { val: scratch, ty: ty, mode: ByRef(RevokeClean) }
189189
}
190190

191-
pub fn appropriate_mode(tcx: ty::ctxt, ty: ty::t) -> DatumMode {
191+
pub fn appropriate_mode(ccx: &mut CrateContext, ty: ty::t) -> DatumMode {
192192
/*!
193193
* Indicates the "appropriate" mode for this value,
194194
* which is either by ref or by value, depending
@@ -197,7 +197,7 @@ pub fn appropriate_mode(tcx: ty::ctxt, ty: ty::t) -> DatumMode {
197197

198198
if ty::type_is_voidish(ty) {
199199
ByValue
200-
} else if type_is_immediate(tcx, ty) {
200+
} else if type_is_immediate(ccx, ty) {
201201
ByValue
202202
} else {
203203
ByRef(RevokeClean)
@@ -505,18 +505,18 @@ impl Datum {
505505
}
506506
}
507507

508-
pub fn appropriate_mode(&self, tcx: ty::ctxt) -> DatumMode {
508+
pub fn appropriate_mode(&self, ccx: &mut CrateContext) -> DatumMode {
509509
/*! See the `appropriate_mode()` function */
510510

511-
appropriate_mode(tcx, self.ty)
511+
appropriate_mode(ccx, self.ty)
512512
}
513513

514514
pub fn to_appropriate_llval(&self, bcx: @mut Block) -> ValueRef {
515515
/*!
516516
*
517517
* Yields an llvalue with the `appropriate_mode()`. */
518518

519-
match self.appropriate_mode(bcx.tcx()) {
519+
match self.appropriate_mode(bcx.ccx()) {
520520
ByValue => self.to_value_llval(bcx),
521521
ByRef(_) => self.to_ref_llval(bcx)
522522
}
@@ -527,7 +527,7 @@ impl Datum {
527527
*
528528
* Yields a datum with the `appropriate_mode()`. */
529529

530-
match self.appropriate_mode(bcx.tcx()) {
530+
match self.appropriate_mode(bcx.ccx()) {
531531
ByValue => self.to_value_datum(bcx),
532532
ByRef(_) => self.to_ref_datum(bcx)
533533
}
@@ -667,7 +667,7 @@ impl Datum {
667667
ByValue => {
668668
// Actually, this case cannot happen right
669669
// now, because enums are never immediate.
670-
assert!(type_is_immediate(bcx.tcx(), ty));
670+
assert!(type_is_immediate(bcx.ccx(), ty));
671671
(Some(Datum {ty: ty, ..*self}), bcx)
672672
}
673673
};
@@ -699,7 +699,7 @@ impl Datum {
699699
)
700700
}
701701
ByValue => {
702-
assert!(type_is_immediate(bcx.tcx(), ty));
702+
assert!(type_is_immediate(bcx.ccx(), ty));
703703
(
704704
Some(Datum {
705705
val: ExtractValue(bcx, self.val, 0),

branches/snap-stage3/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
290290
debug!("add_env(closure_ty=%s)", closure_ty.repr(tcx));
291291
let scratch = scratch_datum(bcx, closure_ty, "__adjust", false);
292292
let llfn = GEPi(bcx, scratch.val, [0u, abi::fn_field_code]);
293-
assert_eq!(datum.appropriate_mode(tcx), ByValue);
293+
assert_eq!(datum.appropriate_mode(bcx.ccx()), ByValue);
294294
Store(bcx, datum.to_appropriate_llval(bcx), llfn);
295295
let llenv = GEPi(bcx, scratch.val, [0u, abi::fn_field_box]);
296296
Store(bcx, base::null_env_ptr(bcx.ccx()), llenv);

branches/snap-stage3/src/librustc/middle/trans/foreign.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
492492

493493
// Push Rust return pointer, using null if it will be unused.
494494
let rust_uses_outptr =
495-
type_of::return_uses_outptr(tcx, tys.fn_sig.output);
495+
type_of::return_uses_outptr(ccx, tys.fn_sig.output);
496496
let return_alloca: Option<ValueRef>;
497497
let llrust_ret_ty = tys.llsig.llret_ty;
498498
let llrust_retptr_ty = llrust_ret_ty.ptr_to();
@@ -702,7 +702,7 @@ fn foreign_signature(ccx: &mut CrateContext, fn_sig: &ty::FnSig)
702702
LlvmSignature {
703703
llarg_tys: llarg_tys,
704704
llret_ty: llret_ty,
705-
sret: type_of::return_uses_outptr(ccx.tcx, fn_sig.output),
705+
sret: type_of::return_uses_outptr(ccx, fn_sig.output),
706706
}
707707
}
708708

0 commit comments

Comments
 (0)