mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
fix gen_dev
This commit is contained in:
parent
0893aa7369
commit
5a6bd1e187
1 changed files with 32 additions and 33 deletions
|
@ -103,26 +103,31 @@ where
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Expr::FunctionCall {
|
Expr::Call(roc_mono::ir::Call {
|
||||||
call_type: CallType::ByName(func_sym),
|
call_type,
|
||||||
args,
|
arguments,
|
||||||
..
|
}) => {
|
||||||
} => {
|
match call_type {
|
||||||
match *func_sym {
|
CallType::ByName { name: func_sym, .. } => {
|
||||||
Symbol::NUM_ABS => {
|
match *func_sym {
|
||||||
// Instead of calling the function, just inline it.
|
Symbol::NUM_ABS => {
|
||||||
self.build_expr(sym, &Expr::RunLowLevel(LowLevel::NumAbs, args), layout)
|
// Instead of calling the function, just inline it.
|
||||||
|
self.build_run_low_level(sym, &LowLevel::NumAbs, arguments, layout)
|
||||||
|
}
|
||||||
|
Symbol::NUM_ADD => {
|
||||||
|
// Instead of calling the function, just inline it.
|
||||||
|
self.build_run_low_level(sym, &LowLevel::NumAdd, arguments, layout)
|
||||||
|
}
|
||||||
|
x => Err(format!("the function, {:?}, is not yet implemented", x)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Symbol::NUM_ADD => {
|
|
||||||
// Instead of calling the function, just inline it.
|
CallType::LowLevel { op: lowlevel } => {
|
||||||
self.build_expr(sym, &Expr::RunLowLevel(LowLevel::NumAdd, args), layout)
|
self.build_run_low_level(sym, lowlevel, arguments, layout)
|
||||||
}
|
}
|
||||||
x => Err(format!("the function, {:?}, is not yet implemented", x)),
|
x => Err(format!("the call type, {:?}, is not yet implemented", x)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expr::RunLowLevel(lowlevel, args) => {
|
|
||||||
self.build_run_low_level(sym, lowlevel, args, layout)
|
|
||||||
}
|
|
||||||
x => Err(format!("the expression, {:?}, is not yet implemented", x)),
|
x => Err(format!("the expression, {:?}, is not yet implemented", x)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,36 +249,30 @@ where
|
||||||
match expr {
|
match expr {
|
||||||
Expr::Literal(_) => {}
|
Expr::Literal(_) => {}
|
||||||
Expr::FunctionPointer(sym, _) => self.set_last_seen(*sym, stmt),
|
Expr::FunctionPointer(sym, _) => self.set_last_seen(*sym, stmt),
|
||||||
Expr::FunctionCall {
|
Expr::Call(roc_mono::ir::Call {
|
||||||
call_type, args, ..
|
call_type,
|
||||||
} => {
|
arguments,
|
||||||
for sym in *args {
|
}) => {
|
||||||
|
for sym in *arguments {
|
||||||
self.set_last_seen(*sym, stmt);
|
self.set_last_seen(*sym, stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
match call_type {
|
match call_type {
|
||||||
CallType::ByName(sym) => {
|
CallType::ByName { name: sym, .. } => {
|
||||||
// For functions that we won't inline, we should not be a leaf function.
|
// For functions that we won't inline, we should not be a leaf function.
|
||||||
if !INLINED_SYMBOLS.contains(sym) {
|
if !INLINED_SYMBOLS.contains(sym) {
|
||||||
self.set_not_leaf_function();
|
self.set_not_leaf_function();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CallType::ByPointer(sym) => {
|
CallType::ByPointer { name: sym, .. } => {
|
||||||
self.set_not_leaf_function();
|
self.set_not_leaf_function();
|
||||||
self.set_last_seen(*sym, stmt);
|
self.set_last_seen(*sym, stmt);
|
||||||
}
|
}
|
||||||
|
CallType::LowLevel { .. } => {}
|
||||||
|
CallType::Foreign { .. } => self.set_not_leaf_function(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expr::RunLowLevel(_, args) => {
|
|
||||||
for sym in *args {
|
|
||||||
self.set_last_seen(*sym, stmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Expr::ForeignCall { arguments, .. } => {
|
|
||||||
for sym in *arguments {
|
|
||||||
self.set_last_seen(*sym, stmt);
|
|
||||||
}
|
|
||||||
self.set_not_leaf_function();
|
|
||||||
}
|
|
||||||
Expr::Tag { arguments, .. } => {
|
Expr::Tag { arguments, .. } => {
|
||||||
for sym in *arguments {
|
for sym in *arguments {
|
||||||
self.set_last_seen(*sym, stmt);
|
self.set_last_seen(*sym, stmt);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue