Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ Supported:
- Bitfields (named, unnamed, zero-width for alignment)

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

DO NOT `allow(dead_code)` to fix warnings. Instead, remove dead code; do
not leave it around as a maintenance burden (and LLM token
tax).

Read CONTRIBUTING.md in the root of the repository for more details.
141 changes: 61 additions & 80 deletions cc/arch/aarch64/codegen.rs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion cc/arch/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use crate::ir::Module;
use crate::target::Target;
use crate::types::TypeTable;

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

/// Set whether to emit basic unwind tables (cfi_startproc/cfi_endproc)
fn set_emit_unwind_tables(&mut self, emit: bool);
Expand Down
3 changes: 3 additions & 0 deletions cc/arch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// Architecture-specific predefined macros and code generators
//

/// Default capacity for LIR instruction buffers (reduces reallocation overhead)
pub const DEFAULT_LIR_BUFFER_CAPACITY: usize = 5000;

pub mod aarch64;
pub mod codegen;
pub mod lir;
Expand Down
Loading