llvm_scratch/core/target_datalayout/
float_alignment.rs1use std::fmt;
2
3#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
4pub struct FloatAlignment {
5 pub size: FloatAlignmentSize,
6 pub abi: i32,
7 pub pref: Option<i32>,
8}
9
10impl fmt::Display for FloatAlignment {
11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12 match self.pref {
13 Some(pref) => write!(f, "f{}:{}:{}", self.size, self.abi, pref),
14 None => write!(f, "f{}:{}", self.size, self.abi),
15 }
16 }
17}
18
19#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
20pub enum FloatAlignmentSize {
21 FLOAT,
22 DOUBLE,
23 LONGDOUBLE80,
24 LONGDOUBLE128,
25}
26
27impl fmt::Display for FloatAlignmentSize {
28 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 let size = match self {
30 Self::FLOAT => 32,
31 Self::DOUBLE => 64,
32 Self::LONGDOUBLE80 => 80,
33 Self::LONGDOUBLE128 => 128,
34 };
35
36 write!(f, "{}", size)
37 }
38}