pub fn compare_scalar_values<'a>(
                             cx: &'a Block<'a>,
                             lhs: ValueRef,
                             rhs: ValueRef,
                             nt: scalar_type,
                             op: ast::BinOp)
                             -> ValueRef {
    let _icx = push_ctxt("compare_scalar_values");
    fn die(cx: &Block) -> ! {
        cx.tcx().sess.bug("compare_scalar_values: must be a\
                           comparison operator");
    }
    match nt {
      nil_type => {
        // We don't need to do actual comparisons for nil.
        // () == () holds but () < () does not.
        match op {
          ast::BiEq | ast::BiLe | ast::BiGe => return C_i1(true),
          ast::BiNe | ast::BiLt | ast::BiGt => return C_i1(false),
          // refinements would be nice
          _ => die(cx)
        }
      }
      floating_point => {
        let cmp = match op {
          ast::BiEq => lib::llvm::RealOEQ,
          ast::BiNe => lib::llvm::RealUNE,
          ast::BiLt => lib::llvm::RealOLT,
          ast::BiLe => lib::llvm::RealOLE,
          ast::BiGt => lib::llvm::RealOGT,
          ast::BiGe => lib::llvm::RealOGE,
          _ => die(cx)
        };
        return FCmp(cx, cmp, lhs, rhs);
      }
      signed_int => {
        let cmp = match op {
          ast::BiEq => lib::llvm::IntEQ,
          ast::BiNe => lib::llvm::IntNE,
          ast::BiLt => lib::llvm::IntSLT,
          ast::BiLe => lib::llvm::IntSLE,
          ast::BiGt => lib::llvm::IntSGT,
          ast::BiGe => lib::llvm::IntSGE,
          _ => die(cx)
        };
        return ICmp(cx, cmp, lhs, rhs);
      }
      unsigned_int => {
        let cmp = match op {
          ast::BiEq => lib::llvm::IntEQ,
          ast::BiNe => lib::llvm::IntNE,
          ast::BiLt => lib::llvm::IntULT,
          ast::BiLe => lib::llvm::IntULE,
          ast::BiGt => lib::llvm::IntUGT,
          ast::BiGe => lib::llvm::IntUGE,
          _ => die(cx)
        };
        return ICmp(cx, cmp, lhs, rhs);
      }
    }
}
// A helper function to do the actual comparison of scalar values.
A helper function to do the actual comparison of scalar values.
A helper function to do the actual comparison of scalar values .
pub fn compare_scalar_values<'a>(
                             cx: &'a Block<'a>,
                             lhs: ValueRef,
                             rhs: ValueRef,
                             nt: scalar_type,
                             op: ast::BinOp)
                             -> ValueRef {
    let _icx = push_ctxt("compare_scalar_values");
    fn die(cx: &Block) -> ! {
        cx.tcx().sess.bug("compare_scalar_values: must be a\
                           comparison operator");
    }
    match nt {
      nil_type => {
        // We don't need to do actual comparisons for nil.
        // () == () holds but () < () does not.
        match op {
          ast::BiEq | ast::BiLe | ast::BiGe => return C_i1(true),
          ast::BiNe | ast::BiLt | ast::BiGt => return C_i1(false),
          // refinements would be nice
          _ => die(cx)
        }
      }
      floating_point => {
        let cmp = match op {
          ast::BiEq => lib::llvm::RealOEQ,
          ast::BiNe => lib::llvm::RealUNE,
          ast::BiLt => lib::llvm::RealOLT,
          ast::BiLe => lib::llvm::RealOLE,
          ast::BiGt => lib::llvm::RealOGT,
          ast::BiGe => lib::llvm::RealOGE,
          _ => die(cx)
        };
        return FCmp(cx, cmp, lhs, rhs);
      }
      signed_int => {
        let cmp = match op {
          ast::BiEq => lib::llvm::IntEQ,
          ast::BiNe => lib::llvm::IntNE,
          ast::BiLt => lib::llvm::IntSLT,
          ast::BiLe => lib::llvm::IntSLE,
          ast::BiGt => lib::llvm::IntSGT,
          ast::BiGe => lib::llvm::IntSGE,
          _ => die(cx)
        };
        return ICmp(cx, cmp, lhs, rhs);
      }
      unsigned_int => {
        let cmp = match op {
          ast::BiEq => lib::llvm::IntEQ,
          ast::BiNe => lib::llvm::IntNE,
          ast::BiLt => lib::llvm::IntULT,
          ast::BiLe => lib::llvm::IntULE,
          ast::BiGt => lib::llvm::IntUGT,
          ast::BiGe => lib::llvm::IntUGE,
          _ => die(cx)
        };
        return ICmp(cx, cmp, lhs, rhs);
      }
    }
}
pub fn compare_scalar_values < ' a > ( cx : & ' a Block < ' a > , lhs : ValueRef , rhs : ValueRef , nt : scalar_type , op : ast :: BinOp ) -> ValueRef { let _icx = push_ctxt ( " " ) ; fn die ( cx : & Block ) -> ! { cx . tcx ( ) . sess . bug ( " \
 " ) ; } match nt { nil_type => { // We don't need to do actual comparisons for nil. // () == () holds but () < () does not. match op { ast :: BiEq | ast :: BiLe | ast :: BiGe => return C_i1 ( true ) , ast :: BiNe | ast :: BiLt | ast :: BiGt => return C_i1 ( false ) , // refinements would be nice _ => die ( cx ) } } floating_point => { let cmp = match op { ast :: BiEq => lib :: llvm :: RealOEQ , ast :: BiNe => lib :: llvm :: RealUNE , ast :: BiLt => lib :: llvm :: RealOLT , ast :: BiLe => lib :: llvm :: RealOLE , ast :: BiGt => lib :: llvm :: RealOGT , ast :: BiGe => lib :: llvm :: RealOGE , _ => die ( cx ) } ; return FCmp ( cx , cmp , lhs , rhs ) ; } signed_int => { let cmp = match op { ast :: BiEq => lib :: llvm :: IntEQ , ast :: BiNe => lib :: llvm :: IntNE , ast :: BiLt => lib :: llvm :: IntSLT , ast :: BiLe => lib :: llvm :: IntSLE , ast :: BiGt => lib :: llvm :: IntSGT , ast :: BiGe => lib :: llvm :: IntSGE , _ => die ( cx ) } ; return ICmp ( cx , cmp , lhs , rhs ) ; } unsigned_int => { let cmp = match op { ast :: BiEq => lib :: llvm :: IntEQ , ast :: BiNe => lib :: llvm :: IntNE , ast :: BiLt => lib :: llvm :: IntULT , ast :: BiLe => lib :: llvm :: IntULE , ast :: BiGt => lib :: llvm :: IntUGT , ast :: BiGe => lib :: llvm :: IntUGE , _ => die ( cx ) } ; return ICmp ( cx , cmp , lhs , rhs ) ; } } }
A helper function to do the actual comparison of scalar values.
A helper function to do the actual comparison of scalar values .
cx
&'a Block<'a>
lhs
ValueRef
rhs
ValueRef
nt
scalar_type
op
ast::BinOp
cx
&'a Block<'a>
lhs
ValueRef
rhs
ValueRef
nt
scalar_type
op
ast::BinOp