Skip to content

Commit

Permalink
We don't support too many arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
koba-e964 committed Dec 17, 2024
1 parent 4504311 commit 79d669b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/arm64/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub fn seq(id_gen: &mut id::IdGen, e1: Exp, e2: Asm) -> Asm {
}

pub fn regs() -> Vec<String> {
let mut res = vec!["".to_string(); 4];
let mut res = vec!["".to_string(); 30];
for (i, item) in res.iter_mut().enumerate() {
*item = format!("$x{i}");
}
Expand Down
5 changes: 3 additions & 2 deletions src/arm64/reg_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ fn target_exp(src: &str, dest_t: &(String, Type), exp: &Exp) -> (bool, Vec<Strin

fn target_args(src: &str, all: &[String], ys: &[String]) -> Vec<String> {
let mut ans = vec![];
// We don't support too many arguments for a function call.
assert!(ys.len() < all.len());
for i in 0..ys.len() {
if ys[i] == src {
Expand All @@ -390,7 +391,7 @@ fn target_args(src: &str, all: &[String], ys: &[String]) -> Vec<String> {
/// The author hasn't understood the meaning of this function.
/// TODO understand this
/// "register sourcing" (?) as opposed to register targeting
/// (arm64の2オペランド命令のためのregister coalescing) *) TODO
/// (arm64の2オペランド命令のためのregister coalescing) *)
fn source(t: &Type, asm: &Asm) -> Vec<String> {
match asm {
Asm::Ans(ref exp) => source_exp(t, exp),
Expand Down Expand Up @@ -474,7 +475,7 @@ fn add(x: String, reg: String, mut regenv: RegEnv) -> RegEnv {
regenv
}

// Decide to allocate a register or spill.
/// Decides to allocate a register or spill.
fn alloc(cont: Asm, regenv: &RegEnv, x: String, t: Type, preference: &[String]) -> AllocResult {
assert!(!regenv.contains_key(&x));
let all = match t {
Expand Down

0 comments on commit 79d669b

Please sign in to comment.