This changes the names of tuple and format in the .g4 grammar files. 'tuple' becomes 'value_list' and 'format' becomes 'inst_format'. PiperOrigin-RevId: 859208700 Change-Id: If5113f3a8c496e4aa89502e661108a8a8b23ed9f
diff --git a/mpact/sim/decoder/BinFormat.g4 b/mpact/sim/decoder/BinFormat.g4 index 41473ba..17d6480 100644 --- a/mpact/sim/decoder/BinFormat.g4 +++ b/mpact/sim/decoder/BinFormat.g4
@@ -129,7 +129,7 @@ // An instruction group lists the encodings of a set of instructions that all // derive from the same format. instruction_group_def - : INSTRUCTION GROUP name=IDENT '[' number ']' ':' format=IDENT + : INSTRUCTION GROUP name=IDENT '[' number ']' ':' inst_format=IDENT '{' instruction_def_list '}' ';'? | INSTRUCTION GROUP name=IDENT '=' '{' group_name_list '}' ';'? ; @@ -150,10 +150,10 @@ range_assignment : IDENT '=' '[' gen_value (',' gen_value)* ']' - | '[' IDENT (',' IDENT)* ']' '=' '[' tuple (',' tuple)* ']' + | '[' IDENT (',' IDENT)* ']' '=' '[' value_list (',' value_list)* ']' ; -tuple +value_list : '{' gen_value (',' gen_value)* '}' ;
diff --git a/mpact/sim/decoder/InstructionSet.g4 b/mpact/sim/decoder/InstructionSet.g4 index 1c5951e..cefbc9a 100644 --- a/mpact/sim/decoder/InstructionSet.g4 +++ b/mpact/sim/decoder/InstructionSet.g4
@@ -351,10 +351,10 @@ // Special rules for generator instruction descriptions. range_assignment : IDENT '=' '[' gen_value (',' gen_value)* ']' - | '[' IDENT (',' IDENT)* ']' '=' '[' tuple (',' tuple)* ']' + | '[' IDENT (',' IDENT)* ']' '=' '[' value_list (',' value_list)* ']' ; -tuple +value_list : '{' gen_value (',' gen_value)* '}' ;
diff --git a/mpact/sim/decoder/ProtoFormat.g4 b/mpact/sim/decoder/ProtoFormat.g4 index b8b7af9..05fbe30 100644 --- a/mpact/sim/decoder/ProtoFormat.g4 +++ b/mpact/sim/decoder/ProtoFormat.g4
@@ -49,10 +49,10 @@ range_assignment : IDENT '=' '[' gen_value (',' gen_value)* ']' - | '[' IDENT (',' IDENT)* ']' '=' '[' tuple (',' tuple)* ']' + | '[' IDENT (',' IDENT)* ']' '=' '[' value_list (',' value_list)* ']' ; -tuple +value_list : '{' gen_value (',' gen_value)* '}' ;
diff --git a/mpact/sim/decoder/bin_format_visitor.cc b/mpact/sim/decoder/bin_format_visitor.cc index 54ec8fd..8ab7ca5 100644 --- a/mpact/sim/decoder/bin_format_visitor.cc +++ b/mpact/sim/decoder/bin_format_visitor.cc
@@ -948,7 +948,7 @@ // format definitions. if (ctx->number() != nullptr) { int width = ConvertToInt(ctx->number()); - std::string format_name = ctx->format->getText(); + std::string format_name = ctx->inst_format->getText(); auto iter = format_decl_map_.find(format_name); if (iter == format_decl_map_.end()) { error_listener_->semanticError( @@ -1107,7 +1107,7 @@ continue; } // It's a list of tuples with a structured binding assignment. - for (auto* tuple_ctx : assign_ctx->tuple()) { + for (auto* tuple_ctx : assign_ctx->value_list()) { if (tuple_ctx->gen_value().size() != range_info->range_names.size()) { // Clean up. for (auto* info : range_info_vec) delete info;
diff --git a/mpact/sim/decoder/instruction_set_contexts.h b/mpact/sim/decoder/instruction_set_contexts.h index 3ae2e15..ca8d67d 100644 --- a/mpact/sim/decoder/instruction_set_contexts.h +++ b/mpact/sim/decoder/instruction_set_contexts.h
@@ -56,7 +56,7 @@ using GeneratorOpcodeSpecListCtx = InstructionSetParser::Generator_opcode_spec_listContext; using RangeAssignmentCtx = InstructionSetParser::Range_assignmentContext; -using TupleCtx = InstructionSetParser::TupleContext; +using ValueListCtx = InstructionSetParser::Value_listContext; using GenValueCtxt = InstructionSetParser::Gen_valueContext; } // namespace instruction_set
diff --git a/mpact/sim/decoder/instruction_set_visitor.cc b/mpact/sim/decoder/instruction_set_visitor.cc index 9b785cc..00172e4 100644 --- a/mpact/sim/decoder/instruction_set_visitor.cc +++ b/mpact/sim/decoder/instruction_set_visitor.cc
@@ -1836,7 +1836,7 @@ continue; } // It's a list of tuples with a structured binding assignment. - for (auto* tuple_ctx : assign_ctx->tuple()) { + for (auto* tuple_ctx : assign_ctx->value_list()) { if (tuple_ctx->gen_value().size() != range_info->range_names.size()) { for (auto* info : range_info_vec) delete info; return absl::InternalError(
diff --git a/mpact/sim/decoder/proto_format_visitor.cc b/mpact/sim/decoder/proto_format_visitor.cc index c562e70..8dfb867 100644 --- a/mpact/sim/decoder/proto_format_visitor.cc +++ b/mpact/sim/decoder/proto_format_visitor.cc
@@ -867,7 +867,7 @@ continue; } // It's a list of tuples with a structured binding assignment. - for (auto* tuple_ctx : assign_ctx->tuple()) { + for (auto* tuple_ctx : assign_ctx->value_list()) { if (tuple_ctx->gen_value().size() != range_info->range_names.size()) { // Clean up. for (auto* info : range_info_vec) delete info;