Skip to content

Commit 7cfdd27

Browse files
authored
Merge pull request #433 from rustcoreutils/cc
[cc] type interning
2 parents dc8b893 + a13f20c commit 7cfdd27

File tree

17 files changed

+2807
-2064
lines changed

17 files changed

+2807
-2064
lines changed

cc/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ Supported:
9494
- Bitfields (named, unnamed, zero-width for alignment)
9595

9696
Not yet implemented:
97+
- goto, longjmp, setjmp
9798
- `inline` and inlining support
99+
- multi-register returns (for structs larger than 8 bytes)
98100
- -fverbose-asm
99101
- Complex initializers
100102
- VLAs (variable-length arrays)
@@ -130,4 +132,8 @@ Please run `cargo fmt` before committing code, and `cargo clippy` regularly whil
130132
cargo fmt && cargo clippy -p posixutils-cc
131133
```
132134

135+
DO NOT `allow(dead_code)` to fix warnings. Instead, remove dead code; do
136+
not leave it around as a maintenance burden (and LLM token
137+
tax).
138+
133139
Read CONTRIBUTING.md in the root of the repository for more details.

cc/arch/aarch64/codegen.rs

Lines changed: 61 additions & 80 deletions
Large diffs are not rendered by default.

cc/arch/codegen.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use crate::ir::Module;
1313
use crate::target::Target;
14+
use crate::types::TypeTable;
1415

1516
/// pcc version string for assembly header
1617
pub const PCC_VERSION: &str = env!("CARGO_PKG_VERSION");
@@ -49,7 +50,7 @@ pub fn generate_header_comments(target: &Target) -> Vec<String> {
4950
/// Trait for architecture-specific code generators
5051
pub trait CodeGenerator {
5152
/// Generate assembly code for the given IR module
52-
fn generate(&mut self, module: &Module) -> String;
53+
fn generate(&mut self, module: &Module, types: &TypeTable) -> String;
5354

5455
/// Set whether to emit basic unwind tables (cfi_startproc/cfi_endproc)
5556
fn set_emit_unwind_tables(&mut self, emit: bool);

cc/arch/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// Architecture-specific predefined macros and code generators
1010
//
1111

12+
/// Default capacity for LIR instruction buffers (reduces reallocation overhead)
13+
pub const DEFAULT_LIR_BUFFER_CAPACITY: usize = 5000;
14+
1215
pub mod aarch64;
1316
pub mod codegen;
1417
pub mod lir;

0 commit comments

Comments
 (0)