ptx_parser/parser/instruction/
getctarank.rs1#![allow(unused)]
16
17use crate::parser::{
18 PtxParseError, PtxParser, PtxTokenStream, Span,
19 util::{
20 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
21 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
22 },
23};
24use crate::r#type::common::*;
25use crate::{alt, ok, seq_n};
26
27pub mod section_0 {
28 use super::*;
29 use crate::r#type::instruction::getctarank::section_0::*;
30
31 impl PtxParser for Space {
36 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
37 alt!(map(string_p(".shared::cluster"), |_, _span| {
38 Space::SharedCluster
39 }))
40 }
41 }
42
43 impl PtxParser for Type {
44 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
45 alt!(
46 map(string_p(".u32"), |_, _span| Type::U32),
47 map(string_p(".u64"), |_, _span| Type::U64)
48 )
49 }
50 }
51
52 impl PtxParser for GetctarankSpaceType {
53 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
54 try_map(
55 seq_n!(
56 string_p("getctarank"),
57 optional(Space::parse()),
58 Type::parse(),
59 GeneralOperand::parse(),
60 comma_p(),
61 GeneralOperand::parse(),
62 semicolon_p()
63 ),
64 |(_, space, type_, d, _, a, _), span| {
65 ok!(GetctarankSpaceType {
66 space = space,
67 type_ = type_,
68 d = d,
69 a = a,
70
71 })
72 },
73 )
74 }
75 }
76
77 impl PtxParser for GetctarankSharedClusterType {
78 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
79 try_map(
80 seq_n!(
81 string_p("getctarank"),
82 string_p(".shared::cluster"),
83 Type::parse(),
84 GeneralOperand::parse(),
85 comma_p(),
86 GeneralOperand::parse(),
87 semicolon_p()
88 ),
89 |(_, shared_cluster, type_, d, _, a, _), span| {
90 ok!(GetctarankSharedClusterType {
91 shared_cluster = shared_cluster,
92 type_ = type_,
93 d = d,
94 a = a,
95
96 })
97 },
98 )
99 }
100 }
101
102 impl PtxParser for GetctarankType {
103 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
104 try_map(
105 seq_n!(
106 string_p("getctarank"),
107 Type::parse(),
108 GeneralOperand::parse(),
109 comma_p(),
110 GeneralOperand::parse(),
111 semicolon_p()
112 ),
113 |(_, type_, d, _, a, _), span| {
114 ok!(GetctarankType {
115 type_ = type_,
116 d = d,
117 a = a,
118
119 })
120 },
121 )
122 }
123 }
124}