Skip to content

Commit f170c87

Browse files
committed
---
yaml --- r: 148732 b: refs/heads/try2 c: a1f157b h: refs/heads/master v: v3
1 parent e17b2b1 commit f170c87

File tree

22 files changed

+471
-365
lines changed

22 files changed

+471
-365
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 431edacbef23e691d1b192da78b4112c35addfbf
8+
refs/heads/try2: a1f157b6ee5284614b1c5ca1f1a16102c0b12997
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rustdoc.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,14 @@ that one can still write things like `#[deriving(Eq)]`).
139139

140140
~~~
141141
```rust
142-
# // showing 'fib' in this documentation would just be tedious and detracts from
143-
# // what's actualy being documented.
144-
# fn fib(n: int) { n + 2 }
142+
# /!\ The three following lines are comments, which are usually stripped off by
143+
# the doc-generating tool. In order to display them anyway in this particular
144+
# case, the character following the leading '#' is not a usual space like in
145+
# these first five lines but a non breakable one.
146+
#
147+
# // showing 'fib' in this documentation would just be tedious and detracts from
148+
# // what's actualy being documented.
149+
# fn fib(n: int) { n + 2 }
145150
146151
do spawn { fib(200); }
147152
```

branches/try2/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ match mypoint {
646646
## Enums
647647

648648
Enums are datatypes that have several alternate representations. For
649-
example, consider the type shown earlier:
649+
example, consider the following type:
650650

651651
~~~~
652652
# struct Point { x: f64, y: f64 }

branches/try2/src/librustc/back/link.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub mod write {
9696
use lib::llvm::llvm;
9797
use lib::llvm::{ModuleRef, TargetMachineRef, PassManagerRef};
9898
use lib;
99+
use syntax::abi;
99100
use util::common::time;
100101

101102
use std::c_str::ToCStr;
@@ -129,7 +130,10 @@ pub mod write {
129130
let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0;
130131

131132
// FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
132-
let no_fp_elim = sess.opts.debuginfo;
133+
// FIXME: #11954: mac64 unwinding may not work with fp elim
134+
let no_fp_elim = sess.opts.debuginfo ||
135+
(sess.targ_cfg.os == abi::OsMacos &&
136+
sess.targ_cfg.arch == abi::X86_64);
133137

134138
let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
135139
sess.opts.target_cpu.with_c_str(|CPU| {

branches/try2/src/librustc/middle/const_eval.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
use metadata::csearch;
1313
use middle::astencode;
14+
1415
use middle::ty;
16+
use middle::typeck::astconv;
1517
use middle;
1618

1719
use syntax::{ast, ast_map, ast_util};
@@ -445,8 +447,17 @@ pub fn eval_const_expr_partial<T: ty::ExprTyProvider>(tcx: &T, e: &Expr)
445447
_ => Err(~"Bad operands for binary")
446448
}
447449
}
448-
ExprCast(base, _) => {
449-
let ety = tcx.expr_ty(e);
450+
ExprCast(base, target_ty) => {
451+
// This tends to get called w/o the type actually having been
452+
// populated in the ctxt, which was causing things to blow up
453+
// (#5900). Fall back to doing a limited lookup to get past it.
454+
let ety = ty::expr_ty_opt(tcx.ty_ctxt(), e)
455+
.or_else(|| astconv::ast_ty_to_prim_ty(tcx.ty_ctxt(), target_ty))
456+
.unwrap_or_else(|| tcx.ty_ctxt().sess.span_fatal(
457+
target_ty.span,
458+
format!("Target type not found for const cast")
459+
));
460+
450461
let base = eval_const_expr_partial(tcx, base);
451462
match base {
452463
Err(_) => base,

branches/try2/src/librustc/middle/trans/intrinsic.rs

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,68 @@ use util::ppaux::ty_to_str;
2929
use middle::trans::machine::llsize_of;
3030
use middle::trans::type_::Type;
3131

32+
pub fn get_simple_intrinsic(ccx: @CrateContext, item: &ast::ForeignItem) -> Option<ValueRef> {
33+
let nm = ccx.sess.str_of(item.ident);
34+
let name = nm.as_slice();
35+
36+
match name {
37+
"sqrtf32" => Some(ccx.intrinsics.get_copy(&("llvm.sqrt.f32"))),
38+
"sqrtf64" => Some(ccx.intrinsics.get_copy(&("llvm.sqrt.f64"))),
39+
"powif32" => Some(ccx.intrinsics.get_copy(&("llvm.powi.f32"))),
40+
"powif64" => Some(ccx.intrinsics.get_copy(&("llvm.powi.f64"))),
41+
"sinf32" => Some(ccx.intrinsics.get_copy(&("llvm.sin.f32"))),
42+
"sinf64" => Some(ccx.intrinsics.get_copy(&("llvm.sin.f64"))),
43+
"cosf32" => Some(ccx.intrinsics.get_copy(&("llvm.cos.f32"))),
44+
"cosf64" => Some(ccx.intrinsics.get_copy(&("llvm.cos.f64"))),
45+
"powf32" => Some(ccx.intrinsics.get_copy(&("llvm.pow.f32"))),
46+
"powf64" => Some(ccx.intrinsics.get_copy(&("llvm.pow.f64"))),
47+
"expf32" => Some(ccx.intrinsics.get_copy(&("llvm.exp.f32"))),
48+
"expf64" => Some(ccx.intrinsics.get_copy(&("llvm.exp.f64"))),
49+
"exp2f32" => Some(ccx.intrinsics.get_copy(&("llvm.exp2.f32"))),
50+
"exp2f64" => Some(ccx.intrinsics.get_copy(&("llvm.exp2.f64"))),
51+
"logf32" => Some(ccx.intrinsics.get_copy(&("llvm.log.f32"))),
52+
"logf64" => Some(ccx.intrinsics.get_copy(&("llvm.log.f64"))),
53+
"log10f32" => Some(ccx.intrinsics.get_copy(&("llvm.log10.f32"))),
54+
"log10f64" => Some(ccx.intrinsics.get_copy(&("llvm.log10.f64"))),
55+
"log2f32" => Some(ccx.intrinsics.get_copy(&("llvm.log2.f32"))),
56+
"log2f64" => Some(ccx.intrinsics.get_copy(&("llvm.log2.f64"))),
57+
"fmaf32" => Some(ccx.intrinsics.get_copy(&("llvm.fma.f32"))),
58+
"fmaf64" => Some(ccx.intrinsics.get_copy(&("llvm.fma.f64"))),
59+
"fabsf32" => Some(ccx.intrinsics.get_copy(&("llvm.fabs.f32"))),
60+
"fabsf64" => Some(ccx.intrinsics.get_copy(&("llvm.fabs.f64"))),
61+
"copysignf32" => Some(ccx.intrinsics.get_copy(&("llvm.copysign.f32"))),
62+
"copysignf64" => Some(ccx.intrinsics.get_copy(&("llvm.copysign.f64"))),
63+
"floorf32" => Some(ccx.intrinsics.get_copy(&("llvm.floor.f32"))),
64+
"floorf64" => Some(ccx.intrinsics.get_copy(&("llvm.floor.f64"))),
65+
"ceilf32" => Some(ccx.intrinsics.get_copy(&("llvm.ceil.f32"))),
66+
"ceilf64" => Some(ccx.intrinsics.get_copy(&("llvm.ceil.f64"))),
67+
"truncf32" => Some(ccx.intrinsics.get_copy(&("llvm.trunc.f32"))),
68+
"truncf64" => Some(ccx.intrinsics.get_copy(&("llvm.trunc.f64"))),
69+
"rintf32" => Some(ccx.intrinsics.get_copy(&("llvm.rint.f32"))),
70+
"rintf64" => Some(ccx.intrinsics.get_copy(&("llvm.rint.f64"))),
71+
"nearbyintf32" => Some(ccx.intrinsics.get_copy(&("llvm.nearbyint.f32"))),
72+
"nearbyintf64" => Some(ccx.intrinsics.get_copy(&("llvm.nearbyint.f64"))),
73+
"roundf32" => Some(ccx.intrinsics.get_copy(&("llvm.round.f32"))),
74+
"roundf64" => Some(ccx.intrinsics.get_copy(&("llvm.round.f64"))),
75+
"ctpop8" => Some(ccx.intrinsics.get_copy(&("llvm.ctpop.i8"))),
76+
"ctpop16" => Some(ccx.intrinsics.get_copy(&("llvm.ctpop.i16"))),
77+
"ctpop32" => Some(ccx.intrinsics.get_copy(&("llvm.ctpop.i32"))),
78+
"ctpop64" => Some(ccx.intrinsics.get_copy(&("llvm.ctpop.i64"))),
79+
"bswap16" => Some(ccx.intrinsics.get_copy(&("llvm.bswap.i16"))),
80+
"bswap32" => Some(ccx.intrinsics.get_copy(&("llvm.bswap.i32"))),
81+
"bswap64" => Some(ccx.intrinsics.get_copy(&("llvm.bswap.i64"))),
82+
_ => None
83+
}
84+
}
85+
3286
pub fn trans_intrinsic(ccx: @CrateContext,
3387
decl: ValueRef,
3488
item: &ast::ForeignItem,
3589
path: ast_map::Path,
3690
substs: @param_substs,
37-
_attributes: &[ast::Attribute],
3891
ref_id: Option<ast::NodeId>) {
3992
debug!("trans_intrinsic(item.ident={})", ccx.sess.str_of(item.ident));
4093

41-
fn simple_llvm_intrinsic(bcx: &Block, name: &'static str, num_args: uint) {
42-
assert!(num_args <= 4);
43-
let mut args = [0 as ValueRef, ..4];
44-
let first_real_arg = bcx.fcx.arg_pos(0u);
45-
for i in range(0u, num_args) {
46-
args[i] = get_param(bcx.fcx.llfn, first_real_arg + i);
47-
}
48-
let llfn = bcx.ccx().intrinsics.get_copy(&name);
49-
let llcall = Call(bcx, llfn, args.slice(0, num_args), []);
50-
Ret(bcx, llcall);
51-
}
52-
5394
fn with_overflow_instrinsic(bcx: &Block, name: &'static str, t: ty::t) {
5495
let first_real_arg = bcx.fcx.arg_pos(0u);
5596
let a = get_param(bcx.fcx.llfn, first_real_arg);
@@ -431,48 +472,6 @@ pub fn trans_intrinsic(ccx: @CrateContext,
431472
"copy_nonoverlapping_memory" => copy_intrinsic(bcx, false, substs.tys[0]),
432473
"copy_memory" => copy_intrinsic(bcx, true, substs.tys[0]),
433474
"set_memory" => memset_intrinsic(bcx, substs.tys[0]),
434-
"sqrtf32" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f32", 1),
435-
"sqrtf64" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f64", 1),
436-
"powif32" => simple_llvm_intrinsic(bcx, "llvm.powi.f32", 2),
437-
"powif64" => simple_llvm_intrinsic(bcx, "llvm.powi.f64", 2),
438-
"sinf32" => simple_llvm_intrinsic(bcx, "llvm.sin.f32", 1),
439-
"sinf64" => simple_llvm_intrinsic(bcx, "llvm.sin.f64", 1),
440-
"cosf32" => simple_llvm_intrinsic(bcx, "llvm.cos.f32", 1),
441-
"cosf64" => simple_llvm_intrinsic(bcx, "llvm.cos.f64", 1),
442-
"powf32" => simple_llvm_intrinsic(bcx, "llvm.pow.f32", 2),
443-
"powf64" => simple_llvm_intrinsic(bcx, "llvm.pow.f64", 2),
444-
"expf32" => simple_llvm_intrinsic(bcx, "llvm.exp.f32", 1),
445-
"expf64" => simple_llvm_intrinsic(bcx, "llvm.exp.f64", 1),
446-
"exp2f32" => simple_llvm_intrinsic(bcx, "llvm.exp2.f32", 1),
447-
"exp2f64" => simple_llvm_intrinsic(bcx, "llvm.exp2.f64", 1),
448-
"logf32" => simple_llvm_intrinsic(bcx, "llvm.log.f32", 1),
449-
"logf64" => simple_llvm_intrinsic(bcx, "llvm.log.f64", 1),
450-
"log10f32" => simple_llvm_intrinsic(bcx, "llvm.log10.f32", 1),
451-
"log10f64" => simple_llvm_intrinsic(bcx, "llvm.log10.f64", 1),
452-
"log2f32" => simple_llvm_intrinsic(bcx, "llvm.log2.f32", 1),
453-
"log2f64" => simple_llvm_intrinsic(bcx, "llvm.log2.f64", 1),
454-
"fmaf32" => simple_llvm_intrinsic(bcx, "llvm.fma.f32", 3),
455-
"fmaf64" => simple_llvm_intrinsic(bcx, "llvm.fma.f64", 3),
456-
"fabsf32" => simple_llvm_intrinsic(bcx, "llvm.fabs.f32", 1),
457-
"fabsf64" => simple_llvm_intrinsic(bcx, "llvm.fabs.f64", 1),
458-
"copysignf32" => simple_llvm_intrinsic(bcx, "llvm.copysign.f32", 2),
459-
"copysignf64" => simple_llvm_intrinsic(bcx, "llvm.copysign.f64", 2),
460-
"floorf32" => simple_llvm_intrinsic(bcx, "llvm.floor.f32", 1),
461-
"floorf64" => simple_llvm_intrinsic(bcx, "llvm.floor.f64", 1),
462-
"ceilf32" => simple_llvm_intrinsic(bcx, "llvm.ceil.f32", 1),
463-
"ceilf64" => simple_llvm_intrinsic(bcx, "llvm.ceil.f64", 1),
464-
"truncf32" => simple_llvm_intrinsic(bcx, "llvm.trunc.f32", 1),
465-
"truncf64" => simple_llvm_intrinsic(bcx, "llvm.trunc.f64", 1),
466-
"rintf32" => simple_llvm_intrinsic(bcx, "llvm.rint.f32", 1),
467-
"rintf64" => simple_llvm_intrinsic(bcx, "llvm.rint.f64", 1),
468-
"nearbyintf32" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f32", 1),
469-
"nearbyintf64" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f64", 1),
470-
"roundf32" => simple_llvm_intrinsic(bcx, "llvm.round.f32", 1),
471-
"roundf64" => simple_llvm_intrinsic(bcx, "llvm.round.f64", 1),
472-
"ctpop8" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i8", 1),
473-
"ctpop16" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i16", 1),
474-
"ctpop32" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i32", 1),
475-
"ctpop64" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i64", 1),
476475
"ctlz8" => count_zeros_intrinsic(bcx, "llvm.ctlz.i8"),
477476
"ctlz16" => count_zeros_intrinsic(bcx, "llvm.ctlz.i16"),
478477
"ctlz32" => count_zeros_intrinsic(bcx, "llvm.ctlz.i32"),
@@ -481,9 +480,6 @@ pub fn trans_intrinsic(ccx: @CrateContext,
481480
"cttz16" => count_zeros_intrinsic(bcx, "llvm.cttz.i16"),
482481
"cttz32" => count_zeros_intrinsic(bcx, "llvm.cttz.i32"),
483482
"cttz64" => count_zeros_intrinsic(bcx, "llvm.cttz.i64"),
484-
"bswap16" => simple_llvm_intrinsic(bcx, "llvm.bswap.i16", 1),
485-
"bswap32" => simple_llvm_intrinsic(bcx, "llvm.bswap.i32", 1),
486-
"bswap64" => simple_llvm_intrinsic(bcx, "llvm.bswap.i64", 1),
487483

488484
"volatile_load" => volatile_load_intrinsic(bcx),
489485
"volatile_store" => volatile_store_intrinsic(bcx),

0 commit comments

Comments
 (0)