ptx_parser/type/instruction/cvta.rs
1//! Original PTX specification:
2//!
3//! // convert const, global, local, or shared address to generic address
4//! cvta.space.size p, a; // source address in register a
5//! // cvta.space.size p, var; // get generic address of var
6//! // cvta.space.size p, var+imm; // generic address of var+offset
7//! // convert generic address to const, global, local, or shared address
8//! cvta.to.space.size p, a;
9//! .space = { .const, .global, .local, .shared, .shared::cta, .shared::cluster, .param, .param::entry };
10//! .size = { .u32, .u64 };
11
12#![allow(unused)]
13use crate::r#type::common::*;
14
15pub mod section_0 {
16 use crate::Spanned;
17 use crate::parser::Span;
18 use crate::r#type::common::*;
19
20 use serde::Serialize;
21
22 #[derive(Debug, Clone, PartialEq, Serialize)]
23 pub enum Space {
24 SharedCluster, // .shared::cluster
25 ParamEntry, // .param::entry
26 SharedCta, // .shared::cta
27 Global, // .global
28 Shared, // .shared
29 Const, // .const
30 Local, // .local
31 Param, // .param
32 }
33
34 #[derive(Debug, Clone, PartialEq, Serialize)]
35 pub enum Size {
36 U32, // .u32
37 U64, // .u64
38 }
39
40 #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
41 pub struct CvtaSpaceSize {
42 pub space: Space, // .space
43 pub size: Size, // .size
44 pub p: GeneralOperand, // p
45 pub a: GeneralOperand, // a
46 pub span: Span,
47 }
48
49 #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
50 pub struct CvtaToSpaceSize {
51 pub to: (), // .to
52 pub space: Space, // .space
53 pub size: Size, // .size
54 pub p: GeneralOperand, // p
55 pub a: GeneralOperand, // a
56 pub span: Span,
57 }
58}
59
60// Re-export types with section suffixes to avoid naming conflicts
61// e.g., Type0 for section_0::Type, Type1 for section_1::Type
62pub use section_0::CvtaSpaceSize;
63pub use section_0::CvtaToSpaceSize;
64pub use section_0::Size as Size0;
65pub use section_0::Space as Space0;