MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / parse_reg_group_list

Function parse_reg_group_list

src/debug_utils/generic_reginfo/parse.rs:88–115  ·  view source on GitHub ↗
(pair: Pair<'_, Rule>, is_group: &mut Option<bool>)

Source from the content-addressed store, hash-verified

86}
87
88fn parse_reg_group_list(pair: Pair<'_, Rule>, is_group: &mut Option<bool>) -> Result<RegList> {
89 let Some(list) = pair.into_inner().next() else {
90 return Ok(RegList::Empty);
91 };
92 Ok(match list.as_rule() {
93 Rule::reg_list => {
94 if *is_group == Some(true) {
95 Err(custom_error(
96 list.as_span(),
97 "cannot mix registers and register groups in the same class",
98 ))?;
99 }
100 *is_group = Some(false);
101 RegList::Regs(parse_entity_list(list)?.into_iter().collect())
102 }
103 Rule::reg_group_list => {
104 if *is_group == Some(false) {
105 Err(custom_error(
106 list.as_span(),
107 "cannot mix registers and register groups in the same class",
108 ))?;
109 }
110 *is_group = Some(true);
111 RegList::Groups(parse_entity_list(list)?.into_iter().collect())
112 }
113 _ => unreachable!(),
114 })
115}
116
117fn parse_reg_def(pair: Pair<'_, Rule>, regs: &mut PrimaryMap<PhysReg, PhysRegData>) -> Result<()> {
118 let [reg, location, kind] = extract(pair, [Rule::reg, Rule::reg_location, Rule::reg_kind]);

Callers 1

parse_class_defFunction · 0.85

Calls 4

custom_errorFunction · 0.70
parse_entity_listFunction · 0.70
nextMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected