Skip to content

Commit b15f130

Browse files
authored
Merge pull request #457 from rustcoreutils/updates
Updates
2 parents 40d7239 + ac28bc9 commit b15f130

File tree

16 files changed

+2191
-2481
lines changed

16 files changed

+2191
-2481
lines changed

cc/arch/aarch64/codegen.rs

Lines changed: 385 additions & 661 deletions
Large diffs are not rendered by default.

cc/arch/codegen.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ use crate::ir::{Function, Module, Opcode};
1313
use crate::target::Target;
1414
use crate::types::TypeTable;
1515

16+
// ============================================================================
17+
// Shared Helper Types
18+
// ============================================================================
19+
20+
/// Unary integer operation type
21+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22+
pub enum UnaryOp {
23+
Neg,
24+
Not,
25+
}
26+
27+
/// Byte-swap size
28+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29+
pub enum BswapSize {
30+
B16,
31+
B32,
32+
B64,
33+
}
34+
35+
// ============================================================================
36+
// Constants
37+
// ============================================================================
38+
1639
/// pcc version string for assembly header
1740
pub const PCC_VERSION: &str = env!("CARGO_PKG_VERSION");
1841

cc/arch/lir.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515

1616
use crate::target::{Os, Target};
17+
use crate::types::{TypeId, TypeKind, TypeTable};
1718
use std::fmt::{self, Write};
1819

1920
// ============================================================================
@@ -120,6 +121,22 @@ impl fmt::Display for FpSize {
120121
}
121122
}
122123

124+
// ============================================================================
125+
// Complex Type Helpers
126+
// ============================================================================
127+
128+
/// Get FpSize and element offset for a complex type's components.
129+
/// Returns (FpSize for each component, byte offset to imaginary part).
130+
pub fn complex_fp_info(types: &TypeTable, complex_typ: TypeId) -> (FpSize, i32) {
131+
let base = types.complex_base(complex_typ);
132+
match types.kind(base) {
133+
TypeKind::Float => (FpSize::Single, 4),
134+
TypeKind::Double => (FpSize::Double, 8),
135+
TypeKind::LongDouble => (FpSize::Double, 8), // TODO: arch-specific
136+
_ => (FpSize::Double, 8), // fallback
137+
}
138+
}
139+
123140
// ============================================================================
124141
// Labels and Symbols
125142
// ============================================================================

0 commit comments

Comments
 (0)