ptx_parser/unparser/instruction/
alloca.rs1#![allow(unused)]
7
8use crate::lexer::PtxToken;
9use crate::unparser::{PtxUnparser, common::*};
10
11pub mod section_0 {
12 use super::*;
13 use crate::r#type::instruction::alloca::section_0::*;
14
15 impl PtxUnparser for AllocaType {
16 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17 self.unparse_tokens_mode(tokens, false);
18 }
19 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
20 push_opcode(tokens, "alloca");
21 match &self.type_ {
22 Type::U32 => {
23 push_directive(tokens, "u32");
24 }
25 Type::U64 => {
26 push_directive(tokens, "u64");
27 }
28 }
29 if spaced {
30 tokens.push(PtxToken::Space);
31 }
32 self.ptr.unparse_tokens_mode(tokens, spaced);
33 tokens.push(PtxToken::Comma);
34 if spaced {
35 tokens.push(PtxToken::Space);
36 }
37 self.size.unparse_tokens_mode(tokens, spaced);
38 if self.immalign.is_some() {
39 tokens.push(PtxToken::Comma);
40 }
41 if let Some(opt_0) = self.immalign.as_ref() {
42 if spaced {
43 tokens.push(PtxToken::Space);
44 }
45 opt_0.unparse_tokens_mode(tokens, spaced);
46 }
47 tokens.push(PtxToken::Semicolon);
48 if spaced {
49 tokens.push(PtxToken::Newline);
50 }
51 }
52 }
53}