Skip to content

Commit e2d0933

Browse files
author
James Miller
committed
---
yaml --- r: 66126 b: refs/heads/master c: b4b2cbb h: refs/heads/master v: v3
1 parent c64caaa commit e2d0933

File tree

14 files changed

+79
-82
lines changed

14 files changed

+79
-82
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3dbdb3a3646931cb11db90d65971da8b16d819e4
2+
refs/heads/master: b4b2cbb299842a6854a7e82e745b8a9b63c8d6b9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/librustc/lib/llvm.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ impl TypeNames {
21432143
}
21442144

21452145
pub fn find_type(&self, s: &str) -> Option<TypeRef> {
2146-
self.named_types.find_equiv(s).map_consume(|x| *x)
2146+
self.named_types.find_equiv(&s).map_consume(|x| *x)
21472147
}
21482148

21492149
pub fn type_to_str(&self, ty: TypeRef) -> ~str {
@@ -2181,7 +2181,7 @@ impl TypeNames {
21812181
}
21822182
Struct => {
21832183
let tys = struct_tys(ty);
2184-
let tys = tys.map(|ty| self.type_to_str(ty)).connect(", ");
2184+
let tys = tys.map(|&ty| self.type_to_str(ty)).connect(", ");
21852185
fmt!("{%s}", tys)
21862186
}
21872187
Array => {
@@ -2195,9 +2195,16 @@ impl TypeNames {
21952195
let el_ty = self.type_to_str(el_ty);
21962196
fmt!("*%s", el_ty)
21972197
}
2198+
_ => fail!("Unknown Type Kind (%u)", kind as uint)
21982199
}
21992200
}
22002201
}
2202+
2203+
pub fn val_to_str(&self, val: ValueRef) -> ~str {
2204+
unsafe {
2205+
self.type_to_str(llvm::LLVMTypeOf(val))
2206+
}
2207+
}
22012208
}
22022209

22032210
pub fn float_width(llt: TypeRef) -> uint {

trunk/src/librustc/middle/trans/_match.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub fn expand_nested_bindings<'r>(bcx: block,
381381
bcx.to_str(),
382382
matches_to_str(bcx, m),
383383
col,
384-
bcx.val_str(val));
384+
bcx.val_to_str(val));
385385
let _indenter = indenter();
386386

387387
do m.map |br| {
@@ -428,7 +428,7 @@ pub fn enter_match<'r>(bcx: block,
428428
bcx.to_str(),
429429
matches_to_str(bcx, m),
430430
col,
431-
bcx.val_str(val));
431+
bcx.val_to_str(val));
432432
let _indenter = indenter();
433433

434434
let mut result = ~[];
@@ -474,7 +474,7 @@ pub fn enter_default<'r>(bcx: block,
474474
bcx.to_str(),
475475
matches_to_str(bcx, m),
476476
col,
477-
bcx.val_str(val));
477+
bcx.val_to_str(val));
478478
let _indenter = indenter();
479479

480480
do enter_match(bcx, dm, m, col, val) |p| {
@@ -521,7 +521,7 @@ pub fn enter_opt<'r>(bcx: block,
521521
bcx.to_str(),
522522
matches_to_str(bcx, m),
523523
col,
524-
bcx.val_str(val));
524+
bcx.val_to_str(val));
525525
let _indenter = indenter();
526526

527527
let tcx = bcx.tcx();
@@ -632,7 +632,7 @@ pub fn enter_rec_or_struct<'r>(bcx: block,
632632
bcx.to_str(),
633633
matches_to_str(bcx, m),
634634
col,
635-
bcx.val_str(val));
635+
bcx.val_to_str(val));
636636
let _indenter = indenter();
637637

638638
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
@@ -667,7 +667,7 @@ pub fn enter_tup<'r>(bcx: block,
667667
bcx.to_str(),
668668
matches_to_str(bcx, m),
669669
col,
670-
bcx.val_str(val));
670+
bcx.val_to_str(val));
671671
let _indenter = indenter();
672672

673673
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
@@ -695,7 +695,7 @@ pub fn enter_tuple_struct<'r>(bcx: block,
695695
bcx.to_str(),
696696
matches_to_str(bcx, m),
697697
col,
698-
bcx.val_str(val));
698+
bcx.val_to_str(val));
699699
let _indenter = indenter();
700700

701701
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
@@ -720,7 +720,7 @@ pub fn enter_box<'r>(bcx: block,
720720
bcx.to_str(),
721721
matches_to_str(bcx, m),
722722
col,
723-
bcx.val_str(val));
723+
bcx.val_to_str(val));
724724
let _indenter = indenter();
725725

726726
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
@@ -747,7 +747,7 @@ pub fn enter_uniq<'r>(bcx: block,
747747
bcx.to_str(),
748748
matches_to_str(bcx, m),
749749
col,
750-
bcx.val_str(val));
750+
bcx.val_to_str(val));
751751
let _indenter = indenter();
752752

753753
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
@@ -774,7 +774,7 @@ pub fn enter_region<'r>(bcx: block,
774774
bcx.to_str(),
775775
matches_to_str(bcx, m),
776776
col,
777-
bcx.val_str(val));
777+
bcx.val_to_str(val));
778778
let _indenter = indenter();
779779

780780
let dummy = @ast::pat { id: 0, node: ast::pat_wild, span: dummy_sp() };
@@ -1202,9 +1202,7 @@ fn insert_lllocals(bcx: block,
12021202
}
12031203
};
12041204

1205-
debug!("binding %? to %s",
1206-
binding_info.id,
1207-
val_str(bcx.ccx().tn, llval));
1205+
debug!("binding %? to %s", binding_info.id, bcx.val_to_str(llval));
12081206
llmap.insert(binding_info.id, llval);
12091207
}
12101208
return bcx;
@@ -1221,7 +1219,7 @@ pub fn compile_guard(bcx: block,
12211219
bcx.to_str(),
12221220
bcx.expr_to_str(guard_expr),
12231221
matches_to_str(bcx, m),
1224-
vals.map(|v| bcx.val_str(*v)));
1222+
vals.map(|v| bcx.val_to_str(*v)));
12251223
let _indenter = indenter();
12261224

12271225
let mut bcx = bcx;
@@ -1272,7 +1270,7 @@ pub fn compile_submatch(bcx: block,
12721270
debug!("compile_submatch(bcx=%s, m=%s, vals=%?)",
12731271
bcx.to_str(),
12741272
matches_to_str(bcx, m),
1275-
vals.map(|v| bcx.val_str(*v)));
1273+
vals.map(|v| bcx.val_to_str(*v)));
12761274
let _indenter = indenter();
12771275

