Skip to content

Commit

Permalink
Add ISLE rule for heap offset symbol
Browse files Browse the repository at this point in the history
This removes the hacky implementation using LoadExtName in favor of a more targeted rule.
  • Loading branch information
aborg-dev committed Jan 24, 2024
1 parent a318127 commit f5b9c55
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 134 deletions.
11 changes: 1 addition & 10 deletions cranelift/codegen/src/isa/zkasm/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1475,16 +1475,7 @@ impl MachInstEmit for Inst {
ref name,
offset,
} => {
// TODO(akashin): Replace this with a more general logic when we have more than
// one external constant.
let rd = allocs.next_writable(rd);
put_string(
&format!(
"{offset} => {} ;; LoadExtName({name:?})\n",
reg_name(rd.to_reg())
),
sink,
);
unimplemented!("LoadExtName: {name:?}");
}
&Inst::TrapIfC {
rs1,
Expand Down
4 changes: 2 additions & 2 deletions cranelift/codegen/src/isa/zkasm/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@

;;;;; Rules for `symbol_value`;;;;;;;;;
(rule
(lower (symbol_value (symbol_value_data name _ offset)))
(load_ext_name name offset))
(lower (symbol_value (zkasm_base ZkasmBase.Heap)))
(imm $I32 0))

;;;;; Rules for `bitcast`;;;;;;;;;
(rule
Expand Down
Loading

0 comments on commit f5b9c55

Please sign in to comment.