1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// Autogenerated file -- DO NOT EDIT! 17 18% additional_deprecated_opcodes = ["JNSTRICTEQUNDEFINED", 19% "JSTRICTEQUNDEFINED", 20% "JNEUNDEFINED", 21% "JEQUNDEFINED", 22% "JNSTRICTEQNULL", 23% "JSTRICTEQNULL", 24% "JNENULL", 25% "JEQNULL", 26% "JNSTRICTEQZ", 27% "JSTRICTEQZ", 28% "STTOGLOBALRECORD", 29% "STCONSTTOGLOBALRECORD", 30% "CREATEREGEXPWITHLITERAL", 31% "CLOSEITERATOR"] 32 33% replaced_opcodes = ["JNSTRICTEQ", 34% "JSTRICTEQ", 35% "JNE", 36% "JEQ"] 37 38% skipped_opcodes = additional_deprecated_opcodes + replaced_opcodes 39 40% Panda::instructions.group_by(&:mnemonic).each do |mnemonic, group| 41% insn = group.first 42% signature = assembler_signature(group, insn.jump?) 43% signature_str = signature.map { |o| "#{o.type} #{o.name}" }.join(', ') 44% if !(insn.opcode.upcase.include? "DEPRECATED_") && !(skipped_opcodes.include? insn.mnemonic.upcase) 45// NOLINTNEXTLINE(readability-identifier-naming) 46static InsWrapper Create_<%= insn.asm_token %>_Wrapper(<%= signature_str %>) 47{ 48 InsWrapper <%=insn.emitter_name.downcase%>Inst; 49 <%=group.first.emitter_name.downcase%>Inst.opcode = "<%= insn.asm_token.downcase %>"; 50% format = format_ops(insn.format) 51% format.each { |o| o.width = storage_width(o.width) } 52% count_reg = 0 53% format.each_with_index do |o, i| 54% if o.name.start_with?('v') 55% count_reg += 1 56% end 57% end 58% if count_reg > 0 then 59 <%=group.first.emitter_name.downcase%>Inst.regs.reserve(<%= count_reg %>); 60% end 61% format.each_with_index do |o, i| 62% if o.name.start_with?('imm') 63% if insn.jump? 64 <%=group.first.emitter_name.downcase%>Inst.ids.push_back(label); 65% else 66 <%=group.first.emitter_name.downcase%>Inst.imms.emplace_back(<%= o.name %>); 67% end 68% elsif o.name.start_with?('id') 69 <%=group.first.emitter_name.downcase%>Inst.ids.push_back(<%= o.name %>); 70% else 71 <%=group.first.emitter_name.downcase%>Inst.regs.push_back(<%= o.name %>); 72% end 73% end 74 return <%=insn.emitter_name.downcase%>Inst; 75} 76% end 77% end 78