Skip to content

Commit 047c448

Browse files
committed
---
yaml --- r: 143869 b: refs/heads/try2 c: 96254b4 h: refs/heads/master i: 143867: 6e316c9 v: v3
1 parent 03482dc commit 047c448

34 files changed

+212
-927
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: 63c62bea3ac2782ae421d5bd211f2e7393bad7a2
8+
refs/heads/try2: 96254b4090a86767d1a3b387158464ece44160fa
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,9 +2082,6 @@ pub mod llvm {
20822082
Elements: ValueRef,
20832083
RunTimeLang: c_uint)
20842084
-> ValueRef;
2085-
2086-
#[fast_ffi]
2087-
pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
20882085
}
20892086
}
20902087

@@ -2104,12 +2101,6 @@ pub fn SetLinkage(Global: ValueRef, Link: Linkage) {
21042101
}
21052102
}
21062103

2107-
pub fn SetUnnamedAddr(Global: ValueRef, Unnamed: bool) {
2108-
unsafe {
2109-
llvm::LLVMSetUnnamedAddr(Global, Unnamed as Bool);
2110-
}
2111-
}
2112-
21132104
pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
21142105
unsafe {
21152106
llvm::LLVMConstICmp(Pred as c_ushort, V1, V2)

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

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,18 +2180,19 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
21802180
}
21812181
ast::item_static(_, m, expr) => {
21822182
consts::trans_const(ccx, m, item.id);
2183-
// Do static_assert checking. It can't really be done much earlier
2184-
// because we need to get the value of the bool out of LLVM
2185-
if attr::contains_name(item.attrs, "static_assert") {
2186-
if m == ast::m_mutbl {
2187-
ccx.sess.span_fatal(expr.span,
2188-
"cannot have static_assert on a mutable \
2189-
static");
2190-
}
2191-
let v = ccx.const_values.get_copy(&item.id);
2192-
unsafe {
2193-
if !(llvm::LLVMConstIntGetZExtValue(v) as bool) {
2194-
ccx.sess.span_fatal(expr.span, "static assertion failed");
2183+
// Do static_assert checking. It can't really be done much earlier because we need to get
2184+
// the value of the bool out of LLVM
2185+
for attr in item.attrs.iter() {
2186+
if "static_assert" == attr.name() {
2187+
if m == ast::m_mutbl {
2188+
ccx.sess.span_fatal(expr.span,
2189+
"cannot have static_assert on a mutable static");
2190+
}
2191+
let v = ccx.const_values.get_copy(&item.id);
2192+
unsafe {
2193+
if !(llvm::LLVMConstIntGetZExtValue(v) as bool) {
2194+
ccx.sess.span_fatal(expr.span, "static assertion failed");
2195+
}
21952196
}
21962197
}
21972198
}
@@ -2451,15 +2452,6 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
24512452
llvm::LLVMAddGlobal(ccx.llmod, llty, buf)
24522453
};
24532454

2454-
// Apply the `unnamed_addr` attribute if
2455-
// requested
2456-
if attr::contains_name(i.attrs,
2457-
"address_insignificant"){
2458-
lib::llvm::SetUnnamedAddr(g, true);
2459-
lib::llvm::SetLinkage(g,
2460-
lib::llvm::InternalLinkage);
2461-
}
2462-
24632455
ccx.item_symbols.insert(i.id, sym);
24642456
g
24652457
}
@@ -2748,60 +2740,6 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
27482740
ifn!("llvm.bswap.i32",[Type::i32()], Type::i32());
27492741
ifn!("llvm.bswap.i64",[Type::i64()], Type::i64());
27502742

2751-
ifn!("llvm.sadd.with.overflow.i8",
2752-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2753-
ifn!("llvm.sadd.with.overflow.i16",
2754-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2755-
ifn!("llvm.sadd.with.overflow.i32",
2756-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2757-
ifn!("llvm.sadd.with.overflow.i64",
2758-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2759-
2760-
ifn!("llvm.uadd.with.overflow.i8",
2761-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2762-
ifn!("llvm.uadd.with.overflow.i16",
2763-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2764-
ifn!("llvm.uadd.with.overflow.i32",
2765-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2766-
ifn!("llvm.uadd.with.overflow.i64",
2767-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2768-
2769-
ifn!("llvm.ssub.with.overflow.i8",
2770-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2771-
ifn!("llvm.ssub.with.overflow.i16",
2772-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2773-
ifn!("llvm.ssub.with.overflow.i32",
2774-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2775-
ifn!("llvm.ssub.with.overflow.i64",
2776-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2777-
2778-
ifn!("llvm.usub.with.overflow.i8",
2779-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2780-
ifn!("llvm.usub.with.overflow.i16",
2781-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2782-
ifn!("llvm.usub.with.overflow.i32",
2783-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2784-
ifn!("llvm.usub.with.overflow.i64",
2785-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2786-
2787-
ifn!("llvm.smul.with.overflow.i8",
2788-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2789-
ifn!("llvm.smul.with.overflow.i16",
2790-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2791-
ifn!("llvm.smul.with.overflow.i32",
2792-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2793-
ifn!("llvm.smul.with.overflow.i64",
2794-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2795-
2796-
ifn!("llvm.umul.with.overflow.i8",
2797-
[Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false));
2798-
ifn!("llvm.umul.with.overflow.i16",
2799-
[Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false));
2800-
ifn!("llvm.umul.with.overflow.i32",
2801-
[Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false));
2802-
ifn!("llvm.umul.with.overflow.i64",
2803-
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
2804-
28052743
return intrinsics;
28062744
}
28072745

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,9 @@ pub fn ExtractValue(cx: @mut Block, AggVal: ValueRef, Index: uint) -> ValueRef {
714714
}
715715
}
716716

717-
pub fn InsertValue(cx: @mut Block, AggVal: ValueRef, EltVal: ValueRef, Index: uint) -> ValueRef {
718-
unsafe {
719-
if cx.unreachable { return llvm::LLVMGetUndef(Type::nil().to_ref()); }
720-
B(cx).insert_value(AggVal, EltVal, Index)
721-
}
717+
pub fn InsertValue(cx: @mut Block, AggVal: ValueRef, EltVal: ValueRef, Index: uint) {
718+
if cx.unreachable { return; }
719+
B(cx).insert_value(AggVal, EltVal, Index)
722720
}
723721

724722
pub fn IsNull(cx: @mut Block, Val: ValueRef) -> ValueRef {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,11 @@ impl Builder {
861861
}
862862

863863
pub fn insert_value(&self, agg_val: ValueRef, elt: ValueRef,
864-
idx: uint) -> ValueRef {
864+
idx: uint) {
865865
self.count_insn("insertvalue");
866866
unsafe {
867867
llvm::LLVMBuildInsertValue(self.llbuilder, agg_val, elt, idx as c_uint,
868-
noname())
868+
noname());
869869
}
870870
}
871871

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl FunctionContext {
238238
}
239239

240240
pub fn out_arg_pos(&self) -> uint {
241-
assert!(!self.has_immediate_return_value);
241+
assert!(self.has_immediate_return_value);
242242
0u
243243
}
244244

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -550,24 +550,6 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
550550
Ret(bcx, Call(bcx, llfn, args.slice(0, num_args)));
551551
}
552552

553-
fn with_overflow_instrinsic(bcx: @mut Block, name: &'static str) {
554-
let first_real_arg = bcx.fcx.arg_pos(0u);
555-
let a = get_param(bcx.fcx.llfn, first_real_arg);
556-
let b = get_param(bcx.fcx.llfn, first_real_arg + 1);
557-
let llfn = bcx.ccx().intrinsics.get_copy(&name);
558-
559-
// convert `i1` to a `bool`, and write to the out parameter
560-
let val = Call(bcx, llfn, [a, b]);
561-
let result = ExtractValue(bcx, val, 0);
562-
let overflow = ZExt(bcx, ExtractValue(bcx, val, 1), Type::bool());
563-
let retptr = get_param(bcx.fcx.llfn, bcx.fcx.out_arg_pos());
564-
let ret = Load(bcx, retptr);
565-
let ret = InsertValue(bcx, ret, result, 0);
566-
let ret = InsertValue(bcx, ret, overflow, 1);
567-
Store(bcx, ret, retptr);
568-
RetVoid(bcx)
569-
}
570-
571553
fn memcpy_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) {
572554
let ccx = bcx.ccx();
573555
let lltp_ty = type_of::type_of(ccx, tp_ty);
@@ -962,37 +944,6 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
962944
"bswap16" => simple_llvm_intrinsic(bcx, "llvm.bswap.i16", 1),
963945
"bswap32" => simple_llvm_intrinsic(bcx, "llvm.bswap.i32", 1),
964946
"bswap64" => simple_llvm_intrinsic(bcx, "llvm.bswap.i64", 1),
965-
966-
"i8_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i8"),
967-
"i16_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i16"),
968-
"i32_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i32"),
969-
"i64_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i64"),
970-
971-
"u8_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i8"),
972-
"u16_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i16"),
973-
"u32_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i32"),
974-
"u64_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i64"),
975-
976-
"i8_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i8"),
977-
"i16_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i16"),
978-
"i32_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i32"),
979-
"i64_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i64"),
980-
981-
"u8_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i8"),
982-
"u16_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i16"),
983-
"u32_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i32"),
984-
"u64_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i64"),
985-
986-
"i8_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i8"),
987-
"i16_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i16"),
988-
"i32_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i32"),
989-
"i64_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i64"),
990-
991-
"u8_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i8"),
992-
"u16_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i16"),
993-
"u32_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i32"),
994-
"u64_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i64"),
995-
996947
_ => {
997948
// Could we make this an enum rather than a string? does it get
998949
// checked earlier?

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,6 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: def_id, n_tps: uint)
168168

169169
"bswap16" | "bswap32" | "bswap64" => 0,
170170

171-
172-
"i8_add_with_overflow" | "u8_add_with_overflow" |
173-
"i16_add_with_overflow" | "u16_add_with_overflow" |
174-
"i32_add_with_overflow" | "u32_add_with_overflow" |
175-
"i64_add_with_overflow" | "u64_add_with_overflow" => 0,
176-
177-
"i8_sub_with_overflow" | "u8_sub_with_overflow" |
178-
"i16_sub_with_overflow" | "u16_sub_with_overflow" |
179-
"i32_sub_with_overflow" | "u32_sub_with_overflow" |
180-
"i64_sub_with_overflow" | "u64_sub_with_overflow" => 0,
181-
182-
"i8_mul_with_overflow" | "u8_mul_with_overflow" |
183-
"i16_mul_with_overflow" | "u16_mul_with_overflow" |
184-
"i32_mul_with_overflow" | "u32_mul_with_overflow" |
185-
"i64_mul_with_overflow" | "u64_mul_with_overflow" => 0,
186-
187171
// would be cool to make these an enum instead of
188172
// strings!
189173
_ => fail!("unknown intrinsic in type_use")

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3647,39 +3647,6 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
36473647
"bswap16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
36483648
"bswap32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
36493649
"bswap64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
3650-
3651-
"i8_add_with_overflow" | "i8_sub_with_overflow" | "i8_mul_with_overflow" =>
3652-
(0, ~[ty::mk_i8(), ty::mk_i8()],
3653-
ty::mk_tup(tcx, ~[ty::mk_i8(), ty::mk_bool()])),
3654-
3655-
"i16_add_with_overflow" | "i16_sub_with_overflow" | "i16_mul_with_overflow" =>
3656-
(0, ~[ty::mk_i16(), ty::mk_i16()],
3657-
ty::mk_tup(tcx, ~[ty::mk_i16(), ty::mk_bool()])),
3658-
3659-
"i32_add_with_overflow" | "i32_sub_with_overflow" | "i32_mul_with_overflow" =>
3660-
(0, ~[ty::mk_i32(), ty::mk_i32()],
3661-
ty::mk_tup(tcx, ~[ty::mk_i32(), ty::mk_bool()])),
3662-
3663-
"i64_add_with_overflow" | "i64_sub_with_overflow" | "i64_mul_with_overflow" =>
3664-
(0, ~[ty::mk_i64(), ty::mk_i64()],
3665-
ty::mk_tup(tcx, ~[ty::mk_i64(), ty::mk_bool()])),
3666-
3667-
"u8_add_with_overflow" | "u8_sub_with_overflow" | "u8_mul_with_overflow" =>
3668-
(0, ~[ty::mk_u8(), ty::mk_u8()],
3669-
ty::mk_tup(tcx, ~[ty::mk_u8(), ty::mk_bool()])),
3670-
3671-
"u16_add_with_overflow" | "u16_sub_with_overflow" | "u16_mul_with_overflow" =>
3672-
(0, ~[ty::mk_u16(), ty::mk_u16()],
3673-
ty::mk_tup(tcx, ~[ty::mk_u16(), ty::mk_bool()])),
3674-
3675-
"u32_add_with_overflow" | "u32_sub_with_overflow" | "u32_mul_with_overflow"=>
3676-
(0, ~[ty::mk_u32(), ty::mk_u32()],
3677-
ty::mk_tup(tcx, ~[ty::mk_u32(), ty::mk_bool()])),
3678-
3679-
"u64_add_with_overflow" | "u64_sub_with_overflow" | "u64_mul_with_overflow" =>
3680-
(0, ~[ty::mk_u64(), ty::mk_u64()],
3681-
ty::mk_tup(tcx, ~[ty::mk_u64(), ty::mk_bool()])),
3682-
36833650
ref other => {
36843651
tcx.sess.span_err(it.span,
36853652
fmt!("unrecognized intrinsic function: `%s`",

0 commit comments

Comments
 (0)