25 lines
615 B
Rust
25 lines
615 B
Rust
use serde::{Deserialize, Serialize};
|
|
use super::ids::FunctionId;
|
|
use super::block::Block;
|
|
use super::types::Type;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
pub struct Param {
|
|
pub name: String,
|
|
pub ty: Type,
|
|
}
|
|
|
|
/// A function within a module, composed of basic blocks forming a CFG.
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
pub struct Function {
|
|
pub id: FunctionId,
|
|
pub name: String,
|
|
pub params: Vec<Param>,
|
|
pub return_type: Type,
|
|
pub blocks: Vec<Block>,
|
|
#[serde(default)]
|
|
pub local_types: HashMap<u32, Type>,
|
|
}
|