mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 23:22:58 +00:00
Rollup merge of #89809 - tmiasko:remap-real-predicate, r=michaelwoerister
Remap ssa RealPredicate to llvm RealPredicate to avoid relying on the discriminant of the former for FFI purposes
This commit is contained in:
commit
6cdf8030f0
@ -828,6 +828,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fcmp(&mut self, op: RealPredicate, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
|
fn fcmp(&mut self, op: RealPredicate, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
|
||||||
|
let op = llvm::RealPredicate::from_generic(op);
|
||||||
unsafe { llvm::LLVMBuildFCmp(self.llbuilder, op as c_uint, lhs, rhs, UNNAMED) }
|
unsafe { llvm::LLVMBuildFCmp(self.llbuilder, op as c_uint, lhs, rhs, UNNAMED) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +223,33 @@ pub enum RealPredicate {
|
|||||||
RealPredicateTrue = 15,
|
RealPredicateTrue = 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RealPredicate {
|
||||||
|
pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
|
||||||
|
match realp {
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
|
||||||
|
RealPredicate::RealPredicateFalse
|
||||||
|
}
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
|
||||||
|
rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
|
||||||
|
RealPredicate::RealPredicateTrue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// LLVMTypeKind
|
/// LLVMTypeKind
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
Loading…
Reference in New Issue
Block a user