Skip to content

Commit 7895037

Browse files
committed
Removed reference requirement for op predicates
1 parent 84a537b commit 7895037

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

examples/kaleidoscope/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,12 @@ impl<'a> Compiler<'a> {
946946
'*' => Ok(self.builder.build_float_mul(&lhs, &rhs, "tmpmul")),
947947
'/' => Ok(self.builder.build_float_div(&lhs, &rhs, "tmpdiv")),
948948
'<' => Ok({
949-
let cmp = self.builder.build_float_compare(&FloatPredicate::ULT, &lhs, &rhs, "tmpcmp");
949+
let cmp = self.builder.build_float_compare(FloatPredicate::ULT, &lhs, &rhs, "tmpcmp");
950950

951951
self.builder.build_unsigned_int_to_float(&cmp, &self.context.f64_type(), "tmpbool")
952952
}),
953953
'>' => Ok({
954-
let cmp = self.builder.build_float_compare(&FloatPredicate::ULT, &rhs, &lhs, "tmpcmp");
954+
let cmp = self.builder.build_float_compare(FloatPredicate::ULT, &rhs, &lhs, "tmpcmp");
955955

956956
self.builder.build_unsigned_int_to_float(&cmp, &self.context.f64_type(), "tmpbool")
957957
}),
@@ -1002,7 +1002,7 @@ impl<'a> Compiler<'a> {
10021002

10031003
// create condition by comparing without 0.0 and returning an int
10041004
let cond = self.compile_expr(cond)?;
1005-
let cond = self.builder.build_float_compare(&FloatPredicate::ONE, &cond, &zero_const, "ifcond");
1005+
let cond = self.builder.build_float_compare(FloatPredicate::ONE, &cond, &zero_const, "ifcond");
10061006

10071007
// build branch
10081008
let then_bb = self.context.append_basic_block(&parent, "then");
@@ -1073,7 +1073,7 @@ impl<'a> Compiler<'a> {
10731073

10741074
self.builder.build_store(&start_alloca, &next_var);
10751075

1076-
let end_cond = self.builder.build_float_compare(&FloatPredicate::ONE, &end_cond, &self.context.f64_type().const_float(0.0), "loopcond");
1076+
let end_cond = self.builder.build_float_compare(FloatPredicate::ONE, &end_cond, &self.context.f64_type().const_float(0.0), "loopcond");
10771077
let after_bb = self.context.append_basic_block(&parent, "afterloop");
10781078

10791079
self.builder.build_conditional_branch(&end_cond, &loop_bb, &after_bb);

src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl Builder {
789789
}
790790

791791
// SubType: <I>(&self, op, lhs: &IntValue<I>, rhs: &IntValue<I>, name) -> IntValue<bool> { ?
792-
pub fn build_int_compare(&self, op: &IntPredicate, lhs: &IntValue, rhs: &IntValue, name: &str) -> IntValue {
792+
pub fn build_int_compare(&self, op: IntPredicate, lhs: &IntValue, rhs: &IntValue, name: &str) -> IntValue {
793793
let c_string = CString::new(name).expect("Conversion to CString failed unexpectedly");
794794

795795
let value = unsafe {
@@ -800,7 +800,7 @@ impl Builder {
800800
}
801801

802802
// SubType: <F>(&self, op, lhs: &FloatValue<F>, rhs: &FloatValue<F>, name) -> IntValue<bool> { ?
803-
pub fn build_float_compare(&self, op: &FloatPredicate, lhs: &FloatValue, rhs: &FloatValue, name: &str) -> IntValue {
803+
pub fn build_float_compare(&self, op: FloatPredicate, lhs: &FloatValue, rhs: &FloatValue, name: &str) -> IntValue {
804804
let c_string = CString::new(name).expect("Conversion to CString failed unexpectedly");
805805

806806
let value = unsafe {

src/values/int_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl IntValue {
358358
}
359359

360360
// SubType: rhs same as lhs; return IntValue<bool>
361-
pub fn const_int_compare(&self, op: &IntPredicate, rhs: &IntValue) -> IntValue {
361+
pub fn const_int_compare(&self, op: IntPredicate, rhs: &IntValue) -> IntValue {
362362
let value = unsafe {
363363
LLVMConstICmp(op.as_llvm_predicate(), self.as_value_ref(), rhs.as_value_ref())
364364
};

0 commit comments

Comments
 (0)