Skip to content

Commit d36949b

Browse files
committed
---
yaml --- r: 28429 b: refs/heads/try c: d6ceef9 h: refs/heads/master i: 28427: 62f1df1 v: v3
1 parent 536e653 commit d36949b

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: a93de20148f215c6d542ea57a37825d7fa4d950d
5+
refs/heads/try: d6ceef95bae928dbaf6050c95939d39ac33e1725
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/rustc/middle/trans/alt.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,35 @@ impl branch_kind : cmp::Eq {
427427
pure fn ne(&&other: branch_kind) -> bool { !self.eq(other) }
428428
}
429429

430+
// Compiles a comparison between two things.
431+
fn trans_compare(cx: block, op: ast::binop, lhs: ValueRef,
432+
_lhs_t: ty::t, rhs: ValueRef, rhs_t: ty::t) -> Result {
433+
let _icx = cx.insn_ctxt("trans_compare");
434+
if ty::type_is_scalar(rhs_t) {
435+
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, op);
436+
return rslt(rs.bcx, rs.val);
437+
}
438+
439+
// Determine the operation we need.
440+
let llop = {
441+
match op {
442+
ast::eq | ast::ne => C_u8(abi::cmp_glue_op_eq),
443+
ast::lt | ast::ge => C_u8(abi::cmp_glue_op_lt),
444+
ast::le | ast::gt => C_u8(abi::cmp_glue_op_le),
445+
_ => cx.tcx().sess.bug(~"trans_compare got non-comparison-op")
446+
}
447+
};
448+
449+
let cmpval = glue::call_cmp_glue(cx, lhs, rhs, rhs_t, llop);
450+
451+
// Invert the result if necessary.
452+
match op {
453+
ast::eq | ast::lt | ast::le => rslt(cx, cmpval),
454+
ast::ne | ast::ge | ast::gt => rslt(cx, Not(cx, cmpval)),
455+
_ => cx.tcx().sess.bug(~"trans_compare got non-comparison-op")
456+
}
457+
}
458+
430459
fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
431460
chk: Option<mk_fail>, &exits: ~[exit_node]) {
432461
/*

0 commit comments

Comments
 (0)