Generalized IntPredicate in the BuilderMethods trait
This commit is contained in:
parent
14798d6937
commit
51b7f2739b
9 changed files with 73 additions and 38 deletions
|
@ -75,7 +75,7 @@ use rustc_data_structures::small_c_str::SmallCStr;
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
|
||||
use traits::BuilderMethods;
|
||||
use traits::{IntPredicate, BuilderMethods};
|
||||
use llvm::BasicBlock;
|
||||
|
||||
use std::any::Any;
|
||||
|
@ -127,14 +127,14 @@ impl Drop for StatRecorder<'a, 'll, 'tcx> {
|
|||
|
||||
pub fn bin_op_to_icmp_predicate(op: hir::BinOpKind,
|
||||
signed: bool)
|
||||
-> llvm::IntPredicate {
|
||||
-> IntPredicate {
|
||||
match op {
|
||||
hir::BinOpKind::Eq => llvm::IntEQ,
|
||||
hir::BinOpKind::Ne => llvm::IntNE,
|
||||
hir::BinOpKind::Lt => if signed { llvm::IntSLT } else { llvm::IntULT },
|
||||
hir::BinOpKind::Le => if signed { llvm::IntSLE } else { llvm::IntULE },
|
||||
hir::BinOpKind::Gt => if signed { llvm::IntSGT } else { llvm::IntUGT },
|
||||
hir::BinOpKind::Ge => if signed { llvm::IntSGE } else { llvm::IntUGE },
|
||||
hir::BinOpKind::Eq => IntPredicate::IntEQ,
|
||||
hir::BinOpKind::Ne => IntPredicate::IntNE,
|
||||
hir::BinOpKind::Lt => if signed { IntPredicate::IntSLT } else { IntPredicate::IntULT },
|
||||
hir::BinOpKind::Le => if signed { IntPredicate::IntSLE } else { IntPredicate::IntULE },
|
||||
hir::BinOpKind::Gt => if signed { IntPredicate::IntSGT } else { IntPredicate::IntUGT },
|
||||
hir::BinOpKind::Ge => if signed { IntPredicate::IntSGE } else { IntPredicate::IntUGE },
|
||||
op => {
|
||||
bug!("comparison_op_to_icmp_predicate: expected comparison operator, \
|
||||
found {:?}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue