use super::instruction::PtxInstruction;
use super::param::PtxParam;
use super::register::Register;
#[derive(Debug, Clone)]
pub struct SharedDecl {
pub name: String,
pub align: u32,
pub size_bytes: u32,
}
#[derive(Debug, Clone)]
pub struct PtxKernel {
pub name: String,
pub params: Vec<PtxParam>,
pub body: Vec<PtxInstruction>,
pub registers: Vec<Register>,
pub shared_decls: Vec<SharedDecl>,
}
impl PtxKernel {
pub fn new(name: &str) -> Self {
Self {
name: name.to_string(),
params: Vec::new(),
body: Vec::new(),
registers: Vec::new(),
shared_decls: Vec::new(),
}
}
pub fn add_param(&mut self, param: PtxParam) {
self.params.push(param);
}
pub fn push(&mut self, instr: PtxInstruction) {
self.body.push(instr);
}
pub fn set_registers(&mut self, regs: Vec<Register>) {
self.registers = regs;
}
pub fn add_shared_decl(&mut self, decl: SharedDecl) {
self.shared_decls.push(decl);
}
}