ptx_parser/unparser/instruction/
mapa.rs

1//! Original PTX specification:
2//!
3//! mapa{.space}.type          d, a, b;
4//! // Maps shared memory address in register a into CTA b.
5//! // mapa.shared::cluster.type  d, a, b;
6//! // Maps shared memory variable into CTA b.
7//! // mapa.shared::cluster.type  d, sh, b;
8//! // Maps shared memory variable into CTA b.
9//! // mapa.shared::cluster.type  d, sh + imm, b;
10//! // Maps generic address in register a into CTA b.
11//! // mapa.type                  d, a, b;
12//! .space = { .shared::cluster };
13//! .type  = { .u32, .u64 };
14
15#![allow(unused)]
16
17use crate::lexer::PtxToken;
18use crate::unparser::{PtxUnparser, common::*};
19
20pub mod section_0 {
21    use super::*;
22    use crate::r#type::instruction::mapa::section_0::*;
23
24    impl PtxUnparser for MapaSpaceType {
25        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
26            push_opcode(tokens, "mapa");
27                    if let Some(space_0) = self.space.as_ref() {
28                            match space_0 {
29                                    Space::SharedCluster => {
30                                            push_directive(tokens, "shared::cluster");
31                                    }
32                            }
33                    }
34                    match &self.type_ {
35                            Type::U32 => {
36                                    push_directive(tokens, "u32");
37                            }
38                            Type::U64 => {
39                                    push_directive(tokens, "u64");
40                            }
41                    }
42                    self.d.unparse_tokens(tokens);
43            tokens.push(PtxToken::Comma);
44                    self.a.unparse_tokens(tokens);
45            tokens.push(PtxToken::Comma);
46                    self.b.unparse_tokens(tokens);
47            tokens.push(PtxToken::Semicolon);
48        }
49    }
50
51}
52