mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-26 08:47:57 +00:00
llvm-context: lazy handling of function arguments and immutable data (#282)
- Lazily load function arguments so that they can be passed as pointers. - Lazily call the immutable store function to avoid storing zero sized immutable data. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -137,7 +137,7 @@ where
|
||||
|
||||
let mut branches = Vec::with_capacity(self.cases.len());
|
||||
for (index, case) in self.cases.into_iter().enumerate() {
|
||||
let constant = case.literal.into_llvm(context)?.to_llvm();
|
||||
let constant = case.literal.into_llvm(context)?.access(context)?;
|
||||
|
||||
let expression_block = context
|
||||
.append_basic_block(format!("switch_case_branch_{}_block", index + 1).as_str());
|
||||
@@ -161,7 +161,10 @@ where
|
||||
|
||||
context.set_basic_block(current_block);
|
||||
context.builder().build_switch(
|
||||
scrutinee.expect("Always exists").to_llvm().into_int_value(),
|
||||
scrutinee
|
||||
.expect("Always exists")
|
||||
.access(context)?
|
||||
.into_int_value(),
|
||||
default_block,
|
||||
branches.as_slice(),
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user