Skip to content

Commit

Permalink
Add GetFunctionPtr instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak committed Nov 24, 2024
1 parent ff95f31 commit 0ea6b15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/ir/src/inst/data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use macros::Inst;
use smallvec::SmallVec;

use crate::{inst::impl_inst_write, Type, ValueId};
use crate::{inst::impl_inst_write, module::FuncRef, Type, ValueId};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Inst)]
#[inst(side_effect(super::SideEffect::Read))]
Expand Down Expand Up @@ -30,6 +30,12 @@ pub struct Gep {
}
impl_inst_write!(Gep);

#[derive(Debug, Clone, PartialEq, Eq, Hash, Inst)]
pub struct GetFunctionPtr {
func: FuncRef,
}
impl_inst_write!(GetFunctionPtr);

#[derive(Debug, Clone, PartialEq, Eq, Hash, Inst)]
#[inst(side_effect(super::SideEffect::Write))]
pub struct Alloca {
Expand Down
1 change: 1 addition & 0 deletions crates/ir/src/inst/inst_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ define_inst_set_base! {
data::Mload,
data::Mstore,
data::Gep,
data::GetFunctionPtr,
data::Alloca,
data::InsertValue,
data::ExtractValue,
Expand Down
1 change: 1 addition & 0 deletions crates/parser/src/inst/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{ast, error::ArityBound, BuildCtx, Error};
super::impl_inst_build! {Mload, (addr: ValueId, ty: Type)}
super::impl_inst_build! {Mstore, (addr: ValueId, value: ValueId, ty: Type)}
super::impl_inst_build_common! {Gep, ArityBound::AtLeast(2), build_gep}
super::impl_inst_build! {GetFunctionPtr, (func: FuncRef)}
super::impl_inst_build! {Alloca, (ty: Type)}
super::impl_inst_build! {InsertValue, (dest: ValueId, idx: ValueId, value: ValueId)}
super::impl_inst_build! {ExtractValue, (dest: ValueId, idx: ValueId)}
Expand Down

0 comments on commit 0ea6b15

Please sign in to comment.