1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
use crate::CUint;
use llvm_sys::{core, LLVMIntPredicate, LLVMOpcode, LLVMRealPredicate};
use std::fmt::Display;
use std::ops::Deref;
pub mod context;
pub mod module;
pub mod types;
pub mod values;
/// Represents an LLVM address space.
///
/// The `AddressSpace` struct encapsulates a numeric value that indicates a specific address space
/// in LLVM. Address spaces are used in LLVM to distinguish between different regions of memory, such as
/// global memory, local memory, and private memory, especially in contexts like GPUs or other specialized
/// hardware where different memory regions have different characteristics.
///
/// # Attributes
///
/// - Wrapped address value - the underlying numeric value representing the address space.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AddressSpace(CUint);
impl From<u32> for AddressSpace {
fn from(value: u32) -> Self {
Self(CUint::from(value))
}
}
impl Deref for AddressSpace {
type Target = CUint;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl AddressSpace {
#[must_use]
pub const fn new(value: CUint) -> Self {
Self(value)
}
}
/// Dispose LLVM message
/// ## Safety
/// Common function to dispose allocated message
pub unsafe fn dispose_message(message: *mut libc::c_char) {
unsafe { core::LLVMDisposeMessage(message) }
}
/// LLVM version representation
///
/// The `Version` struct encapsulates the major, minor, and patch components of the LLVM version.
/// This struct provides methods to initialize and retrieve the version information.
pub struct Version {
major: u32,
minor: u32,
patch: u32,
}
impl Version {
/// Init and return current LLVM version
///
/// # Details
///
/// Initializes and returns the current LLVM version.
///
/// This method queries the LLVM library for its version information and returns a `Version` instance
/// containing the major, minor, and patch components of the LLVM version.
///
/// # Returns
///
/// A `Version` instance with the current LLVM version.
///
/// # Example
///
/// ```rust
/// let llvm_version = Version::new();
/// ```
#[must_use]
pub fn new() -> Self {
let mut major = CUint::from(0_u32);
let mut minor = CUint::from(0_u32);
let mut patch = CUint::from(0_u32);
unsafe {
core::LLVMGetVersion(&mut *major, &mut *minor, &mut *patch);
}
Self {
major: major.into(),
minor: minor.into(),
patch: patch.into(),
}
}
/// Return LLVM version data: (major, minor, patch)
///
/// # Details
///
/// Returns the LLVM version as a tuple `(major, minor, patch)`.
///
/// This method provides access to the individual components of the LLVM version stored in this `Version` instance.
///
/// # Returns
///
/// A tuple `(u32, u32, u32)` representing the major, minor, and patch components of the LLVM version.
///
/// # Example
///
/// ```rust
/// let llvm_version = Version::new();
/// let (major, minor, patch) = llvm_version.get();
/// ```
#[must_use]
pub const fn get(&self) -> (u32, u32, u32) {
(self.minor, self.minor, self.patch)
}
}
impl Display for Version {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}.{}.{}", self.major, self.minor, self.patch)
}
}
/// Represents the various opcodes in LLVM IR.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Opcode {
/// Return instruction.
Ret,
/// Branch instruction.
Br,
/// Switch instruction.
Switch,
/// Indirect branch instruction.
IndirectBr,
/// Invoke instruction.
Invoke,
/// Unreachable instruction.
Unreachable,
/// `CallBr` instruction.
CallBr,
/// Floating-point negation instruction.
FNeg,
/// Integer addition instruction.
Add,
/// Floating-point addition instruction.
FAdd,
/// Integer subtraction instruction.
Sub,
/// Floating-point subtraction instruction.
FSub,
/// Integer multiplication instruction
Mul,
/// Floating-point multiplication instruction.
FMul,
/// Unsigned integer division instruction.
UDiv,
/// Signed integer division instruction.
SDiv,
/// Floating-point division instruction.
FDiv,
/// Unsigned integer remainder instruction.
URem,
/// Signed integer remainder instruction.
SRem,
/// Floating-point remainder instruction.
FRem,
/// Logical shift left instruction.
Shl,
/// Logical shift right instruction.
LShr,
/// Arithmetic shift right instruction.
AShr,
/// Bitwise AND instruction.
And,
/// Bitwise OR instruction.
Or,
/// Bitwise XOR instruction.
Xor,
/// Alloca instruction.
Alloca,
/// Load instruction.
Load,
/// Store instruction.
Store,
/// `GetElementPtr` instruction.
GetElementPtr,
/// Truncate instruction.
Trunc,
/// Zero extend instruction.
ZExt,
/// Sign extend instruction.
SExt,
/// Floating-point to unsigned integer instruction.
FPToUI,
/// Floating-point to signed integer instruction.
FPToSI,
/// Unsigned integer to floating-point instruction.
UIToFP,
/// Signed integer to floating-point instruction.
SIToFP,
/// Floating-point truncate instruction.
FPTrunc,
/// Floating-point extend instruction
FPExt,
/// Pointer to integer instruction
PtrToInt,
/// Integer to pointer instruction
IntToPtr,
/// Bit-cast instruction
BitCast,
/// Address space cast instruction
AddrSpaceCast,
/// Integer comparison instruction
ICmp,
/// Floating-point comparison instruction
FCmp,
/// PHI node instruction
PHI,
/// Call instruction
Call,
/// Select instruction
Select,
/// User-defined operation 1
UserOp1,
/// User-defined operation 2
UserOp2,
/// Variable argument instruction
VAArg,
/// Extract element from vector instruction
ExtractElement,
/// Insert element into vector instruction
InsertElement,
/// Shuffle vector instruction
ShuffleVector,
/// Extract value from aggregate instruction
ExtractValue,
/// Insert value into aggregate instruction
InsertValue,
/// Freeze instruction
Freeze,
/// Fence instruction
Fence,
/// Atomic compare and exchange instruction
AtomicCmpXchg,
/// Atomic read-modify-write instruction
AtomicRMW,
/// Resume instruction
Resume,
/// Landing pad instruction
LandingPad,
/// Cleanup return instruction.
CleanupRet,
/// Catch return instruction
CatchRet,
/// Catch pad instruction
CatchPad,
/// Cleanup pad instruction
CleanupPad,
/// Catch switch instruction
CatchSwitch,
}
impl From<LLVMOpcode> for Opcode {
fn from(opcode: LLVMOpcode) -> Self {
match opcode {
LLVMOpcode::LLVMRet => Self::Ret,
LLVMOpcode::LLVMBr => Self::Br,
LLVMOpcode::LLVMSwitch => Self::Switch,
LLVMOpcode::LLVMIndirectBr => Self::IndirectBr,
LLVMOpcode::LLVMInvoke => Self::Invoke,
LLVMOpcode::LLVMUnreachable => Self::Unreachable,
LLVMOpcode::LLVMCallBr => Self::CallBr,
LLVMOpcode::LLVMFNeg => Self::FNeg,
LLVMOpcode::LLVMAdd => Self::Add,
LLVMOpcode::LLVMFAdd => Self::FAdd,
LLVMOpcode::LLVMSub => Self::Sub,
LLVMOpcode::LLVMFSub => Self::FSub,
LLVMOpcode::LLVMMul => Self::Mul,
LLVMOpcode::LLVMFMul => Self::FMul,
LLVMOpcode::LLVMUDiv => Self::UDiv,
LLVMOpcode::LLVMSDiv => Self::SDiv,
LLVMOpcode::LLVMFDiv => Self::FDiv,
LLVMOpcode::LLVMURem => Self::URem,
LLVMOpcode::LLVMSRem => Self::SRem,
LLVMOpcode::LLVMFRem => Self::FRem,
LLVMOpcode::LLVMShl => Self::Shl,
LLVMOpcode::LLVMLShr => Self::LShr,
LLVMOpcode::LLVMAShr => Self::AShr,
LLVMOpcode::LLVMAnd => Self::And,
LLVMOpcode::LLVMOr => Self::Or,
LLVMOpcode::LLVMXor => Self::Xor,
LLVMOpcode::LLVMAlloca => Self::Alloca,
LLVMOpcode::LLVMLoad => Self::Load,
LLVMOpcode::LLVMStore => Self::Store,
LLVMOpcode::LLVMGetElementPtr => Self::GetElementPtr,
LLVMOpcode::LLVMTrunc => Self::Trunc,
LLVMOpcode::LLVMZExt => Self::ZExt,
LLVMOpcode::LLVMSExt => Self::SExt,
LLVMOpcode::LLVMFPToUI => Self::FPToUI,
LLVMOpcode::LLVMFPToSI => Self::FPToSI,
LLVMOpcode::LLVMUIToFP => Self::UIToFP,
LLVMOpcode::LLVMSIToFP => Self::SIToFP,
LLVMOpcode::LLVMFPTrunc => Self::FPTrunc,
LLVMOpcode::LLVMFPExt => Self::FPExt,
LLVMOpcode::LLVMPtrToInt => Self::PtrToInt,
LLVMOpcode::LLVMIntToPtr => Self::IntToPtr,
LLVMOpcode::LLVMBitCast => Self::BitCast,
LLVMOpcode::LLVMAddrSpaceCast => Self::AddrSpaceCast,
LLVMOpcode::LLVMICmp => Self::ICmp,
LLVMOpcode::LLVMFCmp => Self::FCmp,
LLVMOpcode::LLVMPHI => Self::PHI,
LLVMOpcode::LLVMCall => Self::Call,
LLVMOpcode::LLVMSelect => Self::Select,
LLVMOpcode::LLVMUserOp1 => Self::UserOp1,
LLVMOpcode::LLVMUserOp2 => Self::UserOp2,
LLVMOpcode::LLVMVAArg => Self::VAArg,
LLVMOpcode::LLVMExtractElement => Self::ExtractElement,
LLVMOpcode::LLVMInsertElement => Self::InsertElement,
LLVMOpcode::LLVMShuffleVector => Self::ShuffleVector,
LLVMOpcode::LLVMExtractValue => Self::ExtractValue,
LLVMOpcode::LLVMInsertValue => Self::InsertValue,
LLVMOpcode::LLVMFreeze => Self::Freeze,
LLVMOpcode::LLVMFence => Self::Fence,
LLVMOpcode::LLVMAtomicCmpXchg => Self::AtomicCmpXchg,
LLVMOpcode::LLVMAtomicRMW => Self::AtomicRMW,
LLVMOpcode::LLVMResume => Self::Resume,
LLVMOpcode::LLVMLandingPad => Self::LandingPad,
LLVMOpcode::LLVMCleanupRet => Self::CleanupRet,
LLVMOpcode::LLVMCatchRet => Self::CatchRet,
LLVMOpcode::LLVMCatchPad => Self::CatchPad,
LLVMOpcode::LLVMCleanupPad => Self::CleanupPad,
LLVMOpcode::LLVMCatchSwitch => Self::CatchSwitch,
}
}
}
impl From<Opcode> for LLVMOpcode {
fn from(opcode: Opcode) -> Self {
match opcode {
Opcode::Ret => Self::LLVMRet,
Opcode::Br => Self::LLVMBr,
Opcode::Switch => Self::LLVMSwitch,
Opcode::IndirectBr => Self::LLVMIndirectBr,
Opcode::Invoke => Self::LLVMInvoke,
Opcode::Unreachable => Self::LLVMUnreachable,
Opcode::CallBr => Self::LLVMCallBr,
Opcode::FNeg => Self::LLVMFNeg,
Opcode::Add => Self::LLVMAdd,
Opcode::FAdd => Self::LLVMFAdd,
Opcode::Sub => Self::LLVMSub,
Opcode::FSub => Self::LLVMFSub,
Opcode::Mul => Self::LLVMMul,
Opcode::FMul => Self::LLVMFMul,
Opcode::UDiv => Self::LLVMUDiv,
Opcode::SDiv => Self::LLVMSDiv,
Opcode::FDiv => Self::LLVMFDiv,
Opcode::URem => Self::LLVMURem,
Opcode::SRem => Self::LLVMSRem,
Opcode::FRem => Self::LLVMFRem,
Opcode::Shl => Self::LLVMShl,
Opcode::LShr => Self::LLVMLShr,
Opcode::AShr => Self::LLVMAShr,
Opcode::And => Self::LLVMAnd,
Opcode::Or => Self::LLVMOr,
Opcode::Xor => Self::LLVMXor,
Opcode::Alloca => Self::LLVMAlloca,
Opcode::Load => Self::LLVMLoad,
Opcode::Store => Self::LLVMStore,
Opcode::GetElementPtr => Self::LLVMGetElementPtr,
Opcode::Trunc => Self::LLVMTrunc,
Opcode::ZExt => Self::LLVMZExt,
Opcode::SExt => Self::LLVMSExt,
Opcode::FPToUI => Self::LLVMFPToUI,
Opcode::FPToSI => Self::LLVMFPToSI,
Opcode::UIToFP => Self::LLVMUIToFP,
Opcode::SIToFP => Self::LLVMSIToFP,
Opcode::FPTrunc => Self::LLVMFPTrunc,
Opcode::FPExt => Self::LLVMFPExt,
Opcode::PtrToInt => Self::LLVMPtrToInt,
Opcode::IntToPtr => Self::LLVMIntToPtr,
Opcode::BitCast => Self::LLVMBitCast,
Opcode::AddrSpaceCast => Self::LLVMAddrSpaceCast,
Opcode::ICmp => Self::LLVMICmp,
Opcode::FCmp => Self::LLVMFCmp,
Opcode::PHI => Self::LLVMPHI,
Opcode::Call => Self::LLVMCall,
Opcode::Select => Self::LLVMSelect,
Opcode::UserOp1 => Self::LLVMUserOp1,
Opcode::UserOp2 => Self::LLVMUserOp2,
Opcode::VAArg => Self::LLVMVAArg,
Opcode::ExtractElement => Self::LLVMExtractElement,
Opcode::InsertElement => Self::LLVMInsertElement,
Opcode::ShuffleVector => Self::LLVMShuffleVector,
Opcode::ExtractValue => Self::LLVMExtractValue,
Opcode::InsertValue => Self::LLVMInsertValue,
Opcode::Freeze => Self::LLVMFreeze,
Opcode::Fence => Self::LLVMFence,
Opcode::AtomicCmpXchg => Self::LLVMAtomicCmpXchg,
Opcode::AtomicRMW => Self::LLVMAtomicRMW,
Opcode::Resume => Self::LLVMResume,
Opcode::LandingPad => Self::LLVMLandingPad,
Opcode::CleanupRet => Self::LLVMCleanupRet,
Opcode::CatchRet => Self::LLVMCatchRet,
Opcode::CatchPad => Self::LLVMCatchPad,
Opcode::CleanupPad => Self::LLVMCleanupPad,
Opcode::CatchSwitch => Self::LLVMCatchSwitch,
}
}
}
/// Represents the various integer comparison predicates in LLVM IR.
///
/// The `IntPredicate` enum defines the possible predicates that can be used for integer comparisons
/// in LLVM IR. These predicates specify the condition under which an integer comparison is considered true.
/// The predicates cover both signed and unsigned comparisons, as well as equality checks.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IntPredicate {
/// Represents an equality comparison (`==`). This predicate is true if the two integers are equal.
IntEQ,
/// Represents an inequality comparison (`!=`). This predicate is true if the two integers are not equal.
IntNE,
/// Represents an unsigned greater than comparison (`>`). This predicate is true if the first integer is greater than the second, treating both as unsigned values.
IntUGT,
/// Represents an unsigned greater than or equal comparison (`>=`). This predicate is true if the first integer is greater than or equal to the second, treating both as unsigned values.
IntUGE,
/// Represents an unsigned less than comparison (`<`). This predicate is true if the first integer is less than the second, treating both as unsigned values.
IntULT,
/// Represents an unsigned less than or equal comparison (`<=`). This predicate is true if the first integer is less than or equal to the second, treating both as unsigned values.
IntULE,
/// Represents a signed greater than comparison (`>`). This predicate is true if the first integer is greater than the second, treating both as signed values.
IntSGT,
/// Represents a signed greater than or equal comparison (`>=`). This predicate is true if the first integer is greater than or equal to the second, treating both as signed values.
IntSGE,
/// Represents a signed less than comparison (`<`). This predicate is true if the first integer is less than the second, treating both as signed values.
IntSLT,
/// Represents a signed less than or equal comparison (`<=`). This predicate is true if the first integer is less than or equal to the second, treating both as signed values.
IntSLE,
}
impl From<LLVMIntPredicate> for IntPredicate {
fn from(predicate: LLVMIntPredicate) -> Self {
match predicate {
LLVMIntPredicate::LLVMIntEQ => Self::IntEQ,
LLVMIntPredicate::LLVMIntNE => Self::IntNE,
LLVMIntPredicate::LLVMIntUGT => Self::IntUGT,
LLVMIntPredicate::LLVMIntUGE => Self::IntUGE,
LLVMIntPredicate::LLVMIntULT => Self::IntULT,
LLVMIntPredicate::LLVMIntULE => Self::IntULE,
LLVMIntPredicate::LLVMIntSGT => Self::IntSGT,
LLVMIntPredicate::LLVMIntSGE => Self::IntSGE,
LLVMIntPredicate::LLVMIntSLT => Self::IntSLT,
LLVMIntPredicate::LLVMIntSLE => Self::IntSLE,
}
}
}
impl From<IntPredicate> for LLVMIntPredicate {
fn from(predicate: IntPredicate) -> Self {
match predicate {
IntPredicate::IntEQ => Self::LLVMIntEQ,
IntPredicate::IntNE => Self::LLVMIntNE,
IntPredicate::IntUGT => Self::LLVMIntUGT,
IntPredicate::IntUGE => Self::LLVMIntUGE,
IntPredicate::IntULT => Self::LLVMIntULT,
IntPredicate::IntULE => Self::LLVMIntULE,
IntPredicate::IntSGT => Self::LLVMIntSGT,
IntPredicate::IntSGE => Self::LLVMIntSGE,
IntPredicate::IntSLT => Self::LLVMIntSLT,
IntPredicate::IntSLE => Self::LLVMIntSLE,
}
}
}
/// Represents the various floating-point comparison predicates in LLVM IR.
///
/// The `RealPredicate` enum defines the possible predicates that can be used for floating-point comparisons
/// in LLVM IR. These predicates specify the conditions under which a floating-point comparison is considered true.
/// The predicates include ordered and unordered comparisons, as well as equality and inequality checks.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RealPredicate {
/// Represents a predicate that always returns false. No comparison is true under this predicate.
RealPredicateFalse = 0,
/// Represents an ordered equality comparison (`==`). This predicate is true if the two floating-point numbers are equal and neither is NaN.
RealOEQ,
/// Represents an ordered greater than comparison (`>`). This predicate is true if the first floating-point number is greater than the second and neither is NaN.
RealOGT,
/// Represents an ordered greater than or equal comparison (`>=`). This predicate is true if the first floating-point number is greater than or equal to the second and neither is NaN.
RealOGE,
/// Represents an ordered less than comparison (`<`). This predicate is true if the first floating-point number is less than the second and neither is NaN.
RealOLT,
/// Represents an ordered less than or equal comparison (`<=`). This predicate is true if the first floating-point number is less than or equal to the second and neither is NaN.
RealOLE,
/// Represents an ordered inequality comparison (`!=`). This predicate is true if the two floating-point numbers are not equal and neither is NaN.
RealONE,
/// Represents an ordered comparison. This predicate is true if neither of the floating-point numbers is NaN.
RealORD,
/// Represents an unordered comparison. This predicate is true if either of the floating-point numbers is NaN.
RealUNO,
/// Represents an unordered equality comparison. This predicate is true if the two floating-point numbers are equal or either is NaN.
RealUEQ,
/// Represents an unordered greater than comparison. This predicate is true if the first floating-point number is greater than the second or either is NaN.
RealUGT,
/// Represents an unordered greater than or equal comparison. This predicate is true if the first floating-point number is greater than or equal to the second or either is NaN.
RealUGE,
/// Represents an unordered less than comparison. This predicate is true if the first floating-point number is less than the second or either is NaN.
RealULT,
/// Represents an unordered less than or equal comparison. This predicate is true if the first floating-point number is less than or equal to the second or either is NaN.
RealULE,
/// Represents an unordered inequality comparison. This predicate is true if the two floating-point numbers are not equal or either is NaN.
RealUNE,
/// Represents a predicate that always returns true. All comparisons are true under this predicate.
RealPredicateTrue,
}
impl From<LLVMRealPredicate> for RealPredicate {
fn from(predicate: LLVMRealPredicate) -> Self {
match predicate {
LLVMRealPredicate::LLVMRealPredicateFalse => Self::RealPredicateFalse,
LLVMRealPredicate::LLVMRealOEQ => Self::RealOEQ,
LLVMRealPredicate::LLVMRealOGT => Self::RealOGT,
LLVMRealPredicate::LLVMRealOGE => Self::RealOGE,
LLVMRealPredicate::LLVMRealOLT => Self::RealOLT,
LLVMRealPredicate::LLVMRealOLE => Self::RealOLE,
LLVMRealPredicate::LLVMRealONE => Self::RealONE,
LLVMRealPredicate::LLVMRealORD => Self::RealORD,
LLVMRealPredicate::LLVMRealUNO => Self::RealUNO,
LLVMRealPredicate::LLVMRealUEQ => Self::RealUEQ,
LLVMRealPredicate::LLVMRealUGT => Self::RealUGT,
LLVMRealPredicate::LLVMRealUGE => Self::RealUGE,
LLVMRealPredicate::LLVMRealULT => Self::RealULT,
LLVMRealPredicate::LLVMRealULE => Self::RealULE,
LLVMRealPredicate::LLVMRealUNE => Self::RealUNE,
LLVMRealPredicate::LLVMRealPredicateTrue => Self::RealPredicateTrue,
}
}
}
impl From<RealPredicate> for LLVMRealPredicate {
fn from(predicate: RealPredicate) -> Self {
match predicate {
RealPredicate::RealPredicateFalse => Self::LLVMRealPredicateFalse,
RealPredicate::RealOEQ => Self::LLVMRealOEQ,
RealPredicate::RealOGT => Self::LLVMRealOGT,
RealPredicate::RealOGE => Self::LLVMRealOGE,
RealPredicate::RealOLT => Self::LLVMRealOLT,
RealPredicate::RealOLE => Self::LLVMRealOLE,
RealPredicate::RealONE => Self::LLVMRealONE,
RealPredicate::RealORD => Self::LLVMRealORD,
RealPredicate::RealUNO => Self::LLVMRealUNO,
RealPredicate::RealUEQ => Self::LLVMRealUEQ,
RealPredicate::RealUGT => Self::LLVMRealUGT,
RealPredicate::RealUGE => Self::LLVMRealUGE,
RealPredicate::RealULT => Self::LLVMRealULT,
RealPredicate::RealULE => Self::LLVMRealULE,
RealPredicate::RealUNE => Self::LLVMRealUNE,
RealPredicate::RealPredicateTrue => Self::LLVMRealPredicateTrue,
}
}
}