12781276
/*

trunk/src/librustc/middle/trans/build.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ pub fn Invoke(cx: block,
191191
check_not_terminated(cx);
192192
terminate(cx, "Invoke");
193193
debug!("Invoke(%s with arguments (%s))",
194-
val_str(cx.ccx().tn, Fn),
195-
Args.map(|a| val_str(cx.ccx().tn, *a).to_owned()).connect(", "));
194+
cx.val_to_str(Fn),
195+
Args.map(|a| cx.val_to_str(*a)).connect(", "));
196196
unsafe {
197197
count_insn(cx, "invoke");
198198
llvm::LLVMBuildInvoke(B(cx),
@@ -576,8 +576,8 @@ pub fn Store(cx: block, Val: ValueRef, Ptr: ValueRef) {
576576
unsafe {
577577
if cx.unreachable { return; }
578578
debug!("Store %s -> %s",
579-
val_str(cx.ccx().tn, Val),
580-
val_str(cx.ccx().tn, Ptr));
579+
cx.val_to_str(Val),
580+
cx.val_to_str(Ptr));
581581
count_insn(cx, "store");
582582
llvm::LLVMBuildStore(B(cx), Val, Ptr);
583583
}
@@ -587,8 +587,8 @@ pub fn AtomicStore(cx: block, Val: ValueRef, Ptr: ValueRef, order: AtomicOrderin
587587
unsafe {
588588
if cx.unreachable { return; }
589589
debug!("Store %s -> %s",
590-
val_str(cx.ccx().tn, Val),
591-
val_str(cx.ccx().tn, Ptr));
590+
cx.val_to_str(Val),
591+
cx.val_to_str(Ptr));
592592
count_insn(cx, "store.atomic");
593593
let align = llalign_of_min(cx.ccx(), cx.ccx().int_type);
594594
llvm::LLVMBuildAtomicStore(B(cx), Val, Ptr, order, align as c_uint);
@@ -911,11 +911,11 @@ pub fn InlineAsmCall(cx: block, asm: *c_char, cons: *c_char,
911911
else { lib::llvm::False };
912912

913913
let argtys = do inputs.map |v| {
914-
debug!("Asm Input Type: %?", val_str(cx.ccx().tn, *v));
914+
debug!("Asm Input Type: %?", cx.val_to_str(*v));
915915
val_ty(*v)
916916
};
917917

918-
debug!("Asm Output Type: %?", ty_str(cx.ccx().tn, output));
918+
debug!("Asm Output Type: %?", cx.ccx().tn.type_to_str(output));
919919
let llfty = T_fn(argtys, output);
920920
let v = llvm::LLVMInlineAsm(llfty, asm, cons, volatile,
921921
alignstack, dia as c_uint);
@@ -930,8 +930,8 @@ pub fn Call(cx: block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
930930
count_insn(cx, "call");
931931

932932
debug!("Call(Fn=%s, Args=%?)",
933-
val_str(cx.ccx().tn, Fn),
934-
Args.map(|arg| val_str(cx.ccx().tn, *arg)));
933+
cx.val_to_str(Fn),
934+
Args.map(|arg| cx.val_to_str(*arg)));
935935

936936
do vec::as_imm_buf(Args) |ptr, len| {
937937
llvm::LLVMBuildCall(B(cx), Fn, ptr, len as c_uint, noname())

trunk/src/librustc/middle/trans/callee.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ pub fn trans_call_inner(in_cx: block,
572572

573573
// Uncomment this to debug calls.
574574
/*
575-
io::println(fmt!("calling: %s", bcx.val_str(llfn)));
575+
io::println(fmt!("calling: %s", bcx.val_to_str(llfn)));
576576
for llargs.each |llarg| {
577-
io::println(fmt!("arg: %s", bcx.val_str(*llarg)));
577+
io::println(fmt!("arg: %s", bcx.val_to_str(*llarg)));
578578
}
579579
io::println("---");
580580
*/
@@ -731,7 +731,7 @@ pub fn trans_arg_expr(bcx: block,
731731
formal_arg_ty.repr(bcx.tcx()),
732732
self_mode,
733733
arg_expr.repr(bcx.tcx()),
734-
ret_flag.map(|v| bcx.val_str(*v)));
734+
ret_flag.map(|v| bcx.val_to_str(*v)));
735735

736736
// translate the arg expr to a datum
737737
let arg_datumblock = match ret_flag {
@@ -842,11 +842,11 @@ pub fn trans_arg_expr(bcx: block,
842842
ty::ByCopy => llformal_arg_ty,
843843
};
844844
debug!("casting actual type (%s) to match formal (%s)",
845-
bcx.val_str(val), bcx.llty_str(llformal_arg_ty));
845+
bcx.val_to_str(val), bcx.llty_str(llformal_arg_ty));
846846
val = PointerCast(bcx, val, llformal_arg_ty);
847847
}
848848
}
849849

850-
debug!("--- trans_arg_expr passing %s", val_str(bcx.ccx().tn, val));
850+
debug!("--- trans_arg_expr passing %s", bcx.val_to_str(val));
851851
return rslt(bcx, val);
852852
}

0 commit comments

Comments
 (0